def test1and8and16(self): legalEntityType = "INDIVIDUAL_SOLE_PROPRIETORSHIP" taxId = random.randint(100000000, 999999999) streetAddress1 = "900 Chelmsford St" legalEntityPostRequest = self.legalEntityPostRequest1 + legalEntityType + self.legalEntityPostRequest2 + str( taxId ) + self.legalEntityPostRequest3 + streetAddress1 + self.legalEntityPostRequest4 expected_url_suffix = "/legalentity" response = communication.http_post_request(expected_url_suffix, legalEntityPostRequest, self.conf) legalEntityIdFromTest1 = response["legalEntityId"] pspMerchantId = random.randint(100, 999) submerchant_post_request = self.submerchant_post_request1 + str( pspMerchantId) + self.submerchant_post_request2 expected_url_suffix2 = expected_url_suffix + "/" + legalEntityIdFromTest1 + "/submerchant" response2 = communication.http_post_request(expected_url_suffix2, submerchant_post_request, self.conf) subMerchantId = response2["subMerchantId"] expected_url_suffix3 = expected_url_suffix2 + "/0" self.assertRaises(utils.PayfacWebError, communication.http_get_retrieval_request, expected_url_suffix3, self.conf)
def test1and8and11(self): legalEntityType = "INDIVIDUAL_SOLE_PROPRIETORSHIP" taxId = random.randint(100000000, 999999999) streetAddress1 = "900 Chelmsford St" legalEntityPostRequest = self.legalEntityPostRequest1 + legalEntityType + self.legalEntityPostRequest2 + str( taxId ) + self.legalEntityPostRequest3 + streetAddress1 + self.legalEntityPostRequest4 expected_url_suffix = "/legalentity" response = communication.http_post_request(expected_url_suffix, legalEntityPostRequest, self.conf) legalEntityIdFromTest1 = response["legalEntityId"] pspMerchantId = random.randint(100, 999) submerchant_post_request = self.submerchant_post_request1 + str( pspMerchantId) + self.submerchant_post_request2 expected_url_suffix2 = expected_url_suffix + "/" + legalEntityIdFromTest1 + "/submerchant" response2 = communication.http_post_request(expected_url_suffix2, submerchant_post_request, self.conf) merchantIdFromTest8 = response2["subMerchantId"] pspMerchantId = random.randint(100, 999) submerchant_put_request = self.submerchant_put_request1 + str( pspMerchantId) + self.submerchant_put_request2 expected_url_suffix3 = "/legalentity/" + legalEntityIdFromTest1 + "/submerchant/" + merchantIdFromTest8 response3 = communication.http_put_request(expected_url_suffix3, submerchant_put_request, self.conf)
def test2(self): legalEntityType = "INDIVIDUAL_SOLE_PROPRIETORSHIP" taxId = random.randint(100000000, 999999999) streetAddress1 = "912 Chelmsford St" legalEntityPostRequest = self.legalEntityPostRequest1 + legalEntityType + self.legalEntityPostRequest2 + str( taxId ) + self.legalEntityPostRequest3 + streetAddress1 + self.legalEntityPostRequest4 expected_url_suffix = "/legalentity" response = communication.http_post_request(expected_url_suffix, legalEntityPostRequest, self.conf) self.assertEquals("20", response["responseCode"])
def post_by_legalEntityId(legalEntityId,legalEntityAgreementCreateRequest): legalEntityAgreementCreateRequest.set_sdkVersion(SdkVersion.RELEASE) legalEntityAgreementCreateRequest.set_language(SdkVersion.LANGUAGE) stringIO = StringIO() legalEntityAgreementCreateRequest.export(stringIO, 0, pretty_print=False) request = stringIO.getvalue() request = request.replace("tns:", "") request = request.replace(":tns", "") if my_schema.is_valid(request): url_suffix = (SERVICE_ROUTE1 + legalEntityId + SERVICE_ROUTE2).encode('utf-8') return communication.http_post_request(url_suffix, request.encode('utf-8')) else: raise utils.PayfacSchemaError("Input is not compatible with schema")
def test3(self): legalEntityType = "LIMITED_LIABILITY_COMPANY" taxId = random.randint(100000000, 999999999) streetAddress1 = "914 Chelmsford St" legalEntityPostRequest = self.legalEntityPostRequest1 + legalEntityType + self.legalEntityPostRequest2 + str( taxId ) + self.legalEntityPostRequest3 + streetAddress1 + self.legalEntityPostRequest4 expected_url_suffix = "/legalentity" response = communication.http_post_request(expected_url_suffix, legalEntityPostRequest, self.conf) self.assertEquals("10", response["responseCode"]) self.assertEquals("Approved", response["responseDescription"])
def test2and2a(self): legalEntityType = "INDIVIDUAL_SOLE_PROPRIETORSHIP" taxId = random.randint(100000000, 999999999) streetAddress1 = "900 Chelmsford St" legalEntityPostRequest = self.legalEntityPostRequest1 + legalEntityType + self.legalEntityPostRequest2 + str( taxId ) + self.legalEntityPostRequest3 + streetAddress1 + self.legalEntityPostRequest4 expected_url_suffix = "/legalentity" response = communication.http_post_request(expected_url_suffix, legalEntityPostRequest, self.conf) legalEntityIdFromTest2 = response["legalEntityId"] expected_url_suffix2 = expected_url_suffix + "/" + legalEntityIdFromTest2 response2 = communication.http_get_retrieval_request( expected_url_suffix2, self.conf)
def test1and4(self): legalEntityType = "INDIVIDUAL_SOLE_PROPRIETORSHIP" taxId = random.randint(100000000, 999999999) streetAddress1 = "900 Chelmsford St" legalEntityPostRequest = self.legalEntityPostRequest1 + legalEntityType + self.legalEntityPostRequest2 + str( taxId ) + self.legalEntityPostRequest3 + streetAddress1 + self.legalEntityPostRequest4 expected_url_suffix = "/legalentity" response = communication.http_post_request(expected_url_suffix, legalEntityPostRequest, self.conf) legalEntityIdFromTest1 = response["legalEntityId"] expected_url_suffix2 = expected_url_suffix + "/" + legalEntityIdFromTest1 taxId = random.randint(100000000, 999999999) legalEntityPutRequest = self.legalEntityPutRequest1 + str( taxId) + self.legalEntityPutRequest2 response2 = communication.http_put_request(expected_url_suffix2, legalEntityPutRequest, self.conf) self.assertEquals("10", response2["responseCode"]) self.assertEquals("Approved", response2["responseDescription"])
def test_http_post_request(self): agreementPostRequest = '<legalEntityAgreementCreateRequest xmlns="http://payfac.vantivcnp.com/api/merchant/onboard"><legalEntityAgreement><legalEntityAgreementType>MERCHANT_AGREEMENT</legalEntityAgreementType><agreementVersion>agreementVersion1</agreementVersion><userFullName>userFullName</userFullName><userSystemName>systemUserName</userSystemName><userIPAddress>196.198.100.100</userIPAddress><manuallyEntered>false</manuallyEntered><acceptanceDateTime>2017-02-11T12:00:00-06:00</acceptanceDateTime></legalEntityAgreement></legalEntityAgreementCreateRequest>' response = communication.http_post_request( "/legalentity/21003/agreement".encode('utf-8'), agreementPostRequest) self.assertIsNotNone(response["transactionId"])