@shipengine/js-api 0.13.1 → 0.14.1
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/client.d.ts +2 -0
- package/funding-sources/api.d.ts +5 -3
- package/funding-sources/types.d.ts +9 -13
- package/index.d.ts +1 -0
- package/index.js +18 -2
- package/index.mjs +18 -3
- package/package.json +1 -1
- package/rate-cards/api.d.ts +9 -0
- package/rate-cards/index.d.ts +2 -0
- package/rate-cards/types.d.ts +21 -0
- package/types.d.ts +1 -0
package/client.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { FundingSourcesAPI } from "./funding-sources";
|
|
|
7
7
|
import { InsuranceAPI } from "./insurance";
|
|
8
8
|
import { LabelsAPI } from "./labels";
|
|
9
9
|
import { OrderSourcesAPI } from "./order-sources";
|
|
10
|
+
import { RateCardsAPI } from "./rate-cards";
|
|
10
11
|
import { RatesAPI } from "./rates";
|
|
11
12
|
import { SalesOrderShipmentsAPI } from "./sales-order-shipments";
|
|
12
13
|
import { SalesOrdersAPI } from "./sales-orders";
|
|
@@ -30,6 +31,7 @@ export declare class ShipEngineAPI {
|
|
|
30
31
|
get insurance(): InsuranceAPI;
|
|
31
32
|
get labels(): LabelsAPI;
|
|
32
33
|
get orderSources(): OrderSourcesAPI;
|
|
34
|
+
get rateCards(): RateCardsAPI;
|
|
33
35
|
get rates(): RatesAPI;
|
|
34
36
|
get salesOrderShipments(): SalesOrderShipmentsAPI;
|
|
35
37
|
get salesOrders(): SalesOrdersAPI;
|
package/funding-sources/api.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { AxiosInstance } from "axios";
|
|
2
|
-
import { CarrierRegistration, CarrierRegistrationResponse, CreateFundingSourceResponse, CreditCardInfo, FundingSource, FundingSourceAddress
|
|
2
|
+
import { CarrierRegistration, CarrierRegistrationResponse, CreateFundingSource, CreateFundingSourceResponse, CreditCardInfo, FundingSource, FundingSourceAddress } from "./types";
|
|
3
3
|
export declare class FundingSourcesAPI {
|
|
4
4
|
private client;
|
|
5
5
|
constructor(client: AxiosInstance);
|
|
6
|
-
list: () => Promise<import("axios").AxiosResponse<
|
|
6
|
+
list: () => Promise<import("axios").AxiosResponse<{
|
|
7
|
+
fundingSources: FundingSource[];
|
|
8
|
+
}, any>>;
|
|
7
9
|
get: (fundingSourceId: string) => Promise<import("axios").AxiosResponse<FundingSource, any>>;
|
|
8
|
-
create: (
|
|
10
|
+
create: (createFundingSource: CreateFundingSource) => Promise<import("axios").AxiosResponse<CreateFundingSourceResponse, any>>;
|
|
9
11
|
update: (billingInfo: FundingSourceAddress, creditCardInfo: CreditCardInfo, fundingSourceId: string) => Promise<import("axios").AxiosResponse<CreateFundingSourceResponse, any>>;
|
|
10
12
|
registerCarrier: (carrier: CarrierRegistration) => Promise<import("axios").AxiosResponse<CarrierRegistrationResponse, any>>;
|
|
11
13
|
}
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { CreditCardVendor } from "../payments";
|
|
2
|
-
export type
|
|
2
|
+
export type CreateFundingSource = {
|
|
3
3
|
acceptedTerms: Term[];
|
|
4
4
|
agreeToTerms: boolean;
|
|
5
5
|
billingInfo: FundingSourceAddress;
|
|
6
6
|
paymentMethod: PaymentMethod;
|
|
7
7
|
};
|
|
8
|
+
export type FundingSource = {
|
|
9
|
+
billingInfo: FundingSourceAddress;
|
|
10
|
+
currencyCode: string;
|
|
11
|
+
fundingSourceId: string;
|
|
12
|
+
paymentMethod: PaymentMethod | {
|
|
13
|
+
creditCardInfo: null;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
8
16
|
export interface CarrierRegistration {
|
|
9
17
|
carriers: [
|
|
10
18
|
{
|
|
@@ -64,15 +72,3 @@ export interface CreateFundingSourceResponse {
|
|
|
64
72
|
};
|
|
65
73
|
};
|
|
66
74
|
}
|
|
67
|
-
export interface ListFundingSourcesResponse {
|
|
68
|
-
fundingSources: [
|
|
69
|
-
{
|
|
70
|
-
billingInfo: FundingSourceAddress;
|
|
71
|
-
currencyCode: string;
|
|
72
|
-
fundingSourceId: string;
|
|
73
|
-
paymentMethod: PaymentMethod | {
|
|
74
|
-
creditCardInfo: null;
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
];
|
|
78
|
-
}
|
package/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export * from "./labels";
|
|
|
12
12
|
export * from "./order-sources";
|
|
13
13
|
export * from "./payments";
|
|
14
14
|
export * from "./rates";
|
|
15
|
+
export * from "./rate-cards";
|
|
15
16
|
export * from "./relay-points";
|
|
16
17
|
export * from "./resources";
|
|
17
18
|
export * from "./sales-order-shipments";
|
package/index.js
CHANGED
|
@@ -5150,13 +5150,13 @@ class FundingSourcesAPI {
|
|
|
5150
5150
|
this.get = (fundingSourceId) => {
|
|
5151
5151
|
return this.client.get(`/v1/funding_sources/${fundingSourceId}`);
|
|
5152
5152
|
};
|
|
5153
|
-
this.create = (
|
|
5153
|
+
this.create = (createFundingSource) => __async$2(this, null, function* () {
|
|
5154
5154
|
const endUserIpAddress = yield getEndUserIpAddress();
|
|
5155
5155
|
if (!endUserIpAddress)
|
|
5156
5156
|
return Promise.reject([new CodedError("Unable to get IP address")]);
|
|
5157
5157
|
return yield this.client.post("/v1/funding_sources", __spreadValues$1({
|
|
5158
5158
|
endUserIpAddress
|
|
5159
|
-
},
|
|
5159
|
+
}, createFundingSource));
|
|
5160
5160
|
});
|
|
5161
5161
|
this.update = (billingInfo, creditCardInfo, fundingSourceId) => __async$2(this, null, function* () {
|
|
5162
5162
|
const endUserIpAddress = yield getEndUserIpAddress();
|
|
@@ -5224,6 +5224,18 @@ class OrderSourcesAPI {
|
|
|
5224
5224
|
}
|
|
5225
5225
|
}
|
|
5226
5226
|
|
|
5227
|
+
class RateCardsAPI {
|
|
5228
|
+
constructor(client) {
|
|
5229
|
+
this.client = client;
|
|
5230
|
+
this.list = (carrierIds) => {
|
|
5231
|
+
return this.client.get(
|
|
5232
|
+
`/v1/rate-cards?carrier_ids=${carrierIds.toString()}`
|
|
5233
|
+
);
|
|
5234
|
+
};
|
|
5235
|
+
this.client = client;
|
|
5236
|
+
}
|
|
5237
|
+
}
|
|
5238
|
+
|
|
5227
5239
|
class RatesAPI {
|
|
5228
5240
|
constructor(client) {
|
|
5229
5241
|
this.client = client;
|
|
@@ -5494,6 +5506,9 @@ class ShipEngineAPI {
|
|
|
5494
5506
|
get orderSources() {
|
|
5495
5507
|
return new OrderSourcesAPI(this.client);
|
|
5496
5508
|
}
|
|
5509
|
+
get rateCards() {
|
|
5510
|
+
return new RateCardsAPI(this.client);
|
|
5511
|
+
}
|
|
5497
5512
|
get rates() {
|
|
5498
5513
|
return new RatesAPI(this.client);
|
|
5499
5514
|
}
|
|
@@ -5526,6 +5541,7 @@ exports.InsuranceAPI = InsuranceAPI;
|
|
|
5526
5541
|
exports.InsuranceProviderType = InsuranceProviderType;
|
|
5527
5542
|
exports.LabelsAPI = LabelsAPI;
|
|
5528
5543
|
exports.OrderSourcesAPI = OrderSourcesAPI;
|
|
5544
|
+
exports.RateCardsAPI = RateCardsAPI;
|
|
5529
5545
|
exports.RatesAPI = RatesAPI;
|
|
5530
5546
|
exports.SE = types;
|
|
5531
5547
|
exports.SalesOrderShipmentsAPI = SalesOrderShipmentsAPI;
|
package/index.mjs
CHANGED
|
@@ -5146,13 +5146,13 @@ class FundingSourcesAPI {
|
|
|
5146
5146
|
this.get = (fundingSourceId) => {
|
|
5147
5147
|
return this.client.get(`/v1/funding_sources/${fundingSourceId}`);
|
|
5148
5148
|
};
|
|
5149
|
-
this.create = (
|
|
5149
|
+
this.create = (createFundingSource) => __async$2(this, null, function* () {
|
|
5150
5150
|
const endUserIpAddress = yield getEndUserIpAddress();
|
|
5151
5151
|
if (!endUserIpAddress)
|
|
5152
5152
|
return Promise.reject([new CodedError("Unable to get IP address")]);
|
|
5153
5153
|
return yield this.client.post("/v1/funding_sources", __spreadValues$1({
|
|
5154
5154
|
endUserIpAddress
|
|
5155
|
-
},
|
|
5155
|
+
}, createFundingSource));
|
|
5156
5156
|
});
|
|
5157
5157
|
this.update = (billingInfo, creditCardInfo, fundingSourceId) => __async$2(this, null, function* () {
|
|
5158
5158
|
const endUserIpAddress = yield getEndUserIpAddress();
|
|
@@ -5220,6 +5220,18 @@ class OrderSourcesAPI {
|
|
|
5220
5220
|
}
|
|
5221
5221
|
}
|
|
5222
5222
|
|
|
5223
|
+
class RateCardsAPI {
|
|
5224
|
+
constructor(client) {
|
|
5225
|
+
this.client = client;
|
|
5226
|
+
this.list = (carrierIds) => {
|
|
5227
|
+
return this.client.get(
|
|
5228
|
+
`/v1/rate-cards?carrier_ids=${carrierIds.toString()}`
|
|
5229
|
+
);
|
|
5230
|
+
};
|
|
5231
|
+
this.client = client;
|
|
5232
|
+
}
|
|
5233
|
+
}
|
|
5234
|
+
|
|
5223
5235
|
class RatesAPI {
|
|
5224
5236
|
constructor(client) {
|
|
5225
5237
|
this.client = client;
|
|
@@ -5490,6 +5502,9 @@ class ShipEngineAPI {
|
|
|
5490
5502
|
get orderSources() {
|
|
5491
5503
|
return new OrderSourcesAPI(this.client);
|
|
5492
5504
|
}
|
|
5505
|
+
get rateCards() {
|
|
5506
|
+
return new RateCardsAPI(this.client);
|
|
5507
|
+
}
|
|
5493
5508
|
get rates() {
|
|
5494
5509
|
return new RatesAPI(this.client);
|
|
5495
5510
|
}
|
|
@@ -5507,4 +5522,4 @@ class ShipEngineAPI {
|
|
|
5507
5522
|
}
|
|
5508
5523
|
}
|
|
5509
5524
|
|
|
5510
|
-
export { AccountSettingsAPI, AddressesAPI, CarriersAPI, CodedError, ConfirmationType, CreditCardVendor, Currency, CustomPackagesAPI, CustomsContentsType, CustomsNonDeliveryType, FundingSourcesAPI, InsuranceAPI, InsuranceProviderType, LabelsAPI, OrderSourcesAPI, RatesAPI, types as SE, SalesOrderShipmentsAPI, SalesOrdersAPI, ShipEngineAPI, ShipmentsAPI, WarehousesAPI, getEndUserIpAddress, isCodedError, isCodedErrors };
|
|
5525
|
+
export { AccountSettingsAPI, AddressesAPI, CarriersAPI, CodedError, ConfirmationType, CreditCardVendor, Currency, CustomPackagesAPI, CustomsContentsType, CustomsNonDeliveryType, FundingSourcesAPI, InsuranceAPI, InsuranceProviderType, LabelsAPI, OrderSourcesAPI, RateCardsAPI, RatesAPI, types as SE, SalesOrderShipmentsAPI, SalesOrdersAPI, ShipEngineAPI, ShipmentsAPI, WarehousesAPI, getEndUserIpAddress, isCodedError, isCodedErrors };
|
package/package.json
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AxiosInstance } from "axios";
|
|
2
|
+
import { RateCard } from "./types";
|
|
3
|
+
export declare class RateCardsAPI {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: AxiosInstance);
|
|
6
|
+
list: (carrierIds: string[]) => Promise<import("axios").AxiosResponse<{
|
|
7
|
+
rateCards: RateCard[];
|
|
8
|
+
}, any>>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Currency } from "../payments";
|
|
2
|
+
/**
|
|
3
|
+
* @category Entities
|
|
4
|
+
*/
|
|
5
|
+
export interface ShipFromLocation {
|
|
6
|
+
countryCode: string;
|
|
7
|
+
postalCode?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* @category Entities
|
|
11
|
+
*/
|
|
12
|
+
export interface RateCard {
|
|
13
|
+
carrierId: string;
|
|
14
|
+
currency: Currency;
|
|
15
|
+
endDate?: string;
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
shipFrom: ShipFromLocation;
|
|
19
|
+
startDate: string;
|
|
20
|
+
status: string;
|
|
21
|
+
}
|
package/types.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export * from "./labels/types";
|
|
|
10
10
|
export * from "./order-sources/types";
|
|
11
11
|
export * from "./payments/types";
|
|
12
12
|
export * from "./rates/types";
|
|
13
|
+
export * from "./rate-cards/types";
|
|
13
14
|
export * from "./relay-points/types";
|
|
14
15
|
export * from "./resources/types";
|
|
15
16
|
export * from "./sales-order-shipments/types";
|