How to use the mangopaysdk.entities.userlegal.UserLegal 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 getMatrix(self):
        """Creates TestBase._matrix (test legal user) if not created yet"""
        if (self._matrix == None):
            john = self.getJohn()
            user = UserLegal()
            user.Name = "MartixSampleOrg"
            user.Email = "john.doe@sample.org"
            user.LegalPersonType = "BUSINESS"
            user.HeadquartersAddress = self.getNewAddress()
            user.LegalRepresentativeFirstName = john.FirstName
            user.LegalRepresentativeLastName = john.LastName
            user.LegalRepresentativeAddress = john.Address
            user.LegalRepresentativeEmail = john.Email
            user.LegalRepresentativeBirthday = john.Birthday
            user.LegalRepresentativeNationality = john.Nationality
            user.LegalRepresentativeCountryOfResidence = john.CountryOfResidence
            self._matrix = self.sdk.users.Create(user)
            self.assertEqualInputProps(self._matrix, user, True)
        return self._matrix
github Mangopay / mangopay2-python-sdk / tests / testapiusers.py View on Github external
def test_Users_CreateLegal_PassesIfRequiredPropsProvided(self):
        user = UserLegal()
        user.HeadquartersAddress = Address()
        user.HeadquartersAddress.AddressLine1 = "AddressLine1"
        user.HeadquartersAddress.AddressLine2 = "AddressLine2"
        user.HeadquartersAddress.City = "City"
        user.HeadquartersAddress.Country = "FR"
        user.HeadquartersAddress.PostalCode = "11222"
        user.HeadquartersAddress.Region = "Region"
        user.Name = "SomeOtherSampleOrg"
        user.LegalPersonType = "BUSINESS"
        user.Email = "john.doe@sample.org"
        user.LegalPersonType = "BUSINESS"
        user.LegalRepresentativeFirstName = 'Piter'
        user.LegalRepresentativeLastName = 'Doe'
        user.LegalRepresentativeBirthday = int(time.mktime((1979, 11, 21, 0,0,0, -1, -1, -1)))
        user.LegalRepresentativeNationality = 'FR'
        user.LegalRepresentativeCountryOfResidence = 'FR'
github Mangopay / mangopay2-python-sdk / tests / testbase.py View on Github external
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)

        elif (isinstance(entity1, UserLegal)):
            self.assertEqual(entity1.Tag, entity2.Tag)
            self.assertEqual(entity1.PersonType, entity2.PersonType)
            self.assertEqual(entity1.Name, entity2.Name)
            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)
github Mangopay / mangopay2-python-sdk / tests / testapiusers.py View on Github external
def test_Users_CreateLegal_FailsIfRequiredPropsNotProvided(self):
        user = UserLegal()
        with self.assertRaises(ResponseException) as cm:
            self.sdk.users.Create(user)
        self.assertEqual(400, cm.exception.Code)
        self.assertTrue('One or several required parameters are missing or incorrect' in cm.exception.Message)
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)
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 / entities / userlegal.py View on Github external
def GetReadOnlyProperties(self):
        properties = super(UserLegal, self).GetReadOnlyProperties()
        properties.append('Statute' )        
        properties.append('ProofOfRegistration' )        
        properties.append('ShareholderDeclaration' )
        properties.append('LegalRepresentativeProofOfIdentity' )
        return properties