Skip to content

Commit

Permalink
updated endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Iulian Masar committed Sep 18, 2023
1 parent 270b2f9 commit e8fc12f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 5 additions & 3 deletions mangopay/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,11 +368,10 @@ class CardValidation(BaseModel):
result_code = CharField(api_name='ResultCode')
result_message = CharField(api_name='ResultMessage')


def validate(self, *args, **kwargs):
kwargs['id'] = self.id
def validate(self, card_id, **kwargs):
insert = InsertQuery(self, **kwargs)
insert.insert_query = self.get_field_dict()
insert.insert_query['id'] = card_id
insert.identifier = 'CARD_VALIDATE'
return insert.execute()

Expand Down Expand Up @@ -772,6 +771,7 @@ class Meta:
InsertQuery.identifier: '/payins/googlepay/direct'
}


class MbwayPayIn(PayIn):
creation_date = DateTimeField(api_name='CreationDate')
author = ForeignKeyField(User, api_name='AuthorId', required=True)
Expand All @@ -788,6 +788,7 @@ class Meta:
SelectQuery.identifier: '/payins'
}


class CardWebPayIn(PayIn):
author = ForeignKeyField(User, api_name='AuthorId', required=True)
credited_wallet = ForeignKeyField(Wallet, api_name='CreditedWalletId', required=True)
Expand Down Expand Up @@ -878,6 +879,7 @@ class Meta:
SelectQuery.identifier: '/payins'
}


class PreAuthorization(BaseModel):
author = ForeignKeyField(User, api_name='AuthorId', required=True)
debited_funds = MoneyField(api_name='DebitedFunds', required=True)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_cards.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,16 +299,16 @@ def test_cardValidation(self):
registration_data_response = requests.post(card_registration.card_registration_url, data=data, headers=headers)
saved_registration['registration_data'] = registration_data_response.text
updated_registration = CardRegistration(**saved_registration).save()
card_id = updated_registration['card_id']

card_validation = CardValidation()
card_validation.author = user
card_validation.id = updated_registration['card_id']
card_validation.tag = "test"
card_validation.secure_mode_return_url = "http://www.example.com/"
card_validation.ip_address = "2001:0620:0000:0000:0211:24FF:FE80:C12C"
card_validation.browser_info = BaseTest.get_browser_info()

validation_response = card_validation.validate()
validation_response = card_validation.validate(card_id)

self.assertIsNotNone(validation_response)
self.assertIsNotNone(validation_response['id'])
self.assertIsNotNone(validation_response['id'])

0 comments on commit e8fc12f

Please sign in to comment.