@shipengine/js-api 4.20.0 → 4.21.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.
package/carriers/api.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { AxiosInstance } from "axios";
2
2
  import { Currency, Money } from "../payments";
3
3
  import { SandboxableQuery } from "../resources";
4
- import { Carrier, CarrierAutoFundingSettings, CarrierAutoFundingSettingsResponse, CarrierConnection, CarrierService, CarrierZone, PackageRatingType } from "./types";
4
+ import { Carrier, CarrierAutoFundingSettings, CarrierAutoFundingSettingsResponse, CarrierConnection, CarrierService, CarrierTerm, CarrierZone, PackageRatingType } from "./types";
5
5
  /**
6
6
  * # Carriers API module - /v1/carriers
7
7
  */
@@ -87,4 +87,13 @@ export declare class CarriersAPI {
87
87
  * https://shipengine.github.io/shipengine-openapi/#operation/disconnect_carrier_by_id
88
88
  */
89
89
  delete: (carrierId: string) => Promise<import("axios").AxiosResponse<void, any>>;
90
+ /**
91
+ * The `acceptTerms` method allows users to accept new versions of carrier terms.
92
+ * Returns the status of each term.
93
+ */
94
+ acceptTerms: (carrierId: string, request: {
95
+ acceptedTerms: CarrierTerm[];
96
+ }) => Promise<import("axios").AxiosResponse<{
97
+ acceptedTerms: CarrierTerm[];
98
+ }, any>>;
90
99
  }
@@ -20,13 +20,6 @@ export interface CarrierAutoFundingSettings {
20
20
  maximumPurchasesPerDay?: number;
21
21
  purchaseAmount: Money;
22
22
  }
23
- export interface CarrierAutoFundingSettingsResponse {
24
- autoPurchaseAmount: number;
25
- autoPurchaseCutoff?: number;
26
- autoPurchaseThreshold: number;
27
- balance: number;
28
- isAutoPurchaseEnabled: boolean;
29
- }
30
23
  /**
31
24
  * @category Entities
32
25
  */
@@ -128,3 +121,23 @@ export type CarrierZone = {
128
121
  apiCode: string;
129
122
  name: string;
130
123
  };
124
+ /**
125
+ * @category Entities
126
+ */
127
+ /** @internal */
128
+ export type CarrierTermsStatus = "saved" | "not_found" | "already_saved" | "error";
129
+ export type CarrierTermCategory = "funding_source" | "carrier" | "insurance";
130
+ export interface CarrierTerm {
131
+ status?: CarrierTermsStatus;
132
+ termCategory?: CarrierTermCategory;
133
+ termType: string;
134
+ version: string;
135
+ }
136
+ /** @internal */
137
+ export interface CarrierAutoFundingSettingsResponse {
138
+ autoPurchaseAmount: number;
139
+ autoPurchaseCutoff?: number;
140
+ autoPurchaseThreshold: number;
141
+ balance: number;
142
+ isAutoPurchaseEnabled: boolean;
143
+ }
@@ -1,7 +1,7 @@
1
1
  import { AxiosInstance } from "axios";
2
2
  import { Money } from "../payments";
3
3
  import { CreationRangeQuery, PageableQuery } from "../resources";
4
- import { AddFundsResponse, AuctanePayInfo, CarrierRegistration, CarrierRegistrationResponse, CreateFundingSource, CreditCardInfo, FundingSource, FundingSourceAddress, FundingSourceCreateResponse, FundingSourceTransactionsResponse, InsuranceFundingSourceAcceptedTermsResponse, MetadataResponse } from "./types";
4
+ import { AddFundsResponse, AuctanePayInfo, CarrierRegistration, CarrierRegistrationResponse, CreateFundingSource, CreditCardInfo, FundingSource, FundingSourceAddress, FundingSourceCreateResponse, FundingSourceTransactionsResponse, InsuranceFundingSourceAcceptedTermsResponse, MetadataResponse, Term } from "./types";
5
5
  /**
6
6
  * @internal
7
7
  * # Funding Sources API module - /v1/funding_sources
@@ -58,4 +58,18 @@ export declare class FundingSourcesAPI {
58
58
  * if "ParcelGuard" appears here that means the user its using it.
59
59
  */
60
60
  insuranceAcceptedTerms: () => Promise<import("axios").AxiosResponse<InsuranceFundingSourceAcceptedTermsResponse, any>>;
