public void TestSendPostRequest() { var xmlReq = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" + "<legalEntityAgreementCreateRequest xmlns=\"http://payfac.vantivcnp.com/api/merchant/onboard\">" + "<legalEntityAgreement>" + "<legalEntityAgreementType>MERCHANT_AGREEMENT</legalEntityAgreementType>" + "<agreementVersion>Version1</agreementVersion>" + "<userFullName>FullName</userFullName>" + "<userSystemName>systemUserName</userSystemName>" + "<userIPAddress>127.0.0.1</userIPAddress>" + "<manuallyEntered>true</manuallyEntered>" + "<acceptanceDateTime>" + DateTime.Now.ToString("yyyy-MM-ddThh:mm:sszzz") + "</acceptanceDateTime>" + "</legalEntityAgreement>" + "</legalEntityAgreementCreateRequest>"; string expectedResposne = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" + "<legalEntityAgreementCreateResponse xmlns=\"http://payfac.vantivcnp.com/api/merchant/onboard\" duplicate=\"true\">" + " <transactionId>3529958067</transactionId>" + "</legalEntityAgreementCreateResponse>"; var mock = new Mock <Communication>(); mock.Setup(Communication => Communication.Post("/legalentity/201000/agreement", xmlReq)).Returns(expectedResposne); Communication communicationMock = mock.Object; string result = PayFacUtils.SendPostRequest("/legalentity/201000/agreement", xmlReq, _communication, _configuration); legalEntityAgreementCreateResponse resultObj = PayFacUtils.DeserializeResponse <legalEntityAgreementCreateResponse>(result); Assert.NotNull(resultObj.transactionId); }
public void TestGetLegalEntityRetrievalRequestErrorResponse401() { legalEntityId = "201401"; request = new legalEntityAgreementCreateRequest { legalEntityAgreement = new legalEntityAgreement { legalEntityAgreementType = legalEntityAgreementType.MERCHANT_AGREEMENT, agreementVersion = "Version1", userFullName = "FullName", userSystemName = "systemUserName", userIPAddress = "127.0.0.1", manuallyEntered = true, acceptanceDateTime = DateTime.Now } }; try { response = request.PostLegalEntityAgreementCreateRequest(legalEntityId); Assert.Fail("PayfacWebException expected, None thrown"); } catch (PayFacWebException ex) { errorResponse errorResponse = ex.errorResponse; Assert.NotNull(errorResponse.transactionId); Assert.AreEqual("You are not authorized to access this resource. Please check your credentials.", errorResponse.errors[0]); } }
public void TestPostLegalEntityCreateRequestErrorResponse400() { legalEntityId = "201400"; request = new legalEntityAgreementCreateRequest { legalEntityAgreement = new legalEntityAgreement { legalEntityAgreementType = legalEntityAgreementType.MERCHANT_AGREEMENT, agreementVersion = "Version1", userFullName = "FullName", userSystemName = "systemUserName", userIPAddress = "127.0.0.1", manuallyEntered = true, acceptanceDateTime = DateTime.Now } }; try { response = request.PostLegalEntityAgreementCreateRequest(legalEntityId); Assert.Fail("PayfacWebException expected, None thrown"); } catch (PayFacWebException ex) { errorResponse errorResponse = ex.errorResponse; Assert.NotNull(errorResponse.transactionId); Assert.AreEqual("Could not find requested object.", errorResponse.errors[0]); } }
public void TestGetLegalEntityRetrievalRequestErrorResponse500() { legalEntityId = "201500"; request = new legalEntityAgreementCreateRequest { legalEntityAgreement = new legalEntityAgreement { legalEntityAgreementType = legalEntityAgreementType.MERCHANT_AGREEMENT, agreementVersion = "Version1", userFullName = "FullName", userSystemName = "systemUserName", userIPAddress = "127.0.0.1", manuallyEntered = true, acceptanceDateTime = DateTime.Now } }; try { response = request.PostLegalEntityAgreementCreateRequest(legalEntityId); Assert.Fail("PayfacWebException expected, None thrown"); } catch (PayFacWebException ex) { errorResponse errorResponse = ex.errorResponse; Assert.NotNull(errorResponse.transactionId); Assert.AreEqual("Internal Error. This error has already been escalated to Vantiv for resolution. Please contact support with questions.", errorResponse.errors[0]); } }
public void TestPostLegalEntityAgreementCreateRequest() { var xmlReq = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" + "<legalEntityAgreementCreateRequest xmlns=\"http://payfac.vantivcnp.com/api/merchant/onboard\">" + "<legalEntityAgreement>" + "<legalEntityAgreementType>MERCHANT_AGREEMENT</legalEntityAgreementType>" + "<agreementVersion>Version1</agreementVersion>" + "<userFullName>FullName</userFullName>" + "<userSystemName>systemUserName</userSystemName>" + "<userIPAddress>127.0.0.1</userIPAddress>" + "<manuallyEntered>true</manuallyEntered>" + "<acceptanceDateTime>" + DateTime.Now.ToString("yyyy-MM-ddThh:mm:sszzz") + "</acceptanceDateTime>" + "</legalEntityAgreement>" + "<sdkVersion>" + Versions.SDK_VERSION + "</sdkVersion>" + "<language>" + Versions.LANGUAGE + "</language>" + "</legalEntityAgreementCreateRequest>"; string expectedResposne = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" + "<legalEntityAgreementCreateResponse xmlns=\"http://payfac.vantivcnp.com/api/merchant/onboard\" duplicate=\"true\">" + " <transactionId>3529958067</transactionId>" + "</legalEntityAgreementCreateResponse>"; var mock = new Mock <Communication>(); mock.Setup(Communication => Communication.Post("/legalentity/201000/agreement", xmlReq)).Returns(expectedResposne); Communication communicationMock = mock.Object; request.Communication = communicationMock; response = request.PostLegalEntityAgreementCreateRequest("201000"); Assert.NotNull(response.transactionId); }
public void TestPostLegalEntityCreateRequestSimple() { legalEntityId = "201003"; request = new legalEntityAgreementCreateRequest { legalEntityAgreement = new legalEntityAgreement { legalEntityAgreementType = legalEntityAgreementType.MERCHANT_AGREEMENT, agreementVersion = "Version1", userFullName = "FullName", userSystemName = "systemUserName", userIPAddress = "127.0.0.1", manuallyEntered = true, acceptanceDateTime = DateTime.Now } }; response = request.PostLegalEntityAgreementCreateRequest(legalEntityId); Assert.NotNull(response.transactionId); }