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, ))
예제 #2
0
    def post(self):
        """
        运营确定出款成功
        :return:
        """
        form, error = WithDrawPersonExecutedDoneForm().request_validate()
        if error:
            return error.as_response()

        fee = form.fee.data if form.fee.data else "0"
        comment = form.comment.data

        rsp = WithdrawTransactionCtl.manually_withdraw_success(
            admin_user=g.user,
            merchant=form.merchant.data,
            order_id=form.order_id.data,
            channel_cost=fee,
            comment=comment,
        )

        return rsp.as_response()