本文整理匯總了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