Skip to content

Commit

Permalink
prep release v7.2.0 (#310)
Browse files Browse the repository at this point in the history
  • Loading branch information
jchen293 committed Apr 10, 2024
1 parent 3807ef8 commit 1cc10ab
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 34 deletions.
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)

- 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
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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>
```

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

0 comments on commit 1cc10ab

Please sign in to comment.