Skip to content

[feature] handle extended card web payin #422

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions mangopay/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -2800,3 +2800,29 @@ def get(cls, country, currency, *args, **kwargs):
kwargs['currency'] = currency
select = SelectQuery(PayoutMethod, *args, **kwargs)
return select.get("", *args, **kwargs)


class ExtendedCardWebPayin(BaseModel):
payment_type = CharField(api_name='PaymentType', choices=constants.PAYIN_PAYMENT_TYPE, default=None)
execution_type = CharField(api_name='ExecutionType', choices=constants.EXECUTION_TYPE_CHOICES, default=None)
expiration_date = CharField(api_name='ExpirationDate')
alias = CharField(api_name='Alias')
card_type = CharField(api_name='CardType',
choices=constants.CARD_TYPE_CHOICES,
default=None)
country = CharField(api_name='Country')
fingerprint = CharField(api_name='Fingerprint')

class Meta:
verbose_name = 'extended_card_web_payin'
verbose_name_plural = 'extended_card_web_payins'

url = {
SelectQuery.identifier: '/payins/card/web/%(id)s/extended'
}

@classmethod
def get(cls, pay_in_id, *args, **kwargs):
kwargs['id'] = pay_in_id
select = SelectQuery(ExtendedCardWebPayin, *args, **kwargs)
return select.get("", *args, **kwargs)
10 changes: 9 additions & 1 deletion tests/test_payins.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
RecurringPayInCIT, PayInRefund, RecurringPayInMIT, CardPreAuthorizedDepositPayIn, MbwayPayIn, PayPalWebPayIn, \
GooglePayDirectPayIn, MultibancoPayIn, SatispayPayIn, BlikPayIn, KlarnaPayIn, IdealPayIn, GiropayPayIn, \
CardRegistration, BancontactPayIn, SwishPayIn, PayconiqV2PayIn, TwintPayIn, PayByBankPayIn, RecurringPayPalPayInCIT, \
RecurringPayPalPayInMIT
RecurringPayPalPayInMIT, ExtendedCardWebPayin
from mangopay.utils import (Money, ShippingAddress, Shipping, Billing, Address, SecurityInfo, ApplepayPaymentData,
GooglepayPaymentData, DebitedBankAccount, LineItem, CardInfo)
from tests import settings
Expand Down Expand Up @@ -2185,3 +2185,11 @@ def test_PayIns_PayByBankWeb_Create(self):
self.assertEqual("WEB", result.execution_type)
self.assertEqual("PAY_BY_BANK", result.payment_type)
self.assertEqual("PAYIN", result.type)

def test_get_extended_card_web_payin(self):
payin = BaseTestLive.get_johns_payin()
result = ExtendedCardWebPayin.get(payin.id)

self.assertIsNotNone(result)
self.assertEqual("WEB", result.execution_type)
self.assertEqual("CARD", result.payment_type)
Loading