bugfix
This commit is contained in:
parent
4f98a84635
commit
0dd4d007dd
@ -0,0 +1,6 @@
|
||||
from pricing.pricing import pricing_program_charging
|
||||
from ahserver.serverenv import ServerEnv
|
||||
|
||||
def load_pricing():
|
||||
env = ServerEnv()
|
||||
env.pricing_program_charging = pricing_program_charging
|
||||
@ -1,6 +1,4 @@
|
||||
|
||||
class PricingType:
|
||||
|
||||
from ahserver.serverenv import ServerEnv
|
||||
|
||||
class PricingProgram
|
||||
def __init__(self, ppid, sor):
|
||||
@ -28,7 +26,17 @@ class PricingProgram
|
||||
recs = await self.sor.R('program_spec', {'id', psid})
|
||||
return recs
|
||||
|
||||
pricing_program_charging(sor, pricing_program_id, data):
|
||||
async def get_remote_pricing(sor, charge, data):
|
||||
env = ServerEnv()
|
||||
get_callerid = env.get_callerid
|
||||
userid = await get_callerid(self.ownerid)
|
||||
uapi = UAPI()
|
||||
ret = await uapi.call(charge.upappid, charge.apiname,
|
||||
userid, params=data)
|
||||
d = json.loads(ret.decode('utf-8'))
|
||||
return d
|
||||
|
||||
async def pricing_program_charging(sor, pricing_program_id, data):
|
||||
pp = PricingProgram(pricing_program_id)
|
||||
await pp.init()
|
||||
pp_items = pp.get_items()
|
||||
@ -51,8 +59,7 @@ pricing_program_charging(sor, pricing_program_id, data):
|
||||
charge.amount = d * charge_amount / charge.pricing_unit
|
||||
charges.append(charge)
|
||||
elif spec.pricing_spec_mode == 'remote_pricing':
|
||||
charge.amount = await get_remote_pricing(charge.uappid,
|
||||
charge.apiname, params=d)
|
||||
charge.amount = await get_remote_pricing(sor, charge, params=d)
|
||||
charges.append(charge)
|
||||
elif spec.pricing_spec_mode == 'sub_pricing':
|
||||
sub_charges = await pricing_program_chargeing(self.sor,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user