Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## v8.0.1 (2025-05-27)

- Corrects the endpoint used for creating/updating UPS accounts

## v8.0.0 (2025-04-28)

See our [Upgrade Guide](UPGRADE_GUIDE.md#upgrading-from-7x-to-80) for more details.
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>8.0.0</version>
<version>8.0.1</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:8.0.0"
implementation "com.easypost:easypost-api-client:8.0.1"
```

**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 @@
8.0.0
8.0.1
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>8.0.0</version>
<version>8.0.1</version>
<packaging>jar</packaging>

<name>com.easypost:easypost-api-client</name>
Expand Down
6 changes: 1 addition & 5 deletions src/main/java/com/easypost/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,8 @@ public abstract static class CarrierAccountTypes {
"FedexAccount", "FedexSmartpostAccount"
);

public static final List<String> UPS_OAUTH_CARRIER_ACCOUNT_TYPES = ImmutableList.of(
"UpsAccount", "UpsMailInnovationsAccount", "UpsSurepostAccount"
);

public static final List<String> CARRIER_ACCOUNT_TYPES_WITH_CUSTOM_OAUTH = ImmutableList.of(
"AmazonShippingAccount"
"AmazonShippingAccount", "UpsAccount", "UpsMailInnovationsAccount", "UpsSurepostAccount"
);
}

Expand Down
15 changes: 3 additions & 12 deletions src/main/java/com/easypost/service/CarrierAccountService.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,9 @@ public List<CarrierAccount> all(final Map<String, Object> params) throws EasyPos
* @throws EasyPostException when the request fails.
*/
public CarrierAccount update(String id, final Map<String, Object> params) throws EasyPostException {
CarrierAccount carrierAccount = this.retrieve(id);
String type = (String) carrierAccount.getType();
String endpoint = "carrier_accounts/" + id;
Map<String, Object> wrappedParams = new HashMap<String, Object>();
wrappedParams.put(selectTopLayerKey(type), params);

String endpoint = (Constants.CarrierAccountTypes.UPS_OAUTH_CARRIER_ACCOUNT_TYPES.contains(type)
? "ups_oauth_registrations/"
: "carrier_accounts/") + id;
wrappedParams.put("carrier_account", params);

return Requestor.request(RequestMethod.PUT, endpoint, wrappedParams, CarrierAccount.class,
client);
Expand Down Expand Up @@ -123,8 +118,6 @@ public void delete(String id) throws EasyPostException {
private static String selectCarrierAccountCreationEndpoint(final String carrierAccountType) {
if (Constants.CarrierAccountTypes.CARRIER_ACCOUNT_TYPES_WITH_CUSTOM_WORKFLOW.contains(carrierAccountType)) {
return "carrier_accounts/register";
} else if (Constants.CarrierAccountTypes.UPS_OAUTH_CARRIER_ACCOUNT_TYPES.contains(carrierAccountType)) {
return "ups_oauth_registrations";
} else if (Constants.CarrierAccountTypes.CARRIER_ACCOUNT_TYPES_WITH_CUSTOM_OAUTH.contains(carrierAccountType)) {
return "carrier_accounts/register_oauth";
} else {
Expand All @@ -146,9 +139,7 @@ private static String selectTopLayerKey(final String carrierAccountType) throws
String.format(Constants.ErrorMessages.MISSING_REQUIRED_PARAMETER, "carrier account type"));
}

if (Constants.CarrierAccountTypes.UPS_OAUTH_CARRIER_ACCOUNT_TYPES.contains(carrierAccountType)) {
return "ups_oauth_registrations";
} else if (Constants.CarrierAccountTypes.CARRIER_ACCOUNT_TYPES_WITH_CUSTOM_OAUTH.contains(carrierAccountType)) {
if (Constants.CarrierAccountTypes.CARRIER_ACCOUNT_TYPES_WITH_CUSTOM_OAUTH.contains(carrierAccountType)) {
return "carrier_account_oauth_registrations";
} else {
return "carrier_account";
Expand Down
73 changes: 35 additions & 38 deletions src/test/cassettes/carrier_account/create_with_ups.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading