def init_withdraw_order_deal(cls, amount): """ 初始化一个提款订单 :param amount: :return: """ client_ip = '127.0.0.1' user = cls.get_user() bank_card = cls.get_bank_card() admin_user = cls.get_admin_user() order, error = WithdrawTransactionCtl.order_create( user=user, amount=amount, client_ip=client_ip, user_bank_id=bank_card.card_id, ) assert error is None rst = WithdrawTransactionCtl.order_alloc(admin_user.account, order.order_id, cls.merchant) assert isinstance(rst, (ResponseSuccess, )) channel = cls.get_withdraw_channel() rst = WithdrawTransactionCtl.order_deal(admin_user.account, order.order_id, order.merchant, channel.channel_id, test=True) assert isinstance(rst, (ResponseSuccess, )) return WithdrawTransactionCtl.get_order(order.sys_tx_id)
def post(self): """ 提现订单: 运营人员认领订单 :return: """ form, error = WithDrawOrderAllowedForm().request_validate() if error: return error.as_response() order_id = form.order_id.data merchant = form.merchant_name.data rst = WithdrawTransactionCtl.order_alloc(g.user.account, order_id, merchant) return rst.as_response()
def init_withdraw_order_alloc(cls, amount): client_ip = '127.0.0.1' user = cls.get_user() bank_card = cls.get_bank_card() admin_user = cls.get_admin_user() order, error = WithdrawTransactionCtl.order_create( user=user, amount=amount, client_ip=client_ip, user_bank_id=bank_card.card_id, ) assert error is None rst = WithdrawTransactionCtl.order_alloc(admin_user.account, order.order_id, cls.merchant) assert isinstance(rst, (ResponseSuccess, )) return WithdrawTransactionCtl.get_order(order.sys_tx_id)