@shipengine/js-api 4.1.0 → 4.2.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.
@@ -1,4 +1,15 @@
1
1
  export type AccountBillingProvider = "visa" | "mastercard" | "americanExpress" | "discover";
2
+ type PaymentMethod = {
3
+ bankAccountInfo: {
4
+ lastFour: string;
5
+ provider: string;
6
+ } | null;
7
+ creditCardInfo: {
8
+ cardNumberLastFour: string;
9
+ provider: AccountBillingProvider;
10
+ } | null;
11
+ paymentMethodId?: string;
12
+ };
2
13
  export type AccountBillingResponse = {
3
14
  addressLine1: string;
4
15
  addressLine2?: string;
@@ -7,12 +18,7 @@ export type AccountBillingResponse = {
7
18
  countryCode: string;
8
19
  email: string;
9
20
  fullName: string;
10
- paymentMethod?: {
11
- creditCardInfo: {
12
- cardNumberLastFour: string;
13
- provider: AccountBillingProvider;
14
- };
15
- };
21
+ paymentMethod?: PaymentMethod;
16
22
  phone: string;
17
23
  postalCode: string;
18
24
  stateProvince: string;
@@ -32,3 +38,4 @@ export type UpsertAccountBillingRequestBody = {
32
38
  postalCode: string;
33
39
  stateProvince: string;
34
40
  };
41
+ export {};
@@ -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, BankAccountInfo, CarrierRegistration, CarrierRegistrationResponse, CreateFundingSource, CreditCardInfo, FundingSource, FundingSourceAddress, FundingSourceCreateResponse, FundingSourceTransactionsResponse, InsuranceFundingSourceAcceptedTermsResponse, MetadataResponse } from "./types";
5
5
  /**
6
6
  * @internal
7
7
  * # Funding Sources API module - /v1/funding_sources
@@ -30,7 +30,7 @@ export declare class FundingSourcesAPI {
30
30
  * user to update the billing address or payment information associated with the
31
31
  * funding source.
32
32
  */
33
- update: (billingInfo: FundingSourceAddress, creditCardInfo: CreditCardInfo | undefined, auctanePayInfo: AuctanePayInfo | undefined, fundingSourceId: string) => Promise<import("axios").AxiosResponse<{
33
+ update: (billingInfo: FundingSourceAddress, creditCardInfo: CreditCardInfo | undefined, bankAccountInfo: BankAccountInfo | undefined, auctanePayInfo: AuctanePayInfo | undefined, fundingSourceId: string) => Promise<import("axios").AxiosResponse<{
34
34
  fundingSource: FundingSource;
35
35
  }, any>>;
36
36
  /**
@@ -12,6 +12,7 @@ export type CreateFundingSource = {
12
12
  billingInfo: FundingSourceAddress;
13
13
  iovationBlackBox: IovationBlackBox;
14
14
  paymentMethod: {
15
+ bankAccountInfo?: BankAccountInfo;
15
16
  creditCardInfo?: CreditCardInfo;
16
17
  paymentMethodId?: string;
17
18
  sessionId?: string;
@@ -25,6 +26,7 @@ export type FundingSource = {
25
26
  defaultCarrierId: string;
26
27
  fundingSourceId: string;
27
28
  paymentMethod: {
29
+ bankAccountInfo: BankAccountInfo | null;
28
30
  creditCardInfo: AbbreviatedCreditCardInfo | null;
29
31
  paymentMethodId?: string;
30
32
  sessionId?: string;
@@ -92,6 +94,10 @@ export interface CreditCardInfo {
92
94
  name: string;
93
95
  provider: Provider;
94
96
  }
97
+ export interface BankAccountInfo {
98
+ lastFour: string;
99
+ provider: string;
100
+ }
95
101
  /** @internal */
96
102
  export interface Term {
97
103
  termType: string;
package/index.js CHANGED
@@ -3545,7 +3545,7 @@ class FundingSourcesAPI {
3545
3545
  * user to update the billing address or payment information associated with the
3546
3546
  * funding source.
3547
3547
  */
3548
- this.update = (billingInfo, creditCardInfo, auctanePayInfo, fundingSourceId) => __async$4(this, null, function* () {
3548
+ this.update = (billingInfo, creditCardInfo, bankAccountInfo, auctanePayInfo, fundingSourceId) => __async$4(this, null, function* () {
3549
3549
  const endUserIpAddress = yield getEndUserIpAddress();
3550
3550
  if (!endUserIpAddress) {
3551
3551
  return Promise.reject([new CodedError("Unable to get IP address")]);
@@ -3556,6 +3556,7 @@ class FundingSourcesAPI {
3556
3556
  billingInfo,
3557
3557
  endUserIpAddress,
3558
3558
  paymentMethod: __spreadValues$3({
3559
+ bankAccountInfo,
3559
3560
  creditCardInfo
3560
3561
  }, auctanePayInfo)
3561
3562
  }
@@ -4195,6 +4196,18 @@ class ShipmentsAPI {
4195
4196
  this.cancel = (shipmentId) => {
4196
4197
  return this.client.put(`/v1/shipments/${shipmentId}/cancel`);
4197
4198
  };
4199
+ /**
4200
+ * The `download` method allows for downloading a CSV document of shipments based on the provided parameters.
4201
+ */
4202
+ this.download = (params) => {
4203
+ return this.client.get("/v1/shipments/downloads", {
4204
+ headers: {
4205
+ Accept: "text/csv"
4206
+ },
4207
+ params,
4208
+ responseType: "blob"
4209
+ });
4210
+ };
4198
4211
  this.client = client;
4199
4212
  }
4200
4213
  }
package/index.mjs CHANGED
@@ -3541,7 +3541,7 @@ class FundingSourcesAPI {
3541
3541
  * user to update the billing address or payment information associated with the
3542
3542
  * funding source.
3543
3543
  */
3544
- this.update = (billingInfo, creditCardInfo, auctanePayInfo, fundingSourceId) => __async$4(this, null, function* () {
3544
+ this.update = (billingInfo, creditCardInfo, bankAccountInfo, auctanePayInfo, fundingSourceId) => __async$4(this, null, function* () {
3545
3545
  const endUserIpAddress = yield getEndUserIpAddress();
3546
3546
  if (!endUserIpAddress) {
3547
3547
  return Promise.reject([new CodedError("Unable to get IP address")]);
@@ -3552,6 +3552,7 @@ class FundingSourcesAPI {
3552
3552
  billingInfo,
3553
3553
  endUserIpAddress,
3554
3554
  paymentMethod: __spreadValues$3({
3555
+ bankAccountInfo,
3555
3556
  creditCardInfo
3556
3557
  }, auctanePayInfo)
3557
3558
  }
@@ -4191,6 +4192,18 @@ class ShipmentsAPI {
4191
4192
  this.cancel = (shipmentId) => {
4192
4193
  return this.client.put(`/v1/shipments/${shipmentId}/cancel`);
4193
4194
  };
4195
+ /**
4196
+ * The `download` method allows for downloading a CSV document of shipments based on the provided parameters.
4197
+ */
4198
+ this.download = (params) => {
4199
+ return this.client.get("/v1/shipments/downloads", {
4200
+ headers: {
4201
+ Accept: "text/csv"
4202
+ },
4203
+ params,
4204
+ responseType: "blob"
4205
+ });
4206
+ };
4194
4207
  this.client = client;
4195
4208
  }
4196
4209
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/js-api",
3
- "version": "4.1.0",
3
+ "version": "4.2.1",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  import { AxiosInstance } from "axios";
2
- import { BatchableQuery, CreationRangeQuery, ModificationRangeQuery, PageableQuery, PageableResult, SortableQuery, TaggableQuery } from "../resources";
3
- import { Shipment, ShipmentRateResponse, ShipmentStatus } from "./types";
2
+ import { PageableResult } from "../resources";
3
+ import { DownloadShipmentsParams, ListShipmentOptions, Shipment, ShipmentRateResponse } from "./types";
4
4
  /**
5
5
  * # Shipments - Get Shipment Rates Options
6
6
  */
@@ -15,17 +15,6 @@ export type GetShipmentRatesOptions = {
15
15
  */
16
16
  shipmentId: string;
17
17
  };
18
- export type ListShipmentOptions = {
19
- /**
20
- * `salesOrderIds` is an array of sales order IDs to be used when listing sales
21
- * orders.
22
- */
23
- salesOrderId?: string;
24
- /**
25
- * `shipmentStatus` is the current fulfillment status of the shipment.
26
- */
27
- shipmentStatus?: ShipmentStatus;
28
- } & BatchableQuery & PageableQuery & CreationRangeQuery & ModificationRangeQuery & SortableQuery & TaggableQuery;
29
18
  /**
30
19
  * # Shipments - List Shipments Result
31
20
  */
@@ -82,4 +71,8 @@ export declare class ShipmentsAPI {
82
71
  * https://shipengine.github.io/shipengine-openapi/#operation/cancel_shipments
83
72
  */
84
73
  cancel: (shipmentId: string) => Promise<import("axios").AxiosResponse<any, any>>;
74
+ /**
75
+ * The `download` method allows for downloading a CSV document of shipments based on the provided parameters.
76
+ */
77
+ download: (params?: DownloadShipmentsParams) => Promise<import("axios").AxiosResponse<Blob, any>>;
85
78
  }
@@ -4,7 +4,7 @@ import { CodedError } from "../errors";
4
4
  import { OrderSourceCode } from "../order-sources";
5
5
  import { Money } from "../payments";
6
6
  import { Rate } from "../rates";
7
- import { Download, LinkedResource } from "../resources";
7
+ import { BatchableQuery, CreationRangeQuery, Download, LinkedResource, ModificationRangeQuery, PageableQuery, SortableQuery, TaggableQuery } from "../resources";
8
8
  import { WeightWithUnit } from "../weight";
9
9
  export type AddressValidationOptions = "no_validation" | "validate_only" | "validate_and_clean";
10
10
  export type CustomsContents = "documents" | "gift" | "merchandise" | "returned_goods" | "sample";
@@ -254,3 +254,33 @@ export type ShipmentRateResponse = {
254
254
  shipmentId: string;
255
255
  status: "working" | "completed" | "partial" | "error";
256
256
  }[];
257
+ export type ListShipmentOptions = {
258
+ /**
259
+ * `batchId` is an optional string to retrieve shipments within a given batch.
260
+ */
261
+ batchId?: string;
262
+ /**
263
+ * `salesOrderIds` is an array of sales order IDs to be used when listing sales
264
+ * orders.
265
+ */
266
+ salesOrderId?: string;
267
+ /**
268
+ * Specific shipment number to filter by
269
+ */
270
+ shipmentNumber?: string;
271
+ /**
272
+ * `shipmentStatus` is the current fulfillment status of the shipment.
273
+ */
274
+ shipmentStatus?: ShipmentStatus;
275
+ } & BatchableQuery & PageableQuery & CreationRangeQuery & ModificationRangeQuery & SortableQuery & TaggableQuery;
276
+ export type ShipmentColumns = "shipment_id" | "packages" | "recipient" | "shipping_service" | "created_date" | "modified_at" | "status";
277
+ export type DownloadShipmentsParams = {
278
+ /**
279
+ * CSV column names to export
280
+ */
281
+ columns?: ShipmentColumns[];
282
+ /**
283
+ * Specific shipment ID to filter by
284
+ */
285
+ shipmentId?: string;
286
+ } & ListShipmentOptions;