from sqlor.dbpools import DBPools
from appPublic.jsonConfig import getConfig
from appPublic.dictObject import DictObject
from accounting.recharge import RechargeAccounting
from run_test import run

async def test1():
	rl = DictObject()
	rl.customerid = '4zXVMkBCEaTmR0xwneUBX'
	rl.recharge_date = '2024-09-21'
	rl.recharge_amt = 100
	rl.action = 'RECHARGE'
	rl.orderid = '1'
	rl.recharge_channel = 'alipay'
	ra = RechargeAccounting(rl)
	db = DBPools()
	async with db.sqlorContext('sage') as sor:
		await ra.accounting(sor)

async def test2():
	rl = DictObject()
	rl.customerid = '4zXVMkBCEaTmR0xwneUBX'
	rl.recharge_date = '2024-09-21'
	rl.recharge_amt = 100
	rl.action = 'RECHARGE_REVERSE'
	rl.orderid = '1'
	rl.recharge_channel = 'alipay'
	ra = RechargeAccounting(rl)
	db = DBPools()
	async with db.sqlorContext('sage') as sor:
		await ra.accounting(sor)

async def test():
	await test1()
	await test2()

if __name__ == '__main__':
	run(test)