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 = '18329068'
     account.Details.SortCode = '306541'
     
     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, '18329068')
     self.assertEqual(createAccount.Details.SortCode, '306541')
    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_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_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')
Beispiel #5
0
    def create(self):
        client = get_mangopay_api_client()
        mangopay_bank_account = BankAccount()
        mangopay_bank_account.UserId = self.mangopay_user.mangopay_id

        mangopay_bank_account.OwnerName = \
            self.mangopay_user.user.get_full_name()

        mangopay_bank_account.OwnerAddress = unicode(self.address)

        if self.account_type == BA_BIC_IBAN:
            # BIC / IBAN type requires setting IBAN and BIC codes only
            mangopay_bank_account.Details = BankAccountDetailsIBAN()
            mangopay_bank_account.Details.Type = "IBAN"
            mangopay_bank_account.Details.IBAN = self.iban

        elif self.account_type == BA_US:
            mangopay_bank_account.Details = BankAccountDetailsUS()
            mangopay_bank_account.Details.Type = "US"
            mangopay_bank_account.Details.ABA = self.aba
            mangopay_bank_account.Details.DepositAccountType = \
                self.deposit_account_type
            mangopay_bank_account.Details.AccountNumber = self.account_number

        elif self.account_type == BA_OTHER:
            # OTHER type requires setting Details object with Account number
            # country and BIC code.
            mangopay_bank_account.Details = BankAccountDetailsOTHER()
            mangopay_bank_account.Details.Type = "OTHER"
            mangopay_bank_account.Details.AccountNumber = self.account_number

        else:
            if self.account_type in BA_NOT_IMPLEMENTED:
                raise NotImplementedError(
                    "Bank Account Type ({0}) not implemeneted.".format(
                        self.account_type))
            else:
                raise Exception("Bank Account Type ({0}) is not valid.".format(
                    self.account_type))

        # Shared Details for IBAN and Other
        mangopay_bank_account.Details.BIC = self.bic

        if self.country:
            mangopay_bank_account.Details.Country = self.country.code
        else:
            if self.account_type != BA_BIC_IBAN:
                raise Exception("Country is required for Bank Accounts of "
                                "types other than BIC/IBAN")

        created_bank_account = client.users.CreateBankAccount(
            str(self.mangopay_user.mangopay_id), mangopay_bank_account)

        self.mangopay_id = created_bank_account.Id

        self.save()
Beispiel #6
0
    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)
Beispiel #7
0
    def create(self):
        client = get_mangopay_api_client()
        mangopay_bank_account = BankAccount()
        mangopay_bank_account.UserId = self.mangopay_user.mangopay_id

        mangopay_bank_account.OwnerName = \
            self.mangopay_user.user.get_full_name()

        mangopay_bank_account.OwnerAddress = unicode(self.address)

        if self.account_type == BA_BIC_IBAN:
            # BIC / IBAN type requires setting IBAN and BIC codes only
            mangopay_bank_account.Details = BankAccountDetailsIBAN()
            mangopay_bank_account.Details.Type = "IBAN"
            mangopay_bank_account.Details.IBAN = self.iban

        elif self.account_type == BA_US:
            mangopay_bank_account.Details = BankAccountDetailsUS()
            mangopay_bank_account.Details.Type = "US"
            mangopay_bank_account.Details.ABA = self.aba
            mangopay_bank_account.Details.DepositAccountType = \
                self.deposit_account_type
            mangopay_bank_account.Details.AccountNumber = self.account_number

        elif self.account_type == BA_OTHER:
            # OTHER type requires setting Details object with Account number
            # country and BIC code.
            mangopay_bank_account.Details = BankAccountDetailsOTHER()
            mangopay_bank_account.Details.Type = "OTHER"
            mangopay_bank_account.Details.AccountNumber = self.account_number

        else:
            if self.account_type in BA_NOT_IMPLEMENTED:
                raise NotImplementedError(
                    "Bank Account Type ({0}) not implemeneted.".format(
                        self.account_type
                    ))
            else:
                raise Exception(
                    "Bank Account Type ({0}) is not valid.".format(
                        self.account_type
                    ))

        # Shared Details for IBAN and Other
        mangopay_bank_account.Details.BIC = self.bic

        if self.country:
            mangopay_bank_account.Details.Country = self.country.code
        else:
            if self.account_type != BA_BIC_IBAN:
                raise Exception("Country is required for Bank Accounts of "
                                "types other than BIC/IBAN")

        created_bank_account = client.users.CreateBankAccount(
            str(self.mangopay_user.mangopay_id),
            mangopay_bank_account)

        self.mangopay_id = created_bank_account.Id

        self.save()
 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(createAccount.Details.BIC, 'BINAADADXXX')
 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')
     self.assertEqual(createAccount.Details.InstitutionNumber, '123')
    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(createAccount.Details.BIC, 'BINAADADXXX')
    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')
        self.assertEqual(createAccount.Details.InstitutionNumber, '123')
Beispiel #12
0
 def create(self):
     client = get_mangopay_api_client()
     mangopay_bank_account = BankAccount()
     mangopay_bank_account.UserId = self.mangopay_user.mangopay_id
     mangopay_bank_account.OwnerName = \
         self.mangopay_user.user.get_full_name()
     mangopay_bank_account.OwnerAddress = self.address
     mangopay_bank_account.IBAN = self.iban
     mangopay_bank_account.BIC = self.bic
     created_bank_account = client.users.CreateBankAccount(
         str(self.mangopay_user.mangopay_id), mangopay_bank_account)
     self.mangopay_id = created_bank_account.Id
     self.save()
Beispiel #13
0
 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.Type = 'IBAN'
         account.OwnerName = john.FirstName + ' ' +  john.LastName
         account.OwnerAddress = john.Address
         account.IBAN = 'FR7617906000320008335232973'
         account.BIC = 'BINAADADXXX'
         self._johnsAccount = self.sdk.users.CreateBankAccount(john.Id, account)
         self.assertEqualInputProps(self._johnsAccount, account, True)
     return self._johnsAccount
Beispiel #14
0
 def Create(self, pay_in):
     if isinstance(pay_in, PayIn) and not pay_in.Id:
         pay_in.Id = self.pay_in_id
         pay_in.ExecutionDate = 12312312
         pay_in.PaymentDetails = PayInPaymentDetailsBankWire()
         pay_in.PaymentDetails.WireReference = '4a57980154'
         pay_in.PaymentDetails.BankAccount = BankAccount()
         pay_in.PaymentDetails.BankAccount.IBAN = "FR7618829754160173622224251"
         pay_in.PaymentDetails.BankAccount.BIC = "CMBRFR2BCME"
         pay_in.PaymentDetails.BankAccount.Details = BankAccountDetailsIBAN(
         )
         pay_in.PaymentDetails.BankAccount.Details.bic = "123"
         pay_in.PaymentDetails.BankAccount.Details.iban = "abc"
         return pay_in
     else:
         raise TypeError("PayIn must be a PayIn entity")
 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
Beispiel #16
0
 def create(self):
     client = get_mangopay_api_client()
     mangopay_bank_account = BankAccount()
     mangopay_bank_account.UserId = self.mangopay_user.mangopay_id
     mangopay_bank_account.OwnerName = \
         self.mangopay_user.user.get_full_name()
     mangopay_bank_account.OwnerAddress = self.address
     mangopay_bank_account.IBAN = self.iban
     mangopay_bank_account.BIC = self.bic
     created_bank_account = client.users.CreateBankAccount(
         str(self.mangopay_user.mangopay_id), mangopay_bank_account)
     self.mangopay_id = created_bank_account.Id
     self.save()
Beispiel #17
0
 def create(self):
     client = get_mangopay_api_client()
     mangopay_bank_account = BankAccount()
     mangopay_bank_account.UserId = self.mangopay_user.mangopay_id
     mangopay_bank_account.OwnerName = \
         self.mangopay_user.user.get_full_name()
     mangopay_bank_account.OwnerAddress = self.address
     mangopay_bank_account.IBAN = self.iban
     mangopay_bank_account.BIC = self.bic
     if not mangopay_bank_account.IBAN:
         mangopay_bank_account.Type = 'OTHER'
         bank_details = BankAccountDetailsOTHER()
         bank_details.AccountNumber = self.account_number
         bank_details.Country = self.country
     else:
         bank_details = BankAccountDetailsIBAN()
     mangopay_bank_account.Details = bank_details
     created_bank_account = client.users.CreateBankAccount(
         str(self.mangopay_user.mangopay_id), mangopay_bank_account)
     self.mangopay_id = created_bank_account.Id
     self.save()
 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