61
+ /**
62
+ * The `acceptedTerms` method retrieves all accepted terms for a specific funding source.
63
+ */
64
+ acceptedTerms: (fundingSourceId: string) => Promise<import("axios").AxiosResponse<{
65
+ acceptedTerms: Term[];
66
+ }, any>>;
67
+ /**
68
+ * The`acceptTerms` method allows users to accept new versions of funding source terms.
69
+ */
70
+ acceptTerms: (fundingSourceId: string, request: {
71
+ acceptedTerms: Term[];
72
+ }) => Promise<import("axios").AxiosResponse<{
73
+ acceptedTerms: Term[];
74
+ }, any>>;
61
75
  }
@@ -89,7 +89,12 @@ export interface CreditCardInfo {
89
89
  provider: Provider;
90
90
  }
91
91
  /** @internal */
92
+ export type TermsStatus = "saved" | "not_found" | "already_saved" | "error";
93
+ export type TermCategory = "funding_source" | "carrier" | "insurance";
94
+ /** @internal */
92
95
  export interface Term {
96
+ status?: TermsStatus;
97
+ termCategory?: TermCategory;
93
98
  termType: string;
94
99
  version: string;
95
100
  }
package/index.js CHANGED
@@ -1379,6 +1379,16 @@ class CarriersAPI {
1379
1379
  this.delete = (carrierId) => {
1380
1380
  return this.client.delete(`/v1/carriers/${carrierId}`);
1381
1381
  };
1382
+ /**
1383
+ * The `acceptTerms` method allows users to accept new versions of carrier terms.
1384
+ * Returns the status of each term.
1385
+ */
1386
+ this.acceptTerms = (carrierId, request) => {
1387
+ return this.client.post(
1388
+ `/v1/carriers/${carrierId}/accepted_terms`,
1389
+ request
1390
+ );
1391
+ };
1382
1392
  this.client = client;
1383
1393
  }
1384
1394
  }
@@ -3744,6 +3754,23 @@ class FundingSourcesAPI {
3744
3754
  "/v1/insurance/funding_source/accepted_terms"
3745
3755
  );
3746
3756
  };
3757
+ /**
3758
+ * The `acceptedTerms` method retrieves all accepted terms for a specific funding source.
3759
+ */
3760
+ this.acceptedTerms = (fundingSourceId) => {
3761
+ return this.client.get(
3762
+ `/v1/funding_sources/${fundingSourceId}/accepted_terms`
3763
+ );
3764
+ };
3765
+ /**
3766
+ * The`acceptTerms` method allows users to accept new versions of funding source terms.
3767
+ */
3768
+ this.acceptTerms = (fundingSourceId, request) => {
3769
+ return this.client.post(
3770
+ `/v1/funding_sources/${fundingSourceId}/accepted_terms`,
3771
+ request
3772
+ );
3773
+ };
3747
3774
  this.client = client;
3748
3775
  }
3749
3776
  }
package/index.mjs CHANGED
@@ -1375,6 +1375,16 @@ class CarriersAPI {
1375
1375
  this.delete = (carrierId) => {
1376
1376
  return this.client.delete(`/v1/carriers/${carrierId}`);
1377
1377
  };
1378
+ /**
1379
+ * The `acceptTerms` method allows users to accept new versions of carrier terms.
1380
+ * Returns the status of each term.
1381
+ */
1382
+ this.acceptTerms = (carrierId, request) => {
1383
+ return this.client.post(
1384
+ `/v1/carriers/${carrierId}/accepted_terms`,
1385
+ request
1386
+ );
1387
+ };
1378
1388
  this.client = client;
1379
1389
  }
1380
1390
  }
@@ -3740,6 +3750,23 @@ class FundingSourcesAPI {
3740
3750
  "/v1/insurance/funding_source/accepted_terms"
3741
3751
  );
3742
3752
  };
3753
+ /**
3754
+ * The `acceptedTerms` method retrieves all accepted terms for a specific funding source.
3755
+ */
3756
+ this.acceptedTerms = (fundingSourceId) => {
3757
+ return this.client.get(
3758
+ `/v1/funding_sources/${fundingSourceId}/accepted_terms`
3759
+ );
3760
+ };
3761
+ /**
3762
+ * The`acceptTerms` method allows users to accept new versions of funding source terms.
3763
+ */
3764
+ this.acceptTerms = (fundingSourceId, request) => {
3765
+ return this.client.post(
3766
+ `/v1/funding_sources/${fundingSourceId}/accepted_terms`,
3767
+ request
3768
+ );
3769
+ };
3743
3770
  this.client = client;
3744
3771
  }
3745
3772
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/js-api",
3
- "version": "4.20.0",
3
+ "version": "4.21.0",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {