def __test_manually_withdraw_success(self): amount = Decimal("200.25") channel_cost = Decimal('3.5') admin_user = InitData.get_admin_user() order = InitData.init_withdraw_order_alloc(amount) rsp = WithdrawTransactionCtl.manually_withdraw(admin_user, order.merchant, order.order_id) self.assertIsInstance(rsp, (ResponseSuccess, )) # 先成功 rsp = WithdrawTransactionCtl.manually_withdraw_success( admin_user=admin_user, merchant=order.merchant, order_id=order.order_id, channel_cost=channel_cost, comment="好贵啊", ) self.assertIsInstance(rsp, (ResponseSuccess, )) # 后失败 rsp = WithdrawTransactionCtl.manually_withdraw_failed( admin_user=admin_user, merchant=order.merchant, order_id=order.order_id, ) self.assertIsInstance(rsp, (ResponseSuccess, ))
def __test_manually_withdraw_fail(self): amount = Decimal("200.25") admin_user = InitData.get_admin_user() # 先认领 order = InitData.init_withdraw_order_alloc(amount) # 直接拒绝 rsp = WithdrawTransactionCtl.manually_withdraw_failed( admin_user=admin_user, merchant=order.merchant, order_id=order.order_id, ) self.assertIsInstance(rsp, (ResponseSuccess, ))
def post(self): """ 拒绝提现 或 提现失败 :return: """ form, error = WithDrawBankForm().request_validate() if error: return error.as_response() rsp = WithdrawTransactionCtl.manually_withdraw_failed( admin_user=g.user, merchant=form.merchant.data, order_id=form.order_id.data, ) return rsp.as_response()