Beispiel #19
0
    cr = mangoapi.cardRegistrations.Create(cr)
    data = dict(
        accessKeyRef=cr.AccessKey,
        cardNumber='3569990000000132',
        cardExpirationDate='1234',
        cardCvx='123',
        data=cr.PreregistrationData,
    )
    cr.RegistrationData = requests.post(cr.CardRegistrationURL, data).text
    cr = mangoapi.cardRegistrations.Update(cr)
    cls.card_id = cr.CardId
    del cr, data

    cls.homer_id = make_mangopay_account('Homer')
    cls.homer_wallet_id = make_wallet(cls.homer_id).Id
    ba = BankAccount()
    ba.OwnerName = 'Homer Jay'
    addr = ba.OwnerAddress = Address()
    addr.AddressLine1 = 'Somewhere'
    addr.City = 'The City of Light'
    addr.PostalCode = '75001'
    addr.Country = 'FR'
    ba.Details = BankAccountDetailsIBAN()
    ba.Details.IBAN = 'FR1420041010050500013M02606'
    cls.bank_account = mangoapi.users.CreateBankAccount(cls.homer_id, ba)

    ba = BankAccount()
    ba.Type = 'IBAN'
    ba.Details = BankAccountDetailsIBAN()
    ba.Details.IBAN = 'IR861234568790123456789012'
    cls.bank_account_outside_sepa = ba
Beispiel #20
0
    cr = mangoapi.cardRegistrations.Create(cr)
    data = dict(
        accessKeyRef=cr.AccessKey,
        cardNumber="3569990000000132",
        cardExpirationDate="1234",
        cardCvx="123",
        data=cr.PreregistrationData,
    )
    cr.RegistrationData = requests.post(cr.CardRegistrationURL, data).text
    cr = mangoapi.cardRegistrations.Update(cr)
    cls.card_id = cr.CardId
    del cr, data

    cls.homer_id = make_mangopay_account("Homer")
    cls.homer_wallet_id = make_wallet(cls.homer_id).Id
    ba = BankAccount()
    ba.OwnerName = "Homer Jay"
    addr = ba.OwnerAddress = Address()
    addr.AddressLine1 = "Somewhere"
    addr.City = "The City of Light"
    addr.PostalCode = "75001"
    addr.Country = "FR"
    ba.Details = BankAccountDetailsIBAN()
    ba.Details.IBAN = "FR1420041010050500013M02606"
    cls.bank_account = mangoapi.users.CreateBankAccount(cls.homer_id, ba)

    ba = BankAccount()
    ba.Type = "IBAN"
    ba.Details = BankAccountDetailsIBAN()
    ba.Details.IBAN = "IR861234568790123456789012"
    cls.bank_account_outside_sepa = ba
Beispiel #21
0
    cr = mangoapi.cardRegistrations.Create(cr)
    data = dict(
        accessKeyRef=cr.AccessKey,
        cardNumber='3569990000000132',
        cardExpirationDate='1234',
        cardCvx='123',
        data=cr.PreregistrationData,
    )
    cr.RegistrationData = requests.post(cr.CardRegistrationURL, data).text
    cr = mangoapi.cardRegistrations.Update(cr)
    cls.card_id = cr.CardId
    del cr, data

    cls.homer_id = make_mangopay_account('Homer')
    cls.homer_wallet_id = make_wallet(cls.homer_id).Id
    ba = BankAccount()
    ba.OwnerName = 'Homer Jay'
    addr = ba.OwnerAddress = Address()
    addr.AddressLine1 = 'Somewhere'
    addr.City = 'The City of Light'
    addr.PostalCode = '75001'
    addr.Country = 'FR'
    ba.Details = BankAccountDetailsIBAN()
    ba.Details.IBAN = 'FR1420041010050500013M02606'
    cls.bank_account = mangoapi.users.CreateBankAccount(cls.homer_id, ba)

    ba = BankAccount()
    ba.Type = 'IBAN'
    ba.Details = BankAccountDetailsIBAN()
    ba.Details.IBAN = 'IR861234568790123456789012'
    cls.bank_account_outside_sepa = ba