@shipengine/js-api 3.12.1 → 3.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,18 @@
1
+ import { AxiosInstance } from "axios";
2
+ import { AccountBillingResponse, UpsertAccountBillingRequestBody } from "./types";
3
+ /**
4
+ * # Account Billing API module - /v1/account/billing
5
+ * https://auctane.atlassian.net/wiki/spaces/SEEU/pages/5951389743/API+Contract+for+Subscriptions+Billing+Info
6
+ */
7
+ export declare class AccountBillingAPI {
8
+ private client;
9
+ constructor(client: AxiosInstance);
10
+ /**
11
+ * The `get` method retrieves the account billing for the current user.
12
+ */
13
+ get: () => Promise<import("axios").AxiosResponse<AccountBillingResponse, any>>;
14
+ /**
15
+ * The `post` method updates (or create) the Billing Info for the current user.
16
+ */
17
+ post: (reqBody: UpsertAccountBillingRequestBody) => Promise<import("axios").AxiosResponse<AccountBillingResponse, any>>;
18
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./api";
2
+ export * from "./types";
@@ -0,0 +1,34 @@
1
+ export type AccountBillingProvider = "visa" | "mastercard" | "americanExpress" | "discover";
2
+ export type AccountBillingResponse = {
3
+ addressLine1: string;
4
+ addressLine2?: string;
5
+ cityLocality: string;
6
+ company?: string;
7
+ countryCode: string;
8
+ email: string;
9
+ fullName: string;
10
+ paymentMethod?: {
11
+ creditCardInfo: {
12
+ cardNumberLastFour: string;
13
+ provider: AccountBillingProvider;
14
+ };
15
+ };
16
+ phone: string;
17
+ postalCode: string;
18
+ stateProvince: string;
19
+ };
20
+ export type UpsertAccountBillingRequestBody = {
21
+ addressLine1: string;
22
+ addressLine2?: string;
23
+ cityLocality: string;
24
+ company?: string;
25
+ countryCode: string;
26
+ email: string;
27
+ fullName: string;
28
+ paymentMethod: {
29
+ sessionId: string;
30
+ };
31
+ phone: string;
32
+ postalCode: string;
33
+ stateProvince: string;
34
+ };
package/client.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { AxiosError, AxiosRequestHeaders } from "axios";
2
+ import { AccountBillingAPI } from "./account-billing";
2
3
  import { AccountBillingPlanAPI } from "./account-billing-plan";
3
4
  import { AccountSettingsAPI } from "./account-settings";
4
5
  import { AddressesAPI } from "./addresses";
@@ -103,6 +104,11 @@ export declare class ShipEngineAPI {
103
104
  * in ShipEngine API.
104
105
  */
105
106
  get accountBillingPlan(): AccountBillingPlanAPI;
107
+ /**
108
+ * The `accountBilling` method provides access to the Account Billing (Recurly) endpoints
109
+ * in ShipEngine API.
110
+ */
111
+ get accountBilling(): AccountBillingAPI;
106
112
  /**
107
113
  * The `addresses` method provides access to the Address Validation endpoints
108
114
  * in ShipEngine API. e.g. Validate Addresses, Parse Addresses, etc.
@@ -12,8 +12,9 @@ export type CreateFundingSource = {
12
12
  billingInfo: FundingSourceAddress;
13
13
  iovationBlackBox: IovationBlackBox;
14
14
  paymentMethod: {
15
- auctanePayInfo?: AuctanePayInfo;
16
15
  creditCardInfo?: CreditCardInfo;
16
+ paymentMethodId?: string;
17
+ sessionId?: string;
17
18
  };
18
19
  };
19
20
  /** @internal */
package/index.d.ts CHANGED
@@ -2,6 +2,8 @@ export * as SE from "./types";
2
2
  export * from "./account-settings";
3
3
  export * from "./addresses";
4
4
  export * from "./auctane-pay";
5
+ export * from "./account-billing-plan";
6
+ export * from "./account-billing";
5
7
  export * from "./carriers";
6
8
  export * from "./connections";
7
9
  export * from "./client";
package/index.js CHANGED
@@ -256,6 +256,44 @@ class AuctanePayAPI {
256
256
  }
257
257
  }
258
258
 
259
+ class AccountBillingPlanAPI {
260
+ constructor(client) {
261
+ this.client = client;
262
+ /**
263
+ * The `get` method retrieves the account billing plan for the current user.
264
+ */
265
+ this.get = () => {
266
+ return this.client.get("/v1/account/billing_plan");
267
+ };
268
+ /**
269
+ * The `update` method updates the code of the account billing plan
270
+ */
271
+ this.update = (reqBody) => {
272
+ return this.client.put(`/v1/account/billing_plan`, reqBody);
273
+ };
274
+ this.client = client;
275
+ }
276
+ }
277
+
278
+ class AccountBillingAPI {
279
+ constructor(client) {
280
+ this.client = client;
281
+ /**
282
+ * The `get` method retrieves the account billing for the current user.
283
+ */
284
+ this.get = () => {
285
+ return this.client.get("/v1/account/billing");
286
+ };
287
+ /**
288
+ * The `post` method updates (or create) the Billing Info for the current user.
289
+ */
290
+ this.post = (reqBody) => {
291
+ return this.client.post("/v1/account/billing", reqBody);
292
+ };
293
+ this.client = client;
294
+ }
295
+ }
296
+
259
297
  const isCodedErrors = (errs) => Array.isArray(errs) && errs.every((err) => isCodedError(err));
260
298
  const isCodedError = (err) => !!err.errorCode;
261
299
  const isDataCodedErrors = (data) => !!data.errors && isCodedErrors(data.errors);
@@ -3417,25 +3455,6 @@ var lib = {
3417
3455
  stringify: stringify
3418
3456
  };
3419
3457
 
3420
- class AccountBillingPlanAPI {
3421
- constructor(client) {
3422
- this.client = client;
3423
- /**
3424
- * The `get` method retrieves the account billing plan for the current user.
3425
- */
3426
- this.get = () => {
3427
- return this.client.get("/v1/account/billing_plan");
3428
- };
3429
- /**
3430
- * The `update` method updates the code of the account billing plan
3431
- */
3432
- this.update = (reqBody) => {
3433
- return this.client.put(`/v1/account/billing_plan`, reqBody);
3434
- };
3435
- this.client = client;
3436
- }
3437
- }
3438
-
3439
3458
  class CustomPackagesAPI {
3440
3459
  constructor(client) {
3441
3460
  this.client = client;
@@ -21737,6 +21756,13 @@ class ShipEngineAPI {
21737
21756
  get accountBillingPlan() {
21738
21757
  return new AccountBillingPlanAPI(this.client);
21739
21758
  }
21759
+ /**
21760
+ * The `accountBilling` method provides access to the Account Billing (Recurly) endpoints
21761
+ * in ShipEngine API.
21762
+ */
21763
+ get accountBilling() {
21764
+ return new AccountBillingAPI(this.client);
21765
+ }
21740
21766
  /**
21741
21767
  * The `addresses` method provides access to the Address Validation endpoints
21742
21768
  * in ShipEngine API. e.g. Validate Addresses, Parse Addresses, etc.
@@ -21924,6 +21950,9 @@ class ShipEngineAPI {
21924
21950
  }
21925
21951
  }
21926
21952
 
21953
+ exports.AccountBillingAPI = AccountBillingAPI;
21954
+ exports.AccountBillingPlanAPI = AccountBillingPlanAPI;
21955
+ exports.AccountBillingPlanChangeType = AccountBillingPlanChangeType;
21927
21956
  exports.AccountSettingsAPI = AccountSettingsAPI;
21928
21957
  exports.AddressesAPI = AddressesAPI;
21929
21958
  exports.AuctanePayAPI = AuctanePayAPI;
package/index.mjs CHANGED
@@ -252,6 +252,44 @@ class AuctanePayAPI {
252
252
  }
253
253
  }
254
254
 
255
+ class AccountBillingPlanAPI {
256
+ constructor(client) {
257
+ this.client = client;
258
+ /**
259
+ * The `get` method retrieves the account billing plan for the current user.
260
+ */
261
+ this.get = () => {
262
+ return this.client.get("/v1/account/billing_plan");
263
+ };
264
+ /**
265
+ * The `update` method updates the code of the account billing plan
266
+ */
267
+ this.update = (reqBody) => {
268
+ return this.client.put(`/v1/account/billing_plan`, reqBody);
269
+ };
270
+ this.client = client;
271
+ }
272
+ }
273
+
274
+ class AccountBillingAPI {
275
+ constructor(client) {
276
+ this.client = client;
277
+ /**
278
+ * The `get` method retrieves the account billing for the current user.
279
+ */
280
+ this.get = () => {
281
+ return this.client.get("/v1/account/billing");
282
+ };
283
+ /**
284
+ * The `post` method updates (or create) the Billing Info for the current user.
285
+ */
286
+ this.post = (reqBody) => {
287
+ return this.client.post("/v1/account/billing", reqBody);
288
+ };
289
+ this.client = client;
290
+ }
291
+ }
292
+
255
293
  const isCodedErrors = (errs) => Array.isArray(errs) && errs.every((err) => isCodedError(err));
256
294
  const isCodedError = (err) => !!err.errorCode;
257
295
  const isDataCodedErrors = (data) => !!data.errors && isCodedErrors(data.errors);
@@ -3413,25 +3451,6 @@ var lib = {
3413
3451
  stringify: stringify
3414
3452
  };
3415
3453
 
3416
- class AccountBillingPlanAPI {
3417
- constructor(client) {
3418
- this.client = client;
3419
- /**
3420
- * The `get` method retrieves the account billing plan for the current user.
3421
- */
3422
- this.get = () => {
3423
- return this.client.get("/v1/account/billing_plan");
3424
- };
3425
- /**
3426
- * The `update` method updates the code of the account billing plan
3427
- */
3428
- this.update = (reqBody) => {
3429
- return this.client.put(`/v1/account/billing_plan`, reqBody);
3430
- };
3431
- this.client = client;
3432
- }
3433
- }
3434
-
3435
3454
  class CustomPackagesAPI {
3436
3455
  constructor(client) {
3437
3456
  this.client = client;
@@ -21733,6 +21752,13 @@ class ShipEngineAPI {
21733
21752
  get accountBillingPlan() {
21734
21753
  return new AccountBillingPlanAPI(this.client);
21735
21754
  }
21755
+ /**
21756
+ * The `accountBilling` method provides access to the Account Billing (Recurly) endpoints
21757
+ * in ShipEngine API.
21758
+ */
21759
+ get accountBilling() {
21760
+ return new AccountBillingAPI(this.client);
21761
+ }
21736
21762
  /**
21737
21763
  * The `addresses` method provides access to the Address Validation endpoints
21738
21764
  * in ShipEngine API. e.g. Validate Addresses, Parse Addresses, etc.
@@ -21920,4 +21946,4 @@ class ShipEngineAPI {
21920
21946
  }
21921
21947
  }
21922
21948
 
21923
- export { AccountSettingsAPI, AddressesAPI, AuctanePayAPI, CarriersAPI, CodedError, ConfirmationType, ConnectionsAPI, CreditCardVendor, Currency, CustomPackagesAPI, CustomsContentsType, CustomsNonDeliveryType, FundingSourcesAPI, InsuranceAPI, InsuranceProviderType, InvoiceAddressAPI, LabelsAPI, MetadataCapability, MetadataRequirement, MetadataSatisfyingFormTypes, MovementIndicator, OrderSourcesAPI, RateCardStatus, RateCardsAPI, RatesAPI, types as SE, SalesOrderShipmentsAPI, SalesOrdersAPI, SellersAPI, ServicePointsAPI, ShipEngineAPI, ShipmentsAPI, ShippingRulesAPI, ThemesAPI, WarehousesAPI, WebhooksAPI, camelizeKeys, decamelizeKeys, getEndUserIpAddress, isCodedError, isCodedErrors, isDataCodedErrors, isInvalidTokenError, parseError };
21949
+ export { AccountBillingAPI, AccountBillingPlanAPI, AccountBillingPlanChangeType, AccountSettingsAPI, AddressesAPI, AuctanePayAPI, CarriersAPI, CodedError, ConfirmationType, ConnectionsAPI, CreditCardVendor, Currency, CustomPackagesAPI, CustomsContentsType, CustomsNonDeliveryType, FundingSourcesAPI, InsuranceAPI, InsuranceProviderType, InvoiceAddressAPI, LabelsAPI, MetadataCapability, MetadataRequirement, MetadataSatisfyingFormTypes, MovementIndicator, OrderSourcesAPI, RateCardStatus, RateCardsAPI, RatesAPI, types as SE, SalesOrderShipmentsAPI, SalesOrdersAPI, SellersAPI, ServicePointsAPI, ShipEngineAPI, ShipmentsAPI, ShippingRulesAPI, ThemesAPI, WarehousesAPI, WebhooksAPI, camelizeKeys, decamelizeKeys, getEndUserIpAddress, isCodedError, isCodedErrors, isDataCodedErrors, isInvalidTokenError, parseError };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/js-api",
3
- "version": "3.12.1",
3
+ "version": "3.13.0",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {
package/types.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export type RequiredFields<T, K extends keyof T> = T & Required<Pick<T, K>>;
2
2
  export * from "./account-settings/types";
3
3
  export * from "./account-billing-plan/types";
4
+ export * from "./account-billing/types";
4
5
  export * from "./addresses/types";
5
6
  export * from "./auctane-pay/types";
6
7
  export * from "./carriers/types";