Ejemplo n.º 1
0
    def do_ponypay_withdraw_callback(self, status):
        amount = tx_amount = Decimal("100.25")

        # 生成一个可以回调的订单
        order = InitData.init_withdraw_order_deal(amount)

        channel_config = ChannelConfig.query_by_channel_id(order.channel_id)
        controller = WithdrawCallbackPonypay(channel_config.channel_enum)
        sign = controller.generate_sign(order.sys_tx_id, tx_amount)

        self.path = "/callback/ponypay/withdraw"
        params = """merchant_id={}&corderid={}&money={}&status={}&sign={}""".format(
            controller.third_config['mch_id'],
            order.sys_tx_id,
            tx_amount,
            status,
            sign,
        )
        response = self.do_get_request(params=params)
        self.assertEqual(200, response.status_code)
        self.assertEqual("SUCCESS", response.data.decode("utf-8"))
Ejemplo n.º 2
0
 def __test_withdraw_fail(self):
     amount = Decimal("100.25")
     order = InitData.init_withdraw_order_deal(amount)
     rst = WithdrawTransactionCtl.order_fail(order)
     self.assertTrue(rst)
Ejemplo n.º 3
0
 def __test_withdraw_success(self):
     amount = tx_amount = Decimal("100.25")
     order = InitData.init_withdraw_order_deal(amount)
     rst = WithdrawTransactionCtl.order_success(order, tx_amount)
     self.assertTrue(rst)