Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
user = self.getJohn()
# create pay-in PRE-AUTHORIZED DIRECT
payIn = PayIn()
payIn.CreditedWalletId = wallet.Id
payIn.AuthorId = user.Id
payIn.DebitedFunds = Money()
payIn.DebitedFunds.Amount = 10000
payIn.DebitedFunds.Currency = 'EUR'
payIn.Fees = Money()
payIn.Fees.Amount = 100
payIn.Fees.Currency = 'EUR'
# payment type as CARD
payIn.PaymentDetails = PayInPaymentDetailsDirectDebit()
payIn.PaymentDetails.DirectDebitType = 'GIROPAY'
payIn.ExecutionDetails = PayInExecutionDetailsWeb()
payIn.ExecutionDetails.ReturnURL = 'http://www.mysite.com/returnURL/'
payIn.ExecutionDetails.Culture = 'FR'
payIn.ExecutionDetails.TemplateURLOptions = PayInTemplateURLOptions()
payIn.ExecutionDetails.TemplateURLOptions.PAYLINE = 'https://www.maysite.com/payline_template/'
createPayIn = self.sdk.payIns.Create(payIn)
self.assertTrue(int(createPayIn.Id) > 0)
self.assertEqual(wallet.Id, createPayIn.CreditedWalletId)
self.assertEqual('DIRECT_DEBIT', createPayIn.PaymentType)
self.assertIsInstance(createPayIn.PaymentDetails, PayInPaymentDetailsDirectDebit)
self.assertEqual(createPayIn.PaymentDetails.DirectDebitType, 'GIROPAY')
self.assertEqual('WEB', createPayIn.ExecutionType)
self.assertIsInstance(createPayIn.ExecutionDetails, PayInExecutionDetailsWeb)
self.assertEqual('FR', createPayIn.ExecutionDetails.Culture)
self.assertEqual(user.Id, createPayIn.AuthorId)
def getPayInExecutionDetailsWeb(self):
"""return PayInExecutionDetailsWeb"""
if self._payInExecutionDetailsWeb == None:
self._payInExecutionDetailsWeb = PayInExecutionDetailsWeb()
self._payInExecutionDetailsWeb.ReturnURL = 'https://test.com'
self._payInExecutionDetailsWeb.TemplateURL = 'https://TemplateURL.com'
self._payInExecutionDetailsWeb.SecureMode = 'DEFAULT'
self._payInExecutionDetailsWeb.Culture = 'fr'
return self._payInExecutionDetailsWeb
def test_PayIns_Create_PayPal_Web(self):
wallet = self.getJohnsWallet()
user = self.getJohn()
payInPost = PayIn()
payInPost.AuthorId = user.Id
payInPost.DebitedFunds = Money()
payInPost.DebitedFunds.Amount = 1000
payInPost.DebitedFunds.Currency = 'EUR'
payInPost.Fees = Money()
payInPost.Fees.Amount = 0
payInPost.Fees.Currency = 'EUR'
payInPost.CreditedWalletId = wallet.Id
payInPost.PaymentDetails = PayInPaymentDetailsPayPal()
payInPost.ExecutionDetails = PayInExecutionDetailsWeb()
payInPost.ExecutionDetails.ReturnURL = 'http://test.test'
payIn = self.sdk.payIns.Create(payInPost)
self.assertIsNotNone(payIn)
self.assertTrue(payIn.PaymentType == 'PAYPAL')
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)
self.assertEqualInputProps(entity1.MeanOfPayment, entity2.MeanOfPayment)
elif (isinstance(entity1, Transfer)):
self.assertEqual(entity1.Tag, entity2.Tag)
self.assertEqual(entity1.AuthorId, entity2.AuthorId)
payIn.PaymentDetails.DirectDebitType = 'GIROPAY'
payIn.ExecutionDetails = PayInExecutionDetailsWeb()
payIn.ExecutionDetails.ReturnURL = 'http://www.mysite.com/returnURL/'
payIn.ExecutionDetails.Culture = 'FR'
payIn.ExecutionDetails.TemplateURLOptions = PayInTemplateURLOptions()
payIn.ExecutionDetails.TemplateURLOptions.PAYLINE = 'https://www.maysite.com/payline_template/'
createPayIn = self.sdk.payIns.Create(payIn)
self.assertTrue(int(createPayIn.Id) > 0)
self.assertEqual(wallet.Id, createPayIn.CreditedWalletId)
self.assertEqual('DIRECT_DEBIT', createPayIn.PaymentType)
self.assertIsInstance(createPayIn.PaymentDetails, PayInPaymentDetailsDirectDebit)
self.assertEqual(createPayIn.PaymentDetails.DirectDebitType, 'GIROPAY')
self.assertEqual('WEB', createPayIn.ExecutionType)
self.assertIsInstance(createPayIn.ExecutionDetails, PayInExecutionDetailsWeb)
self.assertEqual('FR', createPayIn.ExecutionDetails.Culture)
self.assertEqual(user.Id, createPayIn.AuthorId)
self.assertEqual('CREATED', createPayIn.Status)
self.assertEqual('PAYIN', createPayIn.Type)
self.assertIsInstance(createPayIn.DebitedFunds, Money)
self.assertEqual(10000, createPayIn.DebitedFunds.Amount)
self.assertEqual('EUR', createPayIn.DebitedFunds.Currency)
self.assertIsInstance(createPayIn.CreditedFunds, Money)
self.assertEqual(9900, createPayIn.CreditedFunds.Amount)
self.assertEqual('EUR', createPayIn.CreditedFunds.Currency)
self.assertIsInstance(createPayIn.Fees, Money)
self.assertEqual(100, createPayIn.Fees.Amount)
self.assertEqual('EUR', createPayIn.Fees.Currency)
self.assertIsNotNone(createPayIn.ExecutionDetails.ReturnURL)
self.assertIsNotNone(createPayIn.ExecutionDetails.RedirectURL)
self.assertIsNotNone(createPayIn.ExecutionDetails.TemplateURL)
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)
def GetReadOnlyProperties(self):
properties = super(PayInExecutionDetailsWeb, self).GetReadOnlyProperties()
properties.append('RedirectURL' )
return properties