How to use the mangopaysdk.entities.usernatural.UserNatural function in mangopaysdk

To help you get started, we’ve selected a few mangopaysdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Mangopay / mangopay2-python-sdk / tests / testbase.py View on Github external
def getJohn(self):
        """Creates TestBase._john (test natural user) if not created yet"""
        if (self._john == None):
            user = UserNatural()
            user.FirstName = "John"
            user.LastName = "Doe"
            user.Email = "john.doe@sample.org"
            user.Address = self.getNewAddress()
            user.Birthday = int(time.mktime((1975, 12, 21, 0,0,0, -1, -1, -1)))
            user.Nationality = "FR"
            user.CountryOfResidence = "FR"
            user.Occupation = "programmer"
            user.IncomeRange = 3
            self._john = self.sdk.users.Create(user)
            self.assertEqualInputProps(self._john, user, True)
        return self._john
github Mangopay / mangopay2-python-sdk / tests / testbase.py View on Github external
def assertEqualInputProps(self, entity1, entity2, asFreshlyCreated = False):
        if (isinstance(entity1, UserNatural)):
            self.assertEqual(entity1.Tag, entity2.Tag)
            self.assertEqual(entity1.PersonType, entity2.PersonType)
            self.assertEqual(entity1.FirstName, entity2.FirstName)
            self.assertEqual(entity1.LastName, entity2.LastName)
            self.assertEqual(entity1.Email, entity2.Email)
            self.assertEqual(entity1.Address.AddressLine1, entity2.Address.AddressLine1)
            self.assertEqual(entity1.Address.AddressLine2, entity2.Address.AddressLine2)
            self.assertEqual(entity1.Address.City, entity2.Address.City)
            self.assertEqual(entity1.Address.Country, entity2.Address.Country)
            self.assertEqual(entity1.Address.PostalCode, entity2.Address.PostalCode)
            self.assertEqual(entity1.Address.Region, entity2.Address.Region)
            self.assertEqual(entity1.Birthday, entity2.Birthday)
            self.assertEqual(entity1.Nationality, entity2.Nationality)
            self.assertEqual(entity1.CountryOfResidence, entity2.CountryOfResidence)
            self.assertEqual(entity1.Occupation, entity2.Occupation)
            self.assertEqual(entity1.IncomeRange, entity2.IncomeRange)
github Mangopay / mangopay2-python-sdk / mangopaysdk / entities / usernatural.py View on Github external
def __init__(self, id = None):
        super(UserNatural, self).__init__(id)
        self._setPersonType(PersonType.Natural)
        # Required
        self.FirstName = None
        # Required
        self.LastName = None
        self.Address = None
        # Required Date of birth: Unix timestamp
        self.Birthday = None
        # Required
        self.Nationality = None
        # Required
        self.CountryOfResidence = None
        self.Occupation = None
        # Int
        self.IncomeRange = None
        self.ProofOfIdentity = None
github Mangopay / mangopay2-python-sdk / mangopaysdk / tools / apiusers.py View on Github external
def CreateIdempotent(self, idempotencyKey, user):
        """Create new user.
        param string idempotencyKey Idempotency key for this request
        param UserLegal/UserNatural user (list of required fields in coresponding entity class)
        return UserLegal/UserNatural User object returned from API
        """
        if isinstance(user, UserNatural):
            methodKey = 'users_createnaturals'
        elif isinstance(user, UserLegal):
            methodKey = 'users_createlegals'
        else:
            raise Exception('Wrong entity class for user');

        response = self._createObjectIdempotent(idempotencyKey, methodKey, user)
        return self.GetUserResponse(response)
github Mangopay / mangopay2-python-sdk / mangopaysdk / tools / apiusers.py View on Github external
def Update(self, user):
        """Update user.
        param UserLegal/UserNatural
        return UserLegal/UserNatural User object returned from API
        """
        if isinstance(user, UserNatural):
            methodKey = 'users_savenaturals'
        elif isinstance(user, UserLegal):
            methodKey = 'users_savelegals'
        else:
            raise Exception('Wrong entity class for user')

        response = self._saveObject(methodKey, user)
        return self.GetUserResponse(response)