本文整理汇总了Python中paypal.pro.helpers.PayPalWPP.doReferenceTransaction方法的典型用法代码示例。如果您正苦于以下问题:Python PayPalWPP.doReferenceTransaction方法的具体用法?Python PayPalWPP.doReferenceTransaction怎么用?Python PayPalWPP.doReferenceTransaction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类paypal.pro.helpers.PayPalWPP
的用法示例。
在下文中一共展示了PayPalWPP.doReferenceTransaction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_doReferenceTransaction_invalid
# 需要导入模块: from paypal.pro.helpers import PayPalWPP [as 别名]
# 或者: from paypal.pro.helpers.PayPalWPP import doReferenceTransaction [as 别名]
def test_doReferenceTransaction_invalid(self, mock_request_object):
reference_id = 'B-1234'
amount = Decimal('10.50')
mock_request_object.return_value = 'ack=Failure&l_errorcode=42&l_longmessage0=Broken'
wpp = PayPalWPP(REQUEST)
with self.assertRaises(PayPalFailure):
wpp.doReferenceTransaction({'referenceid': reference_id,
'amt': amount})
示例2: test_doReferenceTransaction_valid
# 需要导入模块: from paypal.pro.helpers import PayPalWPP [as 别名]
# 或者: from paypal.pro.helpers.PayPalWPP import doReferenceTransaction [as 别名]
def test_doReferenceTransaction_valid(self, mock_request_object):
reference_id = 'B-1234'
amount = Decimal('10.50')
mock_request_object.return_value = 'ack=Success&paymentstatus=Completed&amt=%s&version=%s&billingagreementid=%s' % \
(amount, VERSION, reference_id)
wpp = PayPalWPP(REQUEST)
nvp = wpp.doReferenceTransaction({'referenceid': reference_id,
'amt': amount})
call_args = mock_request_object.call_args
self.assertIn('VERSION=%s' % VERSION, call_args[0][1])
self.assertIn('METHOD=DoReferenceTransaction', call_args[0][1])
self.assertIn('REFERENCEID=%s' % reference_id, call_args[0][1])
self.assertIn('AMT=%s' % amount, call_args[0][1])
self.assertEqual(nvp.method, 'DoReferenceTransaction')
self.assertEqual(nvp.ack, 'Success')