Skip to content

prep release v7.2.0 #310

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# CHANGELOG

## Next Release
## v7.2.0 (2024-04-10)

- Fix payment method funding and deletion failures due to undetermined payment method type
- Adds `refund` function in Insurance service for requesting a refund for a standalone insurance
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ Add this to your project's POM:
<dependency>
<groupId>com.easypost</groupId>
<artifactId>easypost-api-client</artifactId>
<version>7.1.1</version>
<version>7.2.0</version>
</dependency>
```

@@ -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.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.1.1
7.2.0
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
<groupId>com.easypost</groupId>
<artifactId>easypost-api-client</artifactId>

<version>7.1.1</version>
<version>7.2.0</version>
<packaging>jar</packaging>

<name>com.easypost:easypost-api-client</name>
4 changes: 2 additions & 2 deletions src/main/java/com/easypost/model/PaymentMethodObject.java
Original file line number Diff line number Diff line change
@@ -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;
27 changes: 0 additions & 27 deletions src/test/java/com/easypost/BillingTest.java
Original file line number Diff line number Diff line change
@@ -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());
}
}