diff --git a/unipay/init.py b/unipay/init.py index fbe3793..a1c104c 100644 --- a/unipay/init.py +++ b/unipay/init.py @@ -105,7 +105,8 @@ async def create_payment(request, params_kw=None): raise e notify_url = env.entire_url(f'notify/{provider}') pl = PaymentLog(request._run_ns) - fee = await get_pay_fee(provider, data.amount) + feerate = await get_pay_fee(provider, data.amount) + fee = feerate * data.amount channel = get_provider_channel(provider) userid = await env.get_user() orgid = await env.get_userorgid() @@ -116,7 +117,7 @@ async def create_payment(request, params_kw=None): currency = data.currency plog = await pl.new_log(userid, orgid, provider, amount, - fee, client_ip, currency=currency) + feerate, client_ip, currency=currency) if plog: data.out_trade_no = plog.id data.customerid = orgid diff --git a/unipay/payfee.py b/unipay/payfee.py index 9316d86..3ff2e10 100644 --- a/unipay/payfee.py +++ b/unipay/payfee.py @@ -81,5 +81,5 @@ async def sor_get_pay_fee(sor, providerid, amount): exception(f'Exception:{e}') rec.fee_rate = 0.00 debug(f'{rec=}, {rec.fee_rate=}, {amount=}') - return rec.fee_rate * amount + return rec.fee_rate