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 = WithdrawOrderPerformForm().request_validate() if error: return error.as_response() merchant = form.merchant.data order_id = form.order_id.data channel_id = form.channel_id.data rst = WithdrawTransactionCtl.order_deal(g.user.account, order_id, merchant, channel_id) return rst.as_response()