public void SimpleCaptureGivenAuthWithCard() { var capturegivenauth = new captureGivenAuth { id = "1", amount = 106, orderId = "12344", authInformation = new authInformation { authDate = new DateTime(2002, 10, 9), authCode = "543216", authAmount = 12345, }, orderSource = orderSourceType.ecommerce, card = new cardType { type = methodOfPaymentTypeEnum.VI, number = "4100000000000000", expDate = "1210", }, processingType = processingType.accountFunding, originalNetworkTransactionId = "abc123", originalTransactionAmount = 123456789 }; var response = _cnp.CaptureGivenAuth(capturegivenauth); Assert.AreEqual("Approved", response.message); }
public void TestCaptureGivenAuth() { captureGivenAuth capturegivenauth = new captureGivenAuth(); capturegivenauth.orderId = "12344"; capturegivenauth.amount = 106; authInformation authinfo = new authInformation(); authinfo.authDate = new DateTime(2002, 10, 9); authinfo.authCode = "543216"; authinfo.authAmount = 12345; capturegivenauth.authInformation = authinfo; capturegivenauth.orderSource = orderSourceType.ecommerce; cardType card = new cardType(); card.type = methodOfPaymentTypeEnum.VI; card.number = "4100000000000001"; card.expDate = "1210"; capturegivenauth.card = card; var mock = new Mock <Communications>(); mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*?<cnpOnlineRequest.*?<captureGivenAuth.*?<card>.*?<number>4100000000000001</number>.*?</card>.*?</captureGivenAuth>.*?", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >())) .Returns("<cnpOnlineResponse version='8.10' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><captureGivenAuthResponse><cnpTxnId>123</cnpTxnId></captureGivenAuthResponse></cnpOnlineResponse>"); Communications mockedCommunication = mock.Object; cnp.SetCommunication(mockedCommunication); captureGivenAuthResponse caputregivenauthresponse = cnp.CaptureGivenAuth(capturegivenauth); Assert.AreEqual(123, caputregivenauthresponse.cnpTxnId); }
public void TestSecondaryAmount() { captureGivenAuth capture = new captureGivenAuth(); capture.amount = 2; capture.secondaryAmount = 1; capture.orderSource = orderSourceType.ecommerce; capture.reportGroup = "Planets"; var mock = new Mock <Communications>(); mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<amount>2</amount>\r\n<secondaryAmount>1</secondaryAmount>\r\n<orderSource>ecommerce</orderSource>.*", RegexOptions.Singleline))) .Returns("<cnpOnlineResponse version='8.14' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><captureGivenAuthResponse><cnpTxnId>123</cnpTxnId></captureGivenAuthResponse></cnpOnlineResponse>"); Communications mockedCommunication = mock.Object; cnp.SetCommunication(mockedCommunication); cnp.CaptureGivenAuth(capture); }