8
8
RecurringPayInRegistration , \
9
9
RecurringPayInCIT , PayInRefund , RecurringPayInMIT , CardPreAuthorizedDepositPayIn , MbwayPayIn , PayPalWebPayIn , \
10
10
GooglePayDirectPayIn , MultibancoPayIn , SatispayPayIn , BlikPayIn , KlarnaPayIn , IdealPayIn , GiropayPayIn , \
11
- CardRegistration , BancontactPayIn , SwishPayIn , PayconiqV2PayIn , TwintPayIn , PayByBankPayIn , RecurringPayPalPayInCIT , RecurringPayPalPayInMIT
11
+ CardRegistration , BancontactPayIn , SwishPayIn , PayconiqV2PayIn , TwintPayIn , PayByBankPayIn , RecurringPayPalPayInCIT , \
12
+ RecurringPayPalPayInMIT
12
13
from mangopay .utils import (Money , ShippingAddress , Shipping , Billing , Address , SecurityInfo , ApplepayPaymentData ,
13
14
GooglepayPaymentData , DebitedBankAccount , LineItem , CardInfo )
14
15
from tests import settings
@@ -771,6 +772,23 @@ def test_using_api_names_as_payin_attributes(self):
771
772
self .assertIs (payin .Tag , payin .tag )
772
773
773
774
775
+ def new_blik (user , credited_wallet ):
776
+ pay_in = BlikPayIn ()
777
+ pay_in .author = user
778
+ pay_in .credited_wallet = credited_wallet
779
+ pay_in .fees = Money ()
780
+ pay_in .fees .amount = 300
781
+ pay_in .fees .currency = 'PLN'
782
+ pay_in .debited_funds = Money ()
783
+ pay_in .debited_funds .amount = 1000
784
+ pay_in .debited_funds .currency = 'PLN'
785
+ pay_in .statement_descriptor = 'test'
786
+ pay_in .return_url = 'https://example.com?transactionId=wt_57b8f69d-cbcc-4202-9a4f-9a3f3668240b'
787
+ pay_in .redirect_url = 'https://r3.girogate.de/ti/dumbdummy?tx=140079495229&rs=oHkl4WvsgwtWpMptWpqWlFa90j0EzzO9&cs=e43baf1ae4a556dfb823fd304acc408580c193e04c1a9bcb26699b4185393b05'
788
+ pay_in .tag = 'Blik tag'
789
+ return pay_in
790
+
791
+
774
792
class PayInsTestLive (BaseTestLive ):
775
793
@unittest .skip ('Set a breakpoint after creating the mandate, navigate to mandate.redirect_url and confirm' )
776
794
def test_PayIns_DirectDebitDirect_Create (self ):
@@ -1500,19 +1518,7 @@ def test_PayIns_BlikWeb_Create(self):
1500
1518
credited_wallet .description = 'WALLET IN PLN'
1501
1519
credited_wallet = Wallet (** credited_wallet .save ())
1502
1520
1503
- pay_in = BlikPayIn ()
1504
- pay_in .author = user
1505
- pay_in .credited_wallet = credited_wallet
1506
- pay_in .fees = Money ()
1507
- pay_in .fees .amount = 300
1508
- pay_in .fees .currency = 'PLN'
1509
- pay_in .debited_funds = Money ()
1510
- pay_in .debited_funds .amount = 1000
1511
- pay_in .debited_funds .currency = 'PLN'
1512
- pay_in .statement_descriptor = 'test'
1513
- pay_in .return_url = 'https://example.com?transactionId=wt_57b8f69d-cbcc-4202-9a4f-9a3f3668240b'
1514
- pay_in .redirect_url = 'https://r3.girogate.de/ti/dumbdummy?tx=140079495229&rs=oHkl4WvsgwtWpMptWpqWlFa90j0EzzO9&cs=e43baf1ae4a556dfb823fd304acc408580c193e04c1a9bcb26699b4185393b05'
1515
- pay_in .tag = 'Blik tag'
1521
+ pay_in = new_blik (user , credited_wallet )
1516
1522
1517
1523
result = BlikPayIn (** pay_in .save ())
1518
1524
fetched = BlikPayIn ().get (result .id )
@@ -1527,6 +1533,34 @@ def test_PayIns_BlikWeb_Create(self):
1527
1533
self .assertEqual ("BLIK" , result .payment_type )
1528
1534
self .assertEqual ("PAYIN" , result .type )
1529
1535
1536
+ def test_PayIns_BlikWebWithCode_Create (self ):
1537
+ user = BaseTestLive .get_john (True )
1538
+
1539
+ # create wallet
1540
+ credited_wallet = Wallet ()
1541
+ credited_wallet .owners = (user ,)
1542
+ credited_wallet .currency = 'PLN'
1543
+ credited_wallet .description = 'WALLET IN PLN'
1544
+ credited_wallet = Wallet (** credited_wallet .save ())
1545
+
1546
+ pay_in = new_blik (user , credited_wallet )
1547
+ pay_in .code = '777365'
1548
+ pay_in .ip_address = '159.180.248.187'
1549
+ pay_in .browser_info = BaseTest .get_browser_info ()
1550
+
1551
+ result = BlikPayIn (** pay_in .save ())
1552
+ fetched = BlikPayIn ().get (result .id )
1553
+
1554
+ self .assertIsNotNone (result )
1555
+ self .assertIsNotNone (fetched )
1556
+ self .assertEqual (result .id , fetched .id )
1557
+
1558
+ self .assertEqual ("CREATED" , result .status )
1559
+ self .assertEqual ("BLIK" , result .payment_type )
1560
+ self .assertIsNotNone (result .code )
1561
+ self .assertIsNotNone (result .ip_address )
1562
+ self .assertIsNotNone (result .browser_info )
1563
+
1530
1564
def test_PayIns_KlarnaWeb_Create (self ):
1531
1565
user = BaseTestLive .get_john (True )
1532
1566
0 commit comments