From f68ef70b1c9f28e8edfc75861ca8f914eae87094 Mon Sep 17 00:00:00 2001 From: Harry Peirse Date: Wed, 22 Apr 2020 22:03:57 +0100 Subject: [PATCH] Fix bug where AlternativePaymentSourceResponse.getType() always returned null Releasing as 2.3.1 --- gradle.properties | 2 +- .../checkout/payments/AlternativePaymentSourceResponse.java | 6 +++--- .../payments/AlternativePaymentSourcePaymentsTests.java | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index 8212a5f1..8987ac10 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ group=com.checkout -version=2.3.0-SNAPSHOT +version=2.3.1-SNAPSHOT maven2_url=https://oss.sonatype.org/service/local/staging/deploy/maven2/ snapshot_url=https://oss.sonatype.org/content/repositories/snapshots/ diff --git a/src/main/java/com/checkout/payments/AlternativePaymentSourceResponse.java b/src/main/java/com/checkout/payments/AlternativePaymentSourceResponse.java index ded2c869..c7b36756 100644 --- a/src/main/java/com/checkout/payments/AlternativePaymentSourceResponse.java +++ b/src/main/java/com/checkout/payments/AlternativePaymentSourceResponse.java @@ -8,14 +8,14 @@ @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class AlternativePaymentSourceResponse extends HashMap implements ResponseSource { - private String type; + private static final String TYPE_FIELD = "type"; @Override public String getType() { - return type; + return get(TYPE_FIELD).toString(); } public void setType(String type) { - this.type = type; + put(TYPE_FIELD, type); } } \ No newline at end of file diff --git a/src/test/java/com/checkout/payments/AlternativePaymentSourcePaymentsTests.java b/src/test/java/com/checkout/payments/AlternativePaymentSourcePaymentsTests.java index 6f76b485..f4447014 100644 --- a/src/test/java/com/checkout/payments/AlternativePaymentSourcePaymentsTests.java +++ b/src/test/java/com/checkout/payments/AlternativePaymentSourcePaymentsTests.java @@ -37,6 +37,7 @@ public void can_get_alternative_payment() throws Exception { GetPaymentResponse verifiedPayment = getApi().paymentsClient().getAsync(payment.getId()).get(); + Assert.assertEquals("giropay", verifiedPayment.getSource().getType()); Assert.assertNotNull(verifiedPayment); Assert.assertEquals(payment.getId(), verifiedPayment.getId()); Assert.assertNotNull(verifiedPayment);