Skip to content

Commit b36150e

Browse files
authored
Merge pull request #50 from hyperwallet/feature/DTPAYWONE-568-add-missing-webhook-groups
DTPAYWONE-568 add missing webhook groups
2 parents 204eb84 + e2cabde commit b36150e

2 files changed

Lines changed: 81 additions & 1 deletion

File tree

hyperwallet/models.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,11 @@ def __init__(self, data):
895895
'PAYMENTS': Payment,
896896
'BANK_ACCOUNTS': BankAccount,
897897
'PREPAID_CARDS': PrepaidCard,
898-
'USERS': User
898+
'USERS': User,
899+
"BANK_CARDS": BankCard,
900+
"PAYPAL_ACCOUNTS": PayPalAccount,
901+
"PAPER_CHECKS": PaperCheck,
902+
"VENMO_ACCOUNTS": VenmoAccount
899903
}
900904

901905
base, sub = self.type.split('.')[:2]

hyperwallet/tests/test_models.py

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,82 @@ def test_webhook_model_good_sub_type(self):
504504
)
505505
)
506506

507+
def test_webhook_model_good_sub_type_paypal(self):
508+
509+
webhook_data = {
510+
'token': 'wbh-12345',
511+
'createdOn': '2017-01-01',
512+
'type': 'USER.PAYPAL_ACCOUNTS.CREATED',
513+
'object': self.transfer_method_data
514+
}
515+
516+
test_webhook = Webhook(webhook_data)
517+
518+
self.assertEqual(
519+
test_webhook.object.__repr__(),
520+
'PayPalAccount({date}, {token})'.format(
521+
date=self.transfer_method_data.get('createdOn'),
522+
token=self.transfer_method_data.get('token')
523+
)
524+
)
525+
526+
def test_webhook_model_good_sub_type_venmo(self):
527+
528+
webhook_data = {
529+
'token': 'wbh-12345',
530+
'createdOn': '2017-01-01',
531+
'type': 'USER.VENMO_ACCOUNTS.CREATED',
532+
'object': self.transfer_method_data
533+
}
534+
535+
test_webhook = Webhook(webhook_data)
536+
537+
self.assertEqual(
538+
test_webhook.object.__repr__(),
539+
'VenmoAccount({date}, {token})'.format(
540+
date=self.transfer_method_data.get('createdOn'),
541+
token=self.transfer_method_data.get('token')
542+
)
543+
)
544+
545+
def test_webhook_model_good_sub_type_bankCard(self):
546+
547+
webhook_data = {
548+
'token': 'wbh-12345',
549+
'createdOn': '2017-01-01',
550+
'type': 'USER.BANK_CARDS.CREATED',
551+
'object': self.transfer_method_data
552+
}
553+
554+
test_webhook = Webhook(webhook_data)
555+
556+
self.assertEqual(
557+
test_webhook.object.__repr__(),
558+
'BankCard({date}, {token})'.format(
559+
date=self.transfer_method_data.get('createdOn'),
560+
token=self.transfer_method_data.get('token')
561+
)
562+
)
563+
564+
def test_webhook_model_good_sub_type_paperCheck(self):
565+
566+
webhook_data = {
567+
'token': 'wbh-12345',
568+
'createdOn': '2017-01-01',
569+
'type': 'USER.PAPER_CHECKS.CREATED',
570+
'object': self.transfer_method_data
571+
}
572+
573+
test_webhook = Webhook(webhook_data)
574+
575+
self.assertEqual(
576+
test_webhook.object.__repr__(),
577+
'PaperCheck({date}, {token})'.format(
578+
date=self.transfer_method_data.get('createdOn'),
579+
token=self.transfer_method_data.get('token')
580+
)
581+
)
582+
507583
def test_webhook_model_bad_object(self):
508584

509585
webhook_data = {

0 commit comments

Comments
 (0)