@shipengine/js-api 0.39.0 → 0.40.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.
@@ -1,8 +1,9 @@
1
1
  import { AxiosInstance } from "axios";
2
2
  import { Money } from "../payments";
3
- import { AddFundsResponse, CarrierRegistration, CarrierRegistrationResponse, CreateFundingSource, CreditCardInfo, FundingSource, FundingSourceAddress } from "./types";
3
+ import { AddFundsResponse, CarrierRegistration, CarrierRegistrationResponse, CreateFundingSource, CreditCardInfo, FundingSource, FundingSourceAddress, MetadataResponse } from "./types";
4
4
  /**
5
5
  * # Funding Sources API module - /v1/funding_sources
6
+ * Docs: https://auctane.atlassian.net/wiki/spaces/SE/pages/3628370266/ShipEngine+Funding+Sources+API
6
7
  */
7
8
  export declare class FundingSourcesAPI {
8
9
  private client;
@@ -41,4 +42,9 @@ export declare class FundingSourcesAPI {
41
42
  * The `addFunds` method allows you to add funds to a funding source.
42
43
  */
43
44
  addFunds: (amount: Money, fundingSourceId: string) => Promise<import("axios").AxiosResponse<AddFundsResponse, any>>;
45
+ /**
46
+ * The `metadata` method returns seller-specific requirements for creating funding sources
47
+ * and attaching carriers
48
+ */
49
+ metadata: () => Promise<import("axios").AxiosResponse<MetadataResponse, any>>;
44
50
  }
@@ -1,9 +1,3 @@
1
- export type AddFundsResponse = {
2
- balance: {
3
- amount: number;
4
- currency: string;
5
- };
6
- };
7
1
  /**
8
2
  * An encoded device fingerprint string containing information about the end-user's computing device such as OS, browser, etc.
9
3
  * Required for carrier registration and US Wallet creation.
@@ -35,7 +29,7 @@ export interface CarrierRegistration {
35
29
  {
36
30
  acceptedTerms: Term[];
37
31
  agreeToTerms: boolean;
38
- carrierCode: "stamps_com" | "ups_walleted" | "dhl_express_worldwide";
32
+ carrierCode: string;
39
33
  fundingSourceId: string;
40
34
  iovationBlackBox: IovationBlackBox;
41
35
  pickupAddress?: FundingSourceAddress;
@@ -66,6 +60,42 @@ export interface Term {
66
60
  termType: string;
67
61
  version: string;
68
62
  }
63
+ export type MetadataRequiredTerm = {
64
+ termType: string;
65
+ version: string;
66
+ };
67
+ export declare enum MetadataCapability {
68
+ AutoFunding = "auto_funding",
69
+ UpdatePaymentMethod = "update_payment_method",
70
+ DefaultPurchaseAmount = "default_purchase_amount",
71
+ ReportsLink = "reports_link",
72
+ BalanceHistory = "balance_history",
73
+ Nickname = "nickname",
74
+ RefreshServices = "refresh_services",
75
+ UpdatePassword = "update_password",
76
+ AccountSettingsLink = "account_settings_link",
77
+ Unknown = "unknown"
78
+ }
79
+ export declare enum MetadataRequirement {
80
+ BillingAddress = "billing_address",
81
+ CurrencyCode = "currency_code",
82
+ IovationBlackBox = "iovation_black_box",
83
+ Nickname = "nickname",
84
+ PaymentMethod = "payment_method",
85
+ PickupAddress = "pickup_address",
86
+ Unknown = "unknown"
87
+ }
88
+ export declare enum MetadataSatisfyingFormTypes {
89
+ Address = "address",
90
+ CreditCard = "credit_card",
91
+ StampsAccountCredentials = "stamps_account_credentials",
92
+ StampSellerLabelProvider = "stamps_seller_label_provider",
93
+ Unknown = "unknown"
94
+ }
95
+ export type MetadataRegistrationRequirement = {
96
+ requirementType: MetadataRequirement;
97
+ satisfyingFormTypes: MetadataSatisfyingFormTypes[];
98
+ };
69
99
  export interface CarrierRegistrationResponse {
70
100
  carrierAttachmentResults: [
71
101
  {
@@ -77,4 +107,29 @@ export interface CarrierRegistrationResponse {
77
107
  }
78
108
  ];
79
109
  }
110
+ export interface MetadataResponse {
111
+ defaultFundingSourceProfile: {
112
+ capabilities: MetadataCapability[] | null;
113
+ countryCode: string;
114
+ currencyCode: string;
115
+ registrationRequirements: MetadataRegistrationRequirement[];
116
+ requiredTerms: MetadataRequiredTerm[];
117
+ };
118
+ defaultRegionProfile: {
119
+ carrierProfiles: Array<{
120
+ capabilities: MetadataCapability[] | null;
121
+ carrierCode: string;
122
+ registrationRequirements: MetadataRegistrationRequirement[];
123
+ requiredTerms: MetadataRequiredTerm[];
124
+ }>;
125
+ countryCode: string;
126
+ currencyCode: string;
127
+ };
128
+ }
129
+ export type AddFundsResponse = {
130
+ balance: {
131
+ amount: number;
132
+ currency: string;
133
+ };
134
+ };
80
135
  export {};
package/index.js CHANGED
@@ -4,6 +4,12 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
5
  const axios = require('axios');
6
6
 
7
+ var AccountBillingPlanChangeType = /* @__PURE__ */ ((AccountBillingPlanChangeType2) => {
8
+ AccountBillingPlanChangeType2[AccountBillingPlanChangeType2["Downgrade"] = 0] = "Downgrade";
9
+ AccountBillingPlanChangeType2[AccountBillingPlanChangeType2["Cancellation"] = 1] = "Cancellation";
10
+ return AccountBillingPlanChangeType2;
11
+ })(AccountBillingPlanChangeType || {});
12
+
7
13
  var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
8
14
  var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
9
15
  var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
@@ -33,6 +39,38 @@ class CodedError {
33
39
  }
34
40
  }
35
41
 
42
+ var MetadataCapability = /* @__PURE__ */ ((MetadataCapability2) => {
43
+ MetadataCapability2["AutoFunding"] = "auto_funding";
44
+ MetadataCapability2["UpdatePaymentMethod"] = "update_payment_method";
45
+ MetadataCapability2["DefaultPurchaseAmount"] = "default_purchase_amount";
46
+ MetadataCapability2["ReportsLink"] = "reports_link";
47
+ MetadataCapability2["BalanceHistory"] = "balance_history";
48
+ MetadataCapability2["Nickname"] = "nickname";
49
+ MetadataCapability2["RefreshServices"] = "refresh_services";
50
+ MetadataCapability2["UpdatePassword"] = "update_password";
51
+ MetadataCapability2["AccountSettingsLink"] = "account_settings_link";
52
+ MetadataCapability2["Unknown"] = "unknown";
53
+ return MetadataCapability2;
54
+ })(MetadataCapability || {});
55
+ var MetadataRequirement = /* @__PURE__ */ ((MetadataRequirement2) => {
56
+ MetadataRequirement2["BillingAddress"] = "billing_address";
57
+ MetadataRequirement2["CurrencyCode"] = "currency_code";
58
+ MetadataRequirement2["IovationBlackBox"] = "iovation_black_box";
59
+ MetadataRequirement2["Nickname"] = "nickname";
60
+ MetadataRequirement2["PaymentMethod"] = "payment_method";
61
+ MetadataRequirement2["PickupAddress"] = "pickup_address";
62
+ MetadataRequirement2["Unknown"] = "unknown";
63
+ return MetadataRequirement2;
64
+ })(MetadataRequirement || {});
65
+ var MetadataSatisfyingFormTypes = /* @__PURE__ */ ((MetadataSatisfyingFormTypes2) => {
66
+ MetadataSatisfyingFormTypes2["Address"] = "address";
67
+ MetadataSatisfyingFormTypes2["CreditCard"] = "credit_card";
68
+ MetadataSatisfyingFormTypes2["StampsAccountCredentials"] = "stamps_account_credentials";
69
+ MetadataSatisfyingFormTypes2["StampSellerLabelProvider"] = "stamps_seller_label_provider";
70
+ MetadataSatisfyingFormTypes2["Unknown"] = "unknown";
71
+ return MetadataSatisfyingFormTypes2;
72
+ })(MetadataSatisfyingFormTypes || {});
73
+
36
74
  var CreditCardVendor = /* @__PURE__ */ ((CreditCardVendor2) => {
37
75
  CreditCardVendor2["AMERICAN_EXPRESS"] = "americanexpress";
38
76
  CreditCardVendor2["DISCOVER"] = "discover";
@@ -90,6 +128,7 @@ var InsuranceProviderType = /* @__PURE__ */ ((InsuranceProviderType2) => {
90
128
 
91
129
  const types = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
92
130
  __proto__: null,
131
+ AccountBillingPlanChangeType,
93
132
  CodedError,
94
133
  ConfirmationType,
95
134
  CreditCardVendor,
@@ -97,6 +136,9 @@ const types = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
97
136
  CustomsContentsType,
98
137
  CustomsNonDeliveryType,
99
138
  InsuranceProviderType,
139
+ MetadataCapability,
140
+ MetadataRequirement,
141
+ MetadataSatisfyingFormTypes,
100
142
  RateCardStatus
101
143
  }, Symbol.toStringTag, { value: 'Module' }));
102
144
 
@@ -3355,6 +3397,13 @@ class FundingSourcesAPI {
3355
3397
  amount
3356
3398
  );
3357
3399
  });
3400
+ /**
3401
+ * The `metadata` method returns seller-specific requirements for creating funding sources
3402
+ * and attaching carriers
3403
+ */
3404
+ this.metadata = () => __async$2(this, null, function* () {
3405
+ return yield this.client.get("/v1/funding_sources/metadata");
3406
+ });
3358
3407
  this.client = client;
3359
3408
  }
3360
3409
  }
@@ -4006,6 +4055,9 @@ exports.FundingSourcesAPI = FundingSourcesAPI;
4006
4055
  exports.InsuranceAPI = InsuranceAPI;
4007
4056
  exports.InsuranceProviderType = InsuranceProviderType;
4008
4057
  exports.LabelsAPI = LabelsAPI;
4058
+ exports.MetadataCapability = MetadataCapability;
4059
+ exports.MetadataRequirement = MetadataRequirement;
4060
+ exports.MetadataSatisfyingFormTypes = MetadataSatisfyingFormTypes;
4009
4061
  exports.OrderSourcesAPI = OrderSourcesAPI;
4010
4062
  exports.RateCardStatus = RateCardStatus;
4011
4063
  exports.RateCardsAPI = RateCardsAPI;
package/index.mjs CHANGED
@@ -1,5 +1,11 @@
1
1
  import axios from 'axios';
2
2
 
3
+ var AccountBillingPlanChangeType = /* @__PURE__ */ ((AccountBillingPlanChangeType2) => {
4
+ AccountBillingPlanChangeType2[AccountBillingPlanChangeType2["Downgrade"] = 0] = "Downgrade";
5
+ AccountBillingPlanChangeType2[AccountBillingPlanChangeType2["Cancellation"] = 1] = "Cancellation";
6
+ return AccountBillingPlanChangeType2;
7
+ })(AccountBillingPlanChangeType || {});
8
+
3
9
  var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
4
10
  var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
5
11
  var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
@@ -29,6 +35,38 @@ class CodedError {
29
35
  }
30
36
  }
31
37
 
38
+ var MetadataCapability = /* @__PURE__ */ ((MetadataCapability2) => {
39
+ MetadataCapability2["AutoFunding"] = "auto_funding";
40
+ MetadataCapability2["UpdatePaymentMethod"] = "update_payment_method";
41
+ MetadataCapability2["DefaultPurchaseAmount"] = "default_purchase_amount";
42
+ MetadataCapability2["ReportsLink"] = "reports_link";
43
+ MetadataCapability2["BalanceHistory"] = "balance_history";
44
+ MetadataCapability2["Nickname"] = "nickname";
45
+ MetadataCapability2["RefreshServices"] = "refresh_services";
46
+ MetadataCapability2["UpdatePassword"] = "update_password";
47
+ MetadataCapability2["AccountSettingsLink"] = "account_settings_link";
48
+ MetadataCapability2["Unknown"] = "unknown";
49
+ return MetadataCapability2;
50
+ })(MetadataCapability || {});
51
+ var MetadataRequirement = /* @__PURE__ */ ((MetadataRequirement2) => {
52
+ MetadataRequirement2["BillingAddress"] = "billing_address";
53
+ MetadataRequirement2["CurrencyCode"] = "currency_code";
54
+ MetadataRequirement2["IovationBlackBox"] = "iovation_black_box";
55
+ MetadataRequirement2["Nickname"] = "nickname";
56
+ MetadataRequirement2["PaymentMethod"] = "payment_method";
57
+ MetadataRequirement2["PickupAddress"] = "pickup_address";
58
+ MetadataRequirement2["Unknown"] = "unknown";
59
+ return MetadataRequirement2;
60
+ })(MetadataRequirement || {});
61
+ var MetadataSatisfyingFormTypes = /* @__PURE__ */ ((MetadataSatisfyingFormTypes2) => {
62
+ MetadataSatisfyingFormTypes2["Address"] = "address";
63
+ MetadataSatisfyingFormTypes2["CreditCard"] = "credit_card";
64
+ MetadataSatisfyingFormTypes2["StampsAccountCredentials"] = "stamps_account_credentials";
65
+ MetadataSatisfyingFormTypes2["StampSellerLabelProvider"] = "stamps_seller_label_provider";
66
+ MetadataSatisfyingFormTypes2["Unknown"] = "unknown";
67
+ return MetadataSatisfyingFormTypes2;
68
+ })(MetadataSatisfyingFormTypes || {});
69
+
32
70
  var CreditCardVendor = /* @__PURE__ */ ((CreditCardVendor2) => {
33
71
  CreditCardVendor2["AMERICAN_EXPRESS"] = "americanexpress";
34
72
  CreditCardVendor2["DISCOVER"] = "discover";
@@ -86,6 +124,7 @@ var InsuranceProviderType = /* @__PURE__ */ ((InsuranceProviderType2) => {
86
124
 
87
125
  const types = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
88
126
  __proto__: null,
127
+ AccountBillingPlanChangeType,
89
128
  CodedError,
90
129
  ConfirmationType,
91
130
  CreditCardVendor,
@@ -93,6 +132,9 @@ const types = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
93
132
  CustomsContentsType,
94
133
  CustomsNonDeliveryType,
95
134
  InsuranceProviderType,
135
+ MetadataCapability,
136
+ MetadataRequirement,
137
+ MetadataSatisfyingFormTypes,
96
138
  RateCardStatus
97
139
  }, Symbol.toStringTag, { value: 'Module' }));
98
140
 
@@ -3351,6 +3393,13 @@ class FundingSourcesAPI {
3351
3393
  amount
3352
3394
  );
3353
3395
  });
3396
+ /**
3397
+ * The `metadata` method returns seller-specific requirements for creating funding sources
3398
+ * and attaching carriers
3399
+ */
3400
+ this.metadata = () => __async$2(this, null, function* () {
3401
+ return yield this.client.get("/v1/funding_sources/metadata");
3402
+ });
3354
3403
  this.client = client;
3355
3404
  }
3356
3405
  }
@@ -3988,4 +4037,4 @@ class ShipEngineAPI {
3988
4037
  }
3989
4038
  }
3990
4039
 
3991
- export { AccountSettingsAPI, AddressesAPI, CarriersAPI, CodedError, ConfirmationType, CreditCardVendor, Currency, CustomPackagesAPI, CustomsContentsType, CustomsNonDeliveryType, FundingSourcesAPI, InsuranceAPI, InsuranceProviderType, LabelsAPI, OrderSourcesAPI, RateCardStatus, RateCardsAPI, RatesAPI, types as SE, SalesOrderShipmentsAPI, SalesOrdersAPI, ShipEngineAPI, ShipmentsAPI, ShippingRulesAPI, WarehousesAPI, getEndUserIpAddress, isCodedError, isCodedErrors };
4040
+ export { AccountSettingsAPI, AddressesAPI, CarriersAPI, CodedError, ConfirmationType, CreditCardVendor, Currency, CustomPackagesAPI, CustomsContentsType, CustomsNonDeliveryType, FundingSourcesAPI, InsuranceAPI, InsuranceProviderType, LabelsAPI, MetadataCapability, MetadataRequirement, MetadataSatisfyingFormTypes, OrderSourcesAPI, RateCardStatus, RateCardsAPI, RatesAPI, types as SE, SalesOrderShipmentsAPI, SalesOrdersAPI, ShipEngineAPI, ShipmentsAPI, ShippingRulesAPI, WarehousesAPI, getEndUserIpAddress, isCodedError, isCodedErrors };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/js-api",
3
- "version": "0.39.0",
3
+ "version": "0.40.0",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {
package/types.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export type RequiredFields<T, K extends keyof T> = T & Required<Pick<T, K>>;
2
2
  export * from "./account-settings/types";
3
+ export * from "./account-billing-plan/types";
3
4
  export * from "./addresses/types";
4
5
  export * from "./carriers/types";
5
6
  export * from "./custom-packages/types";