From 270b2f999bbdb0689241ab50629ca767ce7aa2c2 Mon Sep 17 00:00:00 2001 From: Silviana Ghita Date: Wed, 6 Sep 2023 17:16:01 +0300 Subject: [PATCH] Added missing fields to CardValidation entity and updated test --- mangopay/constants.py | 3 ++- mangopay/resources.py | 14 ++++++++++++++ tests/test_cards.py | 3 +-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/mangopay/constants.py b/mangopay/constants.py index 0f0952a..0fa9c53 100644 --- a/mangopay/constants.py +++ b/mangopay/constants.py @@ -47,7 +47,8 @@ TRANSACTION_TYPE_CHOICES = Choices( ('PAYIN', 'payin', 'Pay In'), ('PAYOUT', 'payout', 'Pay out'), - ('TRANSFER', 'transfer', 'Transfer') + ('TRANSFER', 'transfer', 'Transfer'), + ('CARD_VALIDATION', 'card_validation', 'Card validation') ) NATURE_CHOICES = Choices( diff --git a/mangopay/resources.py b/mangopay/resources.py index 9df15c9..0fb0fbf 100644 --- a/mangopay/resources.py +++ b/mangopay/resources.py @@ -350,10 +350,24 @@ def __str__(self): class CardValidation(BaseModel): + creation_date = DateTimeField(api_name='CreationDate') author = ForeignKeyField(User, api_name='AuthorId', required=True) ip_address = CharField(api_name='IpAddress', required=True) browser_info = BrowserInfoField(api_name='BrowserInfo', required=True) secure_mode_return_url = CharField(api_name='SecureModeReturnURL', required=True) + secure_mode_redirect_url = CharField(api_name='SecureModeRedirectURL') + secure_mode_needed = BooleanField(api_name='SecureModeNeeded') + validity = CharField(api_name='Validity', + choices=constants.VALIDITY_CHOICES, + default=constants.VALIDITY_CHOICES.unknown) + type = CharField(api_name='Type', choices=constants.TRANSACTION_TYPE_CHOICES, default=None) + applied_3ds_version = CharField(api_name='Applied3DSVersion') + status = CharField(api_name='Status', + choices=constants.STATUS_CHOICES, + default=None) + result_code = CharField(api_name='ResultCode') + result_message = CharField(api_name='ResultMessage') + def validate(self, *args, **kwargs): kwargs['id'] = self.id diff --git a/tests/test_cards.py b/tests/test_cards.py index 8fb32cb..26f6e1a 100644 --- a/tests/test_cards.py +++ b/tests/test_cards.py @@ -309,7 +309,6 @@ def test_cardValidation(self): card_validation.browser_info = BaseTest.get_browser_info() validation_response = card_validation.validate() - updated_card = Card.get(updated_registration['card_id']) self.assertIsNotNone(validation_response) - self.assertEqual(updated_card.validity, 'VALID') + self.assertIsNotNone(validation_response['id']) \ No newline at end of file