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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Removes the deprecated, unusable `addCreditCard` function
- Stripe has disabled the ability to pass plain credit card details over the wire and now requires using [Stripe.js/Elements/Checkout](https://support.stripe.com/questions/card-tokenization-restrictions-using-publishable-keys). Follow the [Decentralized (EasyPost-Manage Billing) Guide](https://docs.easypost.com/guides/get-started-with-forge/easypost-managed-billing-guide#referralcustomer-billing-management) for more details on the new flow to use.
- Makes `referralCustomer.retrieveEasyPostStripeApiKey` public to help facilitate adding credit cards using Stripe.js
- Adds support for `FedexDefaultAccount`, `GofoWalletAccount`, `UpsDapAccount`, `UniUniWalletAccount`, and `VehoWalletAccount` by properly routing carrier-account create requests to the `/carrier_accounts/open` endpoint.

## v9.0.0-rc.1 (2026-09-08)

Expand Down
29 changes: 18 additions & 11 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,24 @@ import Utils from './utils/util';
* A class containing constants used throughout the EasyPost Node.js client library.
*/
export default class Constants {
static get CARRIER_ACCOUNTS_WITH_CUSTOM_CREATE_WORKFLOWS() {
return ['FedexAccount', 'FedexSmartpostAccount'];
}
static get CARRIER_ACCOUNT_TYPES_WITH_CUSTOM_OAUTH() {
return [
'AmazonShippingAccount',
'UpsAccount',
'UpsMailInnovationsAccount',
'UpsSurepostAccount',
'UspsShipAccount',
];
static get CARRIER_ACCOUNT_CREATE_ENDPOINT_TYPES() {
return {
'carrier_accounts/open': [
'FedexDefaultAccount',
'GofoWalletAccount',
'UpsDapAccount',
'UniUniWalletAccount',
'VehoWalletAccount',
],
'carrier_accounts/register': ['FedexAccount', 'FedexSmartpostAccount'],
'carrier_accounts/register_oauth': [
'AmazonShippingAccount',
'UpsAccount',
'UpsMailInnovationsAccount',
'UpsSurepostAccount',
'UspsShipAccount',
],
};
}
static EXTERNAL_API_CALL_FAILED = 'Communication with %s failed, please try again later';
static INVALID_API_KEY_TYPE = 'Invalid API key type.';
Expand Down
11 changes: 6 additions & 5 deletions src/services/carrier_account_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ export default (easypostClient: EasyPostClient) =>
* @returns {string} - The endpoint to be used for the carrier account creation request.
*/
static _selectCarrierAccountCreationEndpoint(carrierAccountType: string): string {
if (Constants.CARRIER_ACCOUNTS_WITH_CUSTOM_CREATE_WORKFLOWS.includes(carrierAccountType)) {
return 'carrier_accounts/register';
} else if (Constants.CARRIER_ACCOUNT_TYPES_WITH_CUSTOM_OAUTH.includes(carrierAccountType)) {
return 'carrier_accounts/register_oauth';
for (const [endpoint, carrierAccountTypes] of Object.entries(Constants.CARRIER_ACCOUNT_CREATE_ENDPOINT_TYPES)) {
if (carrierAccountTypes.includes(carrierAccountType)) {
return endpoint;
}
}

return 'carrier_accounts';
Expand All @@ -109,7 +109,8 @@ export default (easypostClient: EasyPostClient) =>
carrierAccountType: string,
params: Record<string, unknown>,
): Record<string, unknown> {
if (Constants.CARRIER_ACCOUNT_TYPES_WITH_CUSTOM_OAUTH.includes(carrierAccountType)) {
const endpoint = this._selectCarrierAccountCreationEndpoint(carrierAccountType);
if (endpoint === 'carrier_accounts/register_oauth') {
return { carrier_account_oauth_registrations: params };
}

Expand Down

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

Loading
Loading