def create(self): # Instead of getting the NaturalUser, I can get Saver! like that I can query both Natural and Legal, when I have # the model utils manager installed !!! Now this makes sense why to have it and how to use it! # Also because the MIDs are unique for all MP Objects. Makes it simpler, but only easier to see in hindsight!! ba = BankAccount(owner_name=(self.saver.user.first_name + '' + self.saver.user.last_name), user_id=self.saver.mid, type=self.bank_account_type, owner_address=self._make_address(), IBAN=self.iban, BIC=self.bic) ba.save() self.bid = ba.Id # get other stuff from the API to add to the model? self.save()
def create(self, user, line1, city, region, pc, country, line2=''): self.mid = MangoUser.objects.get(user=user).mid address = _make_address(line1, line2, city, pc, country, region) self.address = address ba = BankAccount(OwnerAddress=address, OwnerName=(str(user.first_name + user.last_name)), IBAN=self.iban, BIC=self.bic, Type=self.bank_account_type) # check if I don't need a function in the user model for get_full_name ba.save() self.bid = ba.get_pk() self.creation_date = ba.creation_date self.active = True self.save()
def get_johns_account(recreate=False): if BaseTestLive._johns_account is None or recreate: account = BankAccount() account.owner_name = BaseTestLive._john.first_name + ' ' + BaseTestLive._john.last_name account.user = BaseTestLive._john account.type = 'IBAN' account.owner_address = BaseTestLive._john.address account.iban = 'FR7618829754160173622224154' account.bic = 'CMBRFR2BCME' BaseTestLive._johns_account = BankAccount(**account.save()) return BaseTestLive._johns_account
def get_johns_account(recreate=False): if BaseTestLive._johns_account is None or recreate: account = BankAccount() account.owner_name = BaseTestLive._john.first_name + ' ' + BaseTestLive._john.last_name account.user = BaseTestLive._john account.type = 'IBAN' account.owner_address = BaseTestLive._john.address account.iban = 'FR7630004000031234567890143' account.bic = 'BNPAFRPP' BaseTestLive._johns_account = BankAccount(**account.save()) return BaseTestLive._johns_account
with use_cassette('MangopayHarness'): cls = MangopayHarness cls.david_id = make_mangopay_account('David') cls.david_wallet_id = make_wallet(cls.david_id).Id cls.janet_id = make_mangopay_account('Janet') cls.janet_wallet_id = make_wallet(cls.janet_id).Id cr = create_card(cls.janet_id) cls.card_id = cr.CardId del cr cls.homer_id = make_mangopay_account('Homer') cls.homer_wallet_id = make_wallet(cls.homer_id).Id ba = BankAccount(user_id=cls.homer_id, type='IBAN') ba.OwnerName = 'Homer Jay' ba.OwnerAddress = { 'AddressLine1': 'Somewhere', 'City': 'The City of Light', 'PostalCode': '75001', 'Country': 'FR', } ba.IBAN = 'FR1420041010050500013M02606' ba.save() cls.bank_account = ba ba = BankAccount() ba.Type = 'IBAN' ba.IBAN = 'IR861234568790123456789012' cls.bank_account_outside_sepa = ba