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_Users_CreateBankAccount_CA(self):
john = self.getJohn()
account = BankAccount()
account.OwnerName = john.FirstName + ' ' + john.LastName
account.OwnerAddress = john.Address
account.Details = BankAccountDetailsCA()
account.Details.BankName = 'TestBankName'
account.Details.BranchCode = '12345'
account.Details.AccountNumber = '234234234234'
account.Details.InstitutionNumber = '123'
createAccount = self.sdk.users.CreateBankAccount(john.Id, account)
self.assertTrue(len(createAccount.Id) > 0)
self.assertEqual(createAccount.UserId, john.Id)
self.assertEqual(createAccount.Type, 'CA')
self.assertEqual(createAccount.Details.AccountNumber, '234234234234')
self.assertEqual(createAccount.Details.BankName, 'TestBankName')
self.assertEqual(createAccount.Details.BranchCode, '12345')
def test_Users_CreateBankAccount_US(self):
john = self.getJohn()
account = BankAccount()
account.OwnerName = john.FirstName + ' ' + john.LastName
account.OwnerAddress = john.Address
account.Details = BankAccountDetailsUS()
account.Details.AccountNumber = '234234234234'
account.Details.ABA = '234334789'
createAccount = self.sdk.users.CreateBankAccount(john.Id, account)
self.assertTrue(len(createAccount.Id) > 0)
self.assertEqual(createAccount.UserId, john.Id)
self.assertEqual(createAccount.Type, 'US')
self.assertEqual(createAccount.Details.AccountNumber, '234234234234')
self.assertEqual(createAccount.Details.ABA, '234334789')
def test_Users_CreateBankAccount_OTHER(self):
john = self.getJohn()
account = BankAccount()
account.OwnerName = john.FirstName + ' ' + john.LastName
account.OwnerAddress = john.Address
account.Details = BankAccountDetailsOTHER()
account.Details.Type = 'OTHER'
account.Details.Country = 'FR'
account.Details.AccountNumber = '234234234234'
account.Details.BIC = 'BINAADADXXX'
createAccount = self.sdk.users.CreateBankAccount(john.Id, account)
self.assertTrue(len(createAccount.Id) > 0)
self.assertEqual(createAccount.UserId, john.Id)
self.assertEqual(createAccount.Type, 'OTHER')
self.assertEqual(createAccount.Details.Type, 'OTHER')
self.assertEqual(createAccount.Details.Country, 'FR')
self.assertEqual(createAccount.Details.AccountNumber, '234234234234')
self.assertEqual(entity1.HeadquartersAddress.AddressLine1, entity2.HeadquartersAddress.AddressLine1)
self.assertEqual(entity1.HeadquartersAddress.AddressLine2, entity2.HeadquartersAddress.AddressLine2)
self.assertEqual(entity1.HeadquartersAddress.City, entity2.HeadquartersAddress.City)
self.assertEqual(entity1.HeadquartersAddress.Country, entity2.HeadquartersAddress.Country)
self.assertEqual(entity1.HeadquartersAddress.PostalCode, entity2.HeadquartersAddress.PostalCode)
self.assertEqual(entity1.HeadquartersAddress.Region, entity2.HeadquartersAddress.Region)
self.assertEqual(entity1.LegalRepresentativeFirstName, entity2.LegalRepresentativeFirstName)
self.assertEqual(entity1.LegalRepresentativeLastName, entity2.LegalRepresentativeLastName)
#TODO!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#self.assertEqual(entity1.LegalRepresentativeAddress, entity2.LegalRepresentativeAddress, "***** TEMPORARY API ISSUE: RETURNED OBJECT MISSES THIS PROP AFTER CREATION *****")
self.assertEqual(entity1.LegalRepresentativeEmail, entity2.LegalRepresentativeEmail)
self.assertEqual(entity1.LegalRepresentativeBirthday, entity2.LegalRepresentativeBirthday, "***** TEMPORARY API ISSUE: RETURNED OBJECT HAS THIS PROP CHANGED FROM TIMESTAMP INTO ISO STRING AFTER CREATION *****")
self.assertEqual(entity1.LegalRepresentativeNationality, entity2.LegalRepresentativeNationality)
self.assertEqual(entity1.LegalRepresentativeCountryOfResidence, entity2.LegalRepresentativeCountryOfResidence)
elif (isinstance(entity1, BankAccount)):
self.assertEqual(entity1.Tag, entity2.Tag)
self.assertEqual(entity1.UserId, entity2.UserId)
self.assertEqual(entity1.Type, entity2.Type)
self.assertEqual(entity1.OwnerName, entity2.OwnerName)
self.assertEqual(entity1.OwnerAddress.AddressLine1, entity2.OwnerAddress.AddressLine1)
self.assertEqual(entity1.OwnerAddress.AddressLine2, entity2.OwnerAddress.AddressLine2)
self.assertEqual(entity1.OwnerAddress.City, entity2.OwnerAddress.City)
self.assertEqual(entity1.OwnerAddress.Country, entity2.OwnerAddress.Country)
self.assertEqual(entity1.OwnerAddress.PostalCode, entity2.OwnerAddress.PostalCode)
self.assertEqual(entity1.OwnerAddress.Region, entity2.OwnerAddress.Region)
if (entity1.Type == 'IBAN'):
self.assertEqual(entity1.Details.IBAN, entity2.Details.IBAN)
self.assertEqual(entity1.Details.BIC, entity2.Details.BIC)
elif (entity1.Type == 'GB'):
self.assertEqual(entity1.Details.AccountNumber, entity2.Details.AccountNumber)
self.assertEqual(entity1.Details.SortCode, entity2.Details.SortCode)
def getJohnsAccount(self):
"""Creates TestBase._johnsAccount (bank account belonging to John) if not created yet"""
if self._johnsAccount == None:
john = self.getJohn()
account = BankAccount()
account.OwnerName = john.FirstName + ' ' + john.LastName
account.OwnerAddress = john.Address
account.UserId = john.Id
account.Type = 'IBAN'
account.Details = BankAccountDetailsIBAN()
account.Details.IBAN = 'FR7618829754160173622224154'
account.Details.BIC = 'CMBRFR2BCME'
self._johnsAccount = self.sdk.users.CreateBankAccount(john.Id, account)
self.assertEqualInputProps(self._johnsAccount, account, True)
return self._johnsAccount
def test_Users_UpdateBankAccount(self):
john = self.getJohn()
account = self.getJohnsAccount()
self.assertTrue(int(account.Id) > 0)
self.assertEqual(account.UserId, john.Id)
self.assertTrue(account.Active == True)
# update bank account
update = BankAccount()
update.Active = False
result = self.sdk.users.UpdateBankAccount(john.Id, update, account.Id)
self.assertIsNotNone(result)
self.assertTrue(account.Id == result.Id)
self.assertTrue(result.Active == False)
def test_Users_CreateBankAccount_GB(self):
john = self.getJohn()
account = BankAccount()
account.OwnerName = john.FirstName + ' ' + john.LastName
account.OwnerAddress = john.Address
account.Details = BankAccountDetailsGB()
account.Details.AccountNumber = '63956474'
account.Details.SortCode = '200000'
createAccount = self.sdk.users.CreateBankAccount(john.Id, account)
self.assertTrue(len(createAccount.Id) > 0)
self.assertEqual(createAccount.UserId, john.Id)
self.assertEqual(createAccount.Type, 'GB')
self.assertEqual(createAccount.Details.AccountNumber, '63956474')
self.assertEqual(createAccount.Details.SortCode, '200000')
def __init__(self, id = None):
self.UserId = None
# Type of bank account
self.Type = None
self.OwnerName = None
self.OwnerAddress = None
self.Active = None
self.Details = None
return super(BankAccount, self).__init__(id)
def _canReadSubRequestData (self, entity, propertyName):
"""Get array with request data.
param object Entity object to send as request data
return array
"""
if isinstance(entity, PayIn) and (propertyName == 'PaymentDetails' or propertyName == 'ExecutionDetails'):
return True
if isinstance(entity, PayOut) and propertyName == 'MeanOfPaymentDetails':
return True
if isinstance(entity, BankAccount) and propertyName == 'Details':
return True
return False