Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_PayIns_Get_CardWeb(self):
payIn = self.getJohnsPayInCardWeb()
getPayIn = self.sdk.payIns.Get(payIn.Id)
self.assertEqual(payIn.Id, getPayIn.Id)
self.assertEqual(payIn.PaymentType, PayInPaymentType.CARD)
self.assertIsInstance(payIn.PaymentDetails, PayInPaymentDetailsCard)
self.assertEqual(payIn.ExecutionType, ExecutionType.WEB)
self.assertIsInstance(payIn.ExecutionDetails, PayInExecutionDetailsWeb)
self.assertEqualInputProps(payIn, getPayIn)
self.assertEqual(getPayIn.Status, 'CREATED')
self.assertIsNone(getPayIn.ExecutionDate)
self.assertIsNotNone(getPayIn.ExecutionDetails.RedirectURL)
self.assertIsNotNone(getPayIn.ExecutionDetails.ReturnURL)
def test_PayIns_Create_CardDirect(self):
johnWallet = self.getJohnsWallet()
beforeWallet = self.sdk.wallets.Get(johnWallet.Id)
payIn = self.getJohnsPayInCardDirect()
wallet = self.sdk.wallets.Get(johnWallet.Id)
user = self.getJohn()
self.assertTrue(len(payIn.Id) > 0)
self.assertEqual(wallet.Id, payIn.CreditedWalletId)
def getPayInPaymentDetailsCard(self):
"""return PayInPaymentDetailsCard"""
if self._payInPaymentDetailsCard == None:
self._payInPaymentDetailsCard = PayInPaymentDetailsCard()
self._payInPaymentDetailsCard.CardType = CardType.CB_VISA_MASTERCARD
return self._payInPaymentDetailsCard
elif (entity1.Type == 'OTHER'):
self.assertEqual(entity1.Details.Type, entity2.Details.Type)
self.assertEqual(entity1.Details.Country, entity2.Details.Country)
self.assertEqual(entity1.Details.BIC, entity2.Details.BIC)
self.assertEqual(entity1.Details.AccountNumber, entity2.Details.AccountNumber)
if (not asFreshlyCreated): self.assertEqual(entity1.UserId, entity2.UserId)
elif (isinstance(entity1, PayIn)):
self.assertEqual(entity1.Tag, entity2.Tag)
self.assertEqual(entity1.AuthorId, entity2.AuthorId)
self.assertEqual(entity1.CreditedUserId, entity2.CreditedUserId)
self.assertEqualInputProps(entity1.DebitedFunds, entity2.DebitedFunds)
self.assertEqualInputProps(entity1.CreditedFunds, entity2.CreditedFunds)
self.assertEqualInputProps(entity1.Fees, entity2.Fees)
elif (isinstance(entity1, PayInPaymentDetailsCard)):
self.assertEqual(entity1.CardType, entity2.CardType)
self.assertEqual(entity1.RedirectURL, entity2.RedirectURL)
self.assertEqual(entity1.ReturnURL, entity2.ReturnURL)
elif (isinstance(entity1, PayInExecutionDetailsWeb)):
self.assertEqual(entity1.TemplateURL, entity2.TemplateURL)
self.assertEqual(entity1.Culture, entity2.Culture)
self.assertEqual(entity1.SecureMode, entity2.SecureMode)
elif (isinstance(entity1, PayOut)):
self.assertEqual(entity1.Tag, entity2.Tag)
self.assertEqual(entity1.AuthorId, entity2.AuthorId)
self.assertEqual(entity1.CreditedUserId, entity2.CreditedUserId)
self.assertEqualInputProps(entity1.DebitedFunds, entity2.DebitedFunds)
self.assertEqualInputProps(entity1.CreditedFunds, entity2.CreditedFunds)
self.assertEqualInputProps(entity1.Fees, entity2.Fees)
cardRegistration = self.sdk.cardRegistrations.Create(cardRegistration)
cardRegistration.RegistrationData = self.getPaylineCorrectRegistartionData(cardRegistration)
cardRegistration = self.sdk.cardRegistrations.Update(cardRegistration)
card = self.sdk.cards.Get(cardRegistration.CardId)
# create pay-in CARD DIRECT
payIn = PayIn()
payIn.CreditedWalletId = wallet.Id
payIn.AuthorId = cardRegistration.UserId
payIn.DebitedFunds = Money()
payIn.DebitedFunds.Amount = amount
payIn.DebitedFunds.Currency = 'EUR'
payIn.Fees = Money()
payIn.Fees.Amount = 0
payIn.Fees.Currency = 'EUR'
# payment type as CARD
payIn.PaymentDetails = PayInPaymentDetailsCard()
payIn.PaymentDetails.CardType = card.CardType
# execution type as DIRECT
payIn.ExecutionDetails = PayInExecutionDetailsDirect()
payIn.ExecutionDetails.CardId = card.Id
payIn.ExecutionDetails.SecureModeReturnURL = 'http://test.com'
# create Pay-In
self.sdk.payIns.Create(payIn)
self._johnsWalletWithMoney = self.sdk.wallets.Get(wallet.Id)
return self._johnsWalletWithMoney
cardRegistration.RegistrationData = self.getPaylineCorrectRegistartionData(cardRegistration)
cardRegistration = self.sdk.cardRegistrations.Update(cardRegistration)
card = self.sdk.cards.Get(cardRegistration.CardId)
# create pay-in CARD DIRECT
payIn = PayIn()
payIn.CreditedWalletId = wallet.Id
payIn.AuthorId = wallet.Owners[0]
payIn.DebitedFunds = Money()
payIn.DebitedFunds.Amount = 10000
payIn.DebitedFunds.Currency = 'EUR'
payIn.Fees = Money()
payIn.Fees.Amount = 0
payIn.Fees.Currency = 'EUR'
# payment type as CARD
payIn.PaymentDetails = PayInPaymentDetailsCard()
payIn.PaymentDetails.CardType = card.CardType
# execution type as DIRECT
payIn.ExecutionDetails = PayInExecutionDetailsDirect()
payIn.ExecutionDetails.CardId = card.Id
payIn.ExecutionDetails.SecureModeReturnURL = 'http://test.com'
return self.sdk.payIns.Create(payIn)
def test_PayIns_Create_CardWeb(self):
payIn = self.getJohnsPayInCardWeb()
self.assertTrue(len(payIn.Id) > 0)
self.assertEqual(payIn.PaymentType, PayInPaymentType.CARD)
self.assertIsInstance(payIn.PaymentDetails, PayInPaymentDetailsCard)
self.assertEqual(payIn.ExecutionType, ExecutionType.WEB)
self.assertIsInstance(payIn.ExecutionDetails, PayInExecutionDetailsWeb)