public void Reporting_GetBatchStatisticsTest() { //check login / password string sError = CheckLoginPassword(); Assert.IsTrue(sError == "", sError); string responseString = "<?xml version=\"1.0\" encoding=\"utf-8\"?><getBatchStatisticsResponse xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\"><messages><resultCode>Ok</resultCode><message><code>I00001</code><text>Successful.</text></message></messages><batch><batchId>3260033</batchId><settlementTimeUTC>2014-03-14T15:20:05Z</settlementTimeUTC><settlementTimeLocal>2014-03-14T08:20:05</settlementTimeLocal><settlementState>settledSuccessfully</settlementState><paymentMethod>creditCard</paymentMethod><marketType>eCommerce</marketType><product>Card Not Present</product><statistics><statistic><accountType>Visa</accountType><chargeAmount>6.98</chargeAmount><chargeCount>2</chargeCount><refundAmount>0.00</refundAmount><refundCount>0</refundCount><voidCount>0</voidCount><declineCount>0</declineCount><errorCount>0</errorCount></statistic></statistics></batch></getBatchStatisticsResponse>"; LocalRequestObject.ResponseString = responseString; ReportingGateway target = new ReportingGateway(ApiLogin, TransactionKey); string batchId = "3260033"; var actual = target.GetBatchStatistics(batchId); Assert.AreEqual(1, actual.Count); Assert.AreEqual(batchId, actual[0].ID); Assert.AreEqual("creditCard", actual[0].PaymentMethod); Assert.AreEqual("settledSuccessfully", actual[0].State); Assert.AreEqual(1, actual[0].Charges.Count); Assert.AreEqual((decimal)6.98, actual[0].Charges[0].Amount); Assert.AreEqual("Visa", actual[0].Charges[0].CardType); Assert.AreEqual(actual[0].MarketType, "eCommerce"); Assert.AreEqual(actual[0].Product, "Card Not Present"); }
public void Reporting_GetBatchStatisticsTest_NoRecord() { //check login / password string sError = CheckLoginPassword(); Assert.IsTrue(sError == "", sError); string responseString = "<?xml version=\"1.0\" encoding=\"utf-8\"?><getBatchStatisticsResponse xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\"><messages><resultCode>Ok</resultCode><message><code>I00004</code><text>No records found.</text></message></messages></getBatchStatisticsResponse>"; LocalRequestObject.ResponseString = responseString; ReportingGateway target = new ReportingGateway(ApiLogin, TransactionKey); string batchId = "326003333"; var actual = target.GetBatchStatistics(batchId); Assert.AreEqual(0, actual.Count); }
public void Reporting_GetBatchStatisticsTest() { //check login / password var sError = CheckLoginPassword(); Assert.IsTrue(sError == "", sError); const string responseString = "<?xml version=\"1.0\" encoding=\"utf-8\"?><getBatchStatisticsResponse xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\"><messages><resultCode>Ok</resultCode><message><code>I00001</code><text>Successful.</text></message></messages><batch><batchId>3260033</batchId><settlementTimeUTC>2014-03-14T15:20:05Z</settlementTimeUTC><settlementTimeLocal>2014-03-14T08:20:05</settlementTimeLocal><settlementState>settledSuccessfully</settlementState><paymentMethod>creditCard</paymentMethod><marketType>eCommerce</marketType><product>Card Not Present</product><statistics><statistic><accountType>Visa</accountType><chargeAmount>6.98</chargeAmount><chargeCount>2</chargeCount><refundAmount>0.00</refundAmount><refundCount>0</refundCount><voidCount>0</voidCount><declineCount>0</declineCount><errorCount>0</errorCount></statistic></statistics></batch></getBatchStatisticsResponse>"; LocalRequestObject.ResponseString = responseString; var target = new ReportingGateway(ApiLogin, TransactionKey); // Get a settlement batch Id. var settlementBatches = target.GetSettledBatchList(); Assert.IsNotNull(settlementBatches); Assert.Greater(settlementBatches.Count, 0); // pre-condition // Get the batch statistics of the given batch id. var actual = target.GetBatchStatistics(settlementBatches[0].ID); Assert.AreEqual(1, actual.Count); Assert.AreEqual(settlementBatches[0].ID, actual[0].ID); Assert.IsNotNull(actual[0].State); Assert.IsNotNull(actual[0].PaymentMethod); Assert.IsNotNull(actual[0].MarketType); Assert.IsNotNull(actual[0].SettledOn); Assert.IsNotNull(actual[0].Product); Assert.IsNotNull(actual[0].Charges); Assert.AreEqual(1, actual[0].Charges.Count); Assert.IsNotNull(actual[0].Charges[0].Amount); Assert.IsNotNull(actual[0].Charges[0].CardType); Assert.IsNotNull(actual[0].Charges[0].ChargeBackAmount); Assert.IsNotNull(actual[0].Charges[0].ChargeBackCount); Assert.IsNotNull(actual[0].Charges[0].CorrectionNoticeCount); Assert.IsNotNull(actual[0].Charges[0].DeclineCount); Assert.IsNotNull(actual[0].Charges[0].RefundAmount); Assert.IsNotNull(actual[0].Charges[0].ReturnedItemsAmount); Assert.IsNotNull(actual[0].Charges[0].ReturnedItemsCount); Assert.IsNotNull(actual[0].Charges[0].VoidCount); }