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_Create_DirectDebitWeb(self):
wallet = self.getJohnsWallet()
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()
def getJohnsPayInBankWireDirect(self):
wallet = self.getJohnsWallet()
payIn = PayIn()
payIn.CreditedWalletId = wallet.Id
payIn.AuthorId = wallet.Owners[0]
# payment type as CARD
payIn.PaymentDetails = PayInPaymentDetailsBankWire()
payIn.PaymentDetails.DeclaredDebitedFunds = Money()
payIn.PaymentDetails.DeclaredFees = Money()
payIn.PaymentDetails.DeclaredDebitedFunds.Currency = 'EUR'
payIn.PaymentDetails.DeclaredFees.Currency = 'EUR'
payIn.PaymentDetails.DeclaredDebitedFunds.Amount = 10000
payIn.PaymentDetails.DeclaredFees.Amount = 1000
# execution type as DIRECT
payIn.ExecutionDetails = PayInExecutionDetailsDirect()
payIn.ExecutionType = ExecutionType.DIRECT
return self.sdk.payIns.Create(payIn)
if self._johnsWalletWithMoney == None:
john = self.getJohn()
wallet = Wallet()
wallet.Owners = [john.Id]
wallet.Currency = 'EUR'
wallet.Description = 'WALLET IN EUR'
wallet = self.sdk.wallets.Create(wallet)
cardRegistration = CardRegistration()
cardRegistration.UserId = wallet.Owners[0]
cardRegistration.Currency = 'EUR'
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'
"""Creates Pay-In Card Direct object
return PayIn
"""
if wallet == None:
wallet = self.getJohnsWallet()
cardRegistration = CardRegistration()
cardRegistration.UserId = wallet.Owners[0]
cardRegistration.Currency = 'EUR'
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 = 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 getJohnsPayInCardWeb(self):
"""Creates Pay-In Card Web object"""
wallet = self.getJohnsWallet()
user = self.getJohn()
payIn = PayIn()
payIn.AuthorId = user.Id
payIn.CreditedUserId = user.Id
payIn.DebitedFunds = Money()
payIn.DebitedFunds.Currency = 'EUR'
payIn.DebitedFunds.Amount = 1000
payIn.Fees = Money()
payIn.Fees.Currency = 'EUR'
payIn.Fees.Amount = 5
payIn.CreditedWalletId = wallet.Id
payIn.PaymentDetails = self.getPayInPaymentDetailsCard()
payIn.ExecutionDetails = self.getPayInExecutionDetailsWeb()
return self.sdk.payIns.Create(payIn)
def test_PayIns_PreAuthorizedDirect(self):
cardPreAuthorization = self.getJohnsCardPreAuthorization()
wallet = self.getJohnsWalletWithMoney()
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 = 1000
payIn.DebitedFunds.Currency = 'EUR'
payIn.Fees = Money()
payIn.Fees.Amount = 0
payIn.Fees.Currency = 'EUR'
# payment type as CARD
payIn.PaymentDetails = PayInPaymentDetailsPreAuthorized()
payIn.PaymentDetails.PreauthorizationId = cardPreAuthorization.Id
# execution type as DIRECT
payIn.ExecutionDetails = PayInExecutionDetailsDirect()
payIn.ExecutionDetails.SecureModeReturnURL = 'http://test.com'
createPayIn = self.sdk.payIns.Create(payIn)
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')
def GetReadOnlyProperties(self):
properties = super(PayIn, self).GetReadOnlyProperties()
properties.append('PaymentType' )
properties.append('ExecutionType' )
return properties