Skip to content

Commit

Permalink
handle latest payconiq api url
Browse files Browse the repository at this point in the history
  • Loading branch information
Iulian Masar committed Feb 28, 2025
1 parent 49b5008 commit df6e44d
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 1 deletion.
24 changes: 24 additions & 0 deletions mangopay/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,30 @@ class Meta:
}


@python_2_unicode_compatible
class PayconiqV2PayIn(PayIn):
author = ForeignKeyField(User, api_name='AuthorId', required=True)
debited_funds = MoneyField(api_name='DebitedFunds', required=True)
fees = MoneyField(api_name='Fees', required=True)
return_url = CharField(api_name='ReturnURL', required=True)
credited_wallet = ForeignKeyField(Wallet, api_name='CreditedWalletId', required=True)
redirect_url = CharField(api_name='RedirectURL')
creation_date = DateField(api_name='CreationDate')
expiration_date = CharField(api_name='ExpirationDate')
deep_link_url = CharField(api_name='DeepLinkURL')
country = CharField(api_name='Country', required=True)
statement_descriptor = CharField(api_name='StatementDescriptor')
qr_code_url = CharField(api_name='QRCodeURL')

class Meta:
verbose_name = 'payin'
verbose_name_plural = 'payins'
url = {
InsertQuery.identifier: '/payins/payment-methods/payconiq',
SelectQuery.identifier: '/payins'
}


class ApplepayPayIn(PayIn):
tag = CharField(api_name='Tag')
author = ForeignKeyField(User, api_name='AuthorId', required=True)
Expand Down
29 changes: 28 additions & 1 deletion tests/test_payins.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
RecurringPayInRegistration, \
RecurringPayInCIT, PayInRefund, RecurringPayInMIT, CardPreAuthorizedDepositPayIn, MbwayPayIn, PayPalWebPayIn, \
GooglePayDirectPayIn, MultibancoPayIn, SatispayPayIn, BlikPayIn, KlarnaPayIn, IdealPayIn, GiropayPayIn, \
CardRegistration, BancontactPayIn, SwishPayIn
CardRegistration, BancontactPayIn, SwishPayIn, PayconiqV2PayIn
from mangopay.utils import (Money, ShippingAddress, Shipping, Billing, Address, SecurityInfo, ApplepayPaymentData,
GooglepayPaymentData, DebitedBankAccount, LineItem, CardInfo)
from tests import settings
Expand Down Expand Up @@ -1871,3 +1871,30 @@ def test_RecurringPayment_CheckCardInfo(self):
mit_card_info = created_mit['card_info']
self.assertIsNotNone(mit_card_info)
self.assertIsInstance(mit_card_info, CardInfo)

def test_PayIns_Payconiq_Web_Create(self):
user = BaseTestLive.get_john(True)

# create wallet
credited_wallet = Wallet()
credited_wallet.owners = (user,)
credited_wallet.currency = 'EUR'
credited_wallet.description = 'WALLET IN EUR'
credited_wallet = Wallet(**credited_wallet.save())

payin = PayconiqV2PayIn()
payin.credited_wallet = credited_wallet
payin.author = user
payin.debited_funds = Money(amount=10000, currency='EUR')
payin.fees = Money(amount=0, currency='EUR')
payin.return_url = 'https://test.com'
payin.country = 'BE'
result = PayconiqV2PayIn(**payin.save())

self.assertIsNotNone(result)
self.assertEqual("CREATED", result.status)
self.assertEqual("REGULAR", result.nature)
self.assertEqual("WEB", result.execution_type)
self.assertEqual("PAYCONIQ", result.payment_type)
self.assertIsNotNone(result.deep_link_url)
self.assertIsNotNone(result.qr_code_url)

0 comments on commit df6e44d

Please sign in to comment.