|
|
@@ -55,7 +55,7 @@ def _request(request) -> dict:
|
|
|
|
|
|
def _response(**data) -> str:
|
|
|
_dict = { 'service_key' : data['service_key'] }
|
|
|
- for k in [ 'listed', 'retail', 'net' ]:
|
|
|
+ for k in [ 'list', 'retail', 'net' ]:
|
|
|
if data.get(k) is not None:
|
|
|
_dict[k] = dollar_fmt(data.get(k))
|
|
|
if data.get('details') is not None:
|
|
|
@@ -81,18 +81,18 @@ def _n2l(data: dict) -> None:
|
|
|
|
|
|
comm_rate = svc.get('fees', {}).get('commission', 0)
|
|
|
wrong_rate = svc.get('taxes', {}).get('wrong', SALES_TAX)
|
|
|
- listed = (net / (1 - comm_rate - SALES_TAX + wrong_rate))
|
|
|
+ list_ = (net / (1 - comm_rate - SALES_TAX + wrong_rate))
|
|
|
if 'fees' in svc and 'commission' in svc['fees']:
|
|
|
- det['commission'] = listed * comm_rate
|
|
|
+ det['commission'] = list_ * comm_rate
|
|
|
if 'taxes' in svc and 'wrong' in svc['taxes']:
|
|
|
- det['wrong_tax'] = listed * wrong_rate
|
|
|
- det['sales_tax'] = listed * SALES_TAX
|
|
|
+ det['wrong_tax'] = list_ * wrong_rate
|
|
|
+ det['sales_tax'] = list_ * SALES_TAX
|
|
|
det['wrong_tax_loss'] = det['sales_tax'] - det['wrong_tax']
|
|
|
- data['listed'] = round(listed, 2)
|
|
|
+ data['list'] = round(list_, 2)
|
|
|
def _l2n(data: dict) -> None:
|
|
|
svc = data['service']
|
|
|
det = data['details']
|
|
|
- net = data['listed'] if data.get('listed') else data['amount']
|
|
|
+ net = data['list'] if data.get('list') else data['amount']
|
|
|
if 'fees' in svc and 'commission' in svc['fees']:
|
|
|
det['commission'] = net * svc['fees']['commission']
|
|
|
if 'taxes' in svc and 'wrong' in svc['taxes']:
|
|
|
@@ -107,7 +107,7 @@ def _l2n(data: dict) -> None:
|
|
|
def _l2r(data: dict) -> None:
|
|
|
svc = data['service']
|
|
|
det = data['details']
|
|
|
- retail = data['listed'] if data.get('listed') else data['amount']
|
|
|
+ retail = data['list'] if data.get('list') else data['amount']
|
|
|
if 'fees' in svc and 'client_fee' in svc['fees']:
|
|
|
det['client_fee'] = retail * svc['fees']['client_fee']
|
|
|
retail += det['client_fee']
|
|
|
@@ -124,20 +124,20 @@ def _l2r(data: dict) -> None:
|
|
|
def _r2l(data: dict) -> None:
|
|
|
svc = data['service']
|
|
|
det = data['details']
|
|
|
- listed = data['retail'] if data.get('retail') else data['amount']
|
|
|
+ list_ = data['retail'] if data.get('retail') else data['amount']
|
|
|
if 'taxes' in svc and 'flat_tax' in svc['taxes']:
|
|
|
det['service_tax'] = svc['taxes']['flat_tax']
|
|
|
- listed -= det['service_tax']
|
|
|
+ list_ -= det['service_tax']
|
|
|
if 'taxes' in svc and 'wrong' in svc['taxes']:
|
|
|
- det['wrong_tax'] = listed - (listed / (1 + svc['taxes']['wrong']))
|
|
|
- listed -= det['wrong_tax']
|
|
|
+ det['wrong_tax'] = list_ - (list_ / (1 + svc['taxes']['wrong']))
|
|
|
+ list_ -= det['wrong_tax']
|
|
|
else:
|
|
|
- det['sales_tax'] = listed - (listed / (1 + SALES_TAX))
|
|
|
- listed -= det['sales_tax']
|
|
|
+ det['sales_tax'] = list_ - (list_ / (1 + SALES_TAX))
|
|
|
+ list_ -= det['sales_tax']
|
|
|
if 'fees' in svc and 'client_fee' in svc['fees']:
|
|
|
- det['client_fee'] = listed - (listed / (1 + svc['fees']['client_fee']))
|
|
|
- listed -= det['client_fee']
|
|
|
- data['listed'] = round(listed, 2)
|
|
|
+ det['client_fee'] = list_ - (list_ / (1 + svc['fees']['client_fee']))
|
|
|
+ list_ -= det['client_fee']
|
|
|
+ data['list'] = round(list_, 2)
|
|
|
|
|
|
# Routing
|
|
|
routes = [
|