本文整理汇总了Python中mangopaysdk.entities.payin.PayIn.ResultCode方法的典型用法代码示例。如果您正苦于以下问题:Python PayIn.ResultCode方法的具体用法?Python PayIn.ResultCode怎么用?Python PayIn.ResultCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mangopaysdk.entities.payin.PayIn
的用法示例。
在下文中一共展示了PayIn.ResultCode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_payin_bank_wire_callback
# 需要导入模块: from mangopaysdk.entities.payin import PayIn [as 别名]
# 或者: from mangopaysdk.entities.payin.PayIn import ResultCode [as 别名]
def test_payin_bank_wire_callback(self, Get):
homer = self.homer
route = ExchangeRoute.insert(homer, 'mango-bw', 'x')
for status in ('failed', 'succeeded'):
status_up = status.upper()
error = 'FOO' if status == 'failed' else None
e_id = record_exchange(self.db, route, 11, 0, 0, homer, 'pre')
assert homer.balance == 0
homer.close(None)
assert homer.status == 'closed'
qs = "EventType=PAYIN_NORMAL_"+status_up+"&RessourceId=123456790"
payin = PayIn()
payin.Status = status_up
payin.ResultCode = '000001' if error else '000000'
payin.ResultMessage = error
payin.AuthorId = homer.mangopay_user_id
payin.PaymentType = 'BANK_WIRE'
payin.Tag = str(e_id)
Get.return_value = payin
r = self.callback(qs)
assert r.code == 200, r.text
homer = homer.refetch()
if status == 'succeeded':
assert homer.balance == 11
assert homer.status == 'active'
else:
assert homer.balance == 0
assert homer.status == 'closed'
emails = self.get_emails()
assert len(emails) == 1
assert emails[0]['to'][0] == 'homer <%s>' % homer.email
assert status[:4] in emails[0]['subject']
homer.update_status('active') # reset for next loop run