@shipengine/js-api 0.14.0 → 0.14.2

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,11 +1,13 @@
1
1
  import { AxiosInstance } from "axios";
2
- import { CarrierRegistration, CarrierRegistrationResponse, CreateFundingSourceResponse, CreditCardInfo, FundingSource, FundingSourceAddress, ListFundingSourcesResponse } from "./types";
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<ListFundingSourcesResponse, any>>;
6
+ list: () => Promise<import("axios").AxiosResponse<{
7
+ fundingSources: FundingSource[];
8
+ }, any>>;
7
9
  get: (fundingSourceId: string) => Promise<import("axios").AxiosResponse<FundingSource, any>>;
8
- create: (fundingSource: FundingSource) => Promise<import("axios").AxiosResponse<CreateFundingSourceResponse, any>>;
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 FundingSource = {
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.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 = (fundingSource) => __async$2(this, null, function* () {
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
- }, fundingSource));
5159
+ }, createFundingSource));
5160
5160
  });
5161
5161
  this.update = (billingInfo, creditCardInfo, fundingSourceId) => __async$2(this, null, function* () {
5162
5162
  const endUserIpAddress = yield getEndUserIpAddress();
@@ -5229,7 +5229,7 @@ class RateCardsAPI {
5229
5229
  this.client = client;
5230
5230
  this.list = (carrierIds) => {
5231
5231
  return this.client.get(
5232
- `/v1/rate-cards?carrier_ids=${carrierIds.toString()}`
5232
+ `/v1/rate_cards?carrier_ids=${carrierIds.toString()}`
5233
5233
  );
5234
5234
  };
5235
5235
  this.client = client;
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 = (fundingSource) => __async$2(this, null, function* () {
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
- }, fundingSource));
5155
+ }, createFundingSource));
5156
5156
  });
5157
5157
  this.update = (billingInfo, creditCardInfo, fundingSourceId) => __async$2(this, null, function* () {
5158
5158
  const endUserIpAddress = yield getEndUserIpAddress();
@@ -5225,7 +5225,7 @@ class RateCardsAPI {
5225
5225
  this.client = client;
5226
5226
  this.list = (carrierIds) => {
5227
5227
  return this.client.get(
5228
- `/v1/rate-cards?carrier_ids=${carrierIds.toString()}`
5228
+ `/v1/rate_cards?carrier_ids=${carrierIds.toString()}`
5229
5229
  );
5230
5230
  };
5231
5231
  this.client = client;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/js-api",
3
- "version": "0.14.0",
3
+ "version": "0.14.2",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {