diff --git a/CHANGELOG.md b/CHANGELOG.md index 90894b795..1191163da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # CHANGELOG -## Next Release +## v7.2.0 (2024-04-10) - Adds `refund` function in Insurance service for requesting a refund for a standalone insurance - Fix payment method funding and deletion failures due to undetermined payment method type diff --git a/README.md b/README.md index d0d0e0987..2a8110028 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Add this to your project's POM: com.easypost easypost-api-client - 7.1.1 + 7.2.0 ``` @@ -25,7 +25,7 @@ Add this to your project's POM: Add this to your project's build file: ```groovy -implementation "com.easypost:easypost-api-client:7.1.1" +implementation "com.easypost:easypost-api-client:7.2.0" ``` **NOTE:** [Google Gson](http://code.google.com/p/google-gson/) is required. diff --git a/VERSION b/VERSION index 21c8c7b46..0ee843cc6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -7.1.1 +7.2.0 diff --git a/pom.xml b/pom.xml index 8ab16d1c3..9759e0db5 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.easypost easypost-api-client - 7.1.1 + 7.2.0 jar com.easypost:easypost-api-client diff --git a/src/main/java/com/easypost/model/PaymentMethodObject.java b/src/main/java/com/easypost/model/PaymentMethodObject.java index f8cfbfa07..a4f924e4a 100644 --- a/src/main/java/com/easypost/model/PaymentMethodObject.java +++ b/src/main/java/com/easypost/model/PaymentMethodObject.java @@ -60,9 +60,9 @@ public PaymentMethodType getType() { return null; } String objectType = getObject(); - if (getId().startsWith("card_") || (objectType != null && objectType.equals("CreditCard"))) { + if (objectType != null && objectType.equals("CreditCard")) { type = PaymentMethodType.CREDIT_CARD; - } else if (getId().startsWith("bank_") || (objectType != null && objectType.equals("BankAccount"))) { + } else if (objectType != null && objectType.equals("BankAccount")) { type = PaymentMethodType.BANK_ACCOUNT; } return type; diff --git a/src/test/java/com/easypost/BillingTest.java b/src/test/java/com/easypost/BillingTest.java index 762264b7c..9abd59b14 100644 --- a/src/test/java/com/easypost/BillingTest.java +++ b/src/test/java/com/easypost/BillingTest.java @@ -14,7 +14,6 @@ import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; public final class BillingTest { @@ -139,30 +138,4 @@ public void testDeterminePaymentMethodTypeByObjectType() throws EasyPostExceptio assertEquals("BankAccount", bankAccount.getObject()); assertEquals(PaymentMethodObject.PaymentMethodType.BANK_ACCOUNT, bankAccount.getType()); } - - /** - * Test determining a payment method type by its legacy prefix. - * - * @throws EasyPostException when the request fails. - */ - @Test - public void testDeterminePaymentMethodTypeByLegacyPrefix() throws EasyPostException { - requestMock.when(() -> Requestor.request( - RequestMethod.GET, "payment_methods", null, PaymentMethod.class, vcr.client)) - .thenReturn(paymentMethodLegacyPrefixes); - - // Should be a credit card with null object type and "card_" prefix - PaymentMethodObject creditCard = - vcr.client.billing.retrievePaymentMethods().getPrimaryPaymentMethod(); - assertTrue(creditCard.getId().startsWith("card_")); - assertNull(creditCard.getObject()); - assertEquals(PaymentMethodObject.PaymentMethodType.CREDIT_CARD, creditCard.getType()); - - // Should be a bank account with null object type and "bank_" prefix - PaymentMethodObject bankAccount = - vcr.client.billing.retrievePaymentMethods().getSecondaryPaymentMethod(); - assertTrue(bankAccount.getId().startsWith("bank_")); - assertNull(bankAccount.getObject()); - assertEquals(PaymentMethodObject.PaymentMethodType.BANK_ACCOUNT, bankAccount.getType()); - } }