public void ReportStoredPaymentMethodDetail() { StoredPaymentMethodSummary response = ReportingService.StoredPaymentMethodDetail(Token) .Execute(); Assert.IsNotNull(response); Assert.IsTrue(response is StoredPaymentMethodSummary); Assert.AreEqual(Token, response.Id); }
public void ReportFindStoredPaymentMethodsPaged_By_Reference() { StoredPaymentMethodSummary response = ReportingService.StoredPaymentMethodDetail(Token) .Execute(); Assert.IsNotNull(response?.Reference); PagedResult <StoredPaymentMethodSummary> result = ReportingService.FindStoredPaymentMethodsPaged(1, 25) .Where(SearchCriteria.ReferenceNumber, response.Reference) .Execute(); Assert.IsNotNull(result?.Results); Assert.IsTrue(result.Results is List <StoredPaymentMethodSummary>); Assert.IsTrue(result.Results.TrueForAll(r => r.Reference == response.Reference)); }
public void MapMapStoredPaymentMethodSummaryTest() { // Arrange string rawJson = "{\"id\":\"PMT_3502a05c-0a79-469b-bff9-994b665ce9d9\",\"time_created\":\"2021-04-23T18:46:57.000Z\",\"status\":\"ACTIVE\",\"merchant_id\":\"MER_c4c0df11039c48a9b63701adeaa296c3\",\"merchant_name\":\"Sandbox_merchant_2\",\"account_id\":\"TKA_eba30a1b5c4a468d90ceeef2ffff7f5e\",\"account_name\":\"Tokenization\",\"reference\":\"faed4ae3-1dd6-414a-bd7e-3a585715d9cc\",\"card\":{\"number_last4\":\"xxxxxxxxxxxx1111\",\"brand\":\"VISA\",\"expiry_month\":\"12\",\"expiry_year\":\"25\"},\"action\":{\"id\":\"ACT_wFGcHivudqleji9jA7S4MTapAHCTkp\",\"type\":\"PAYMENT_METHOD_SINGLE\",\"time_created\":\"2021-04-23T18:47:01.057Z\",\"result_code\":\"SUCCESS\",\"app_id\":\"P3LRVjtGRGxWQQJDE345mSkEh2KfdAyg\",\"app_name\":\"colleens_app\"}}"; JsonDoc doc = JsonDoc.Parse(rawJson); // Act StoredPaymentMethodSummary paymentMethod = GpApiMapping.MapStoredPaymentMethodSummary(doc); // Assert Assert.AreEqual(doc.GetValue <string>("id"), paymentMethod.Id); Assert.AreEqual(doc.GetValue <DateTime>("time_created"), paymentMethod.TimeCreated); Assert.AreEqual(doc.GetValue <string>("status"), paymentMethod.Status); Assert.AreEqual(doc.GetValue <string>("reference"), paymentMethod.Reference); Assert.AreEqual(doc.GetValue <string>("name"), paymentMethod.Name); Assert.AreEqual(doc.Get("card")?.GetValue <string>("number_last4"), paymentMethod.CardLast4); Assert.AreEqual(doc.Get("card")?.GetValue <string>("brand"), paymentMethod.CardType); Assert.AreEqual(doc.Get("card")?.GetValue <string>("expiry_month"), paymentMethod.CardExpMonth); Assert.AreEqual(doc.Get("card")?.GetValue <string>("expiry_year"), paymentMethod.CardExpYear); }