@shipengine/js-api 3.10.0 → 3.12.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.
@@ -0,0 +1,18 @@
1
+ import { AxiosInstance } from "axios";
2
+ import { CreateSessionRequest, CreateSessionResponse } from "./types";
3
+ /**
4
+ * # Auctane Pay API module - /internal/auctane_pay
5
+ *
6
+ * This module provides access to the Auctane Pay endpoints in ShipEngine API.
7
+ */
8
+ export declare class AuctanePayAPI {
9
+ private client;
10
+ constructor(client: AxiosInstance);
11
+ /**
12
+ * The `createSession` method creates a new payment session.
13
+ *
14
+ * @param request - The request object containing the session details
15
+ * @returns a promise that resolves to the created session
16
+ */
17
+ createSession: (request: CreateSessionRequest) => Promise<import("axios").AxiosResponse<CreateSessionResponse, any>>;
18
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./api";
2
+ export * from "./types";
@@ -0,0 +1,122 @@
1
+ /**
2
+ * @category Entities
3
+ * Note: This is similar to but distinct from the TransactionCategory in funding-sources
4
+ */
5
+ export type AuctanePayTransactionCategory = "add_funds" | "subscription" | "store";
6
+ /**
7
+ * @category Entities
8
+ */
9
+ export type AuctanePayPaymentMethod = "credit_card" | "pay_pal" | "pay_by_bank_us" | "pay_by_bank_eu";
10
+ /**
11
+ * @category Entities
12
+ */
13
+ export interface CreateSessionRequest {
14
+ /**
15
+ * URL to redirect after payment session completion
16
+ * @example "https://dashboard.shipengine.com/?sessionId=:id"
17
+ */
18
+ returnUrl?: string;
19
+ /**
20
+ * Category of the transaction
21
+ * @example "add_funds"
22
+ */
23
+ transactionCategory: AuctanePayTransactionCategory;
24
+ }
25
+ /**
26
+ * @category Entities
27
+ */
28
+ export interface PaymentMethodHolderAddress {
29
+ /**
30
+ * Account holder address
31
+ */
32
+ accountHolderAddress?: {
33
+ addressLine1: string;
34
+ addressLine2: string;
35
+ cityLocality: string;
36
+ countryCode: string;
37
+ postalCode: string;
38
+ stateProvince: string;
39
+ };
40
+ /**
41
+ * Account holder name
42
+ */
43
+ accountHolderName?: string;
44
+ /**
45
+ * The last four of the account number, this is only provided for bank accounts and card schemes.
46
+ */
47
+ accountNumberLastFour: string;
48
+ /**
49
+ * An account number preview, for a CC this is the last 4 digits, but shown like 1234.
50
+ * For an e-mail account it might be ay@auctane.com, etc.
51
+ */
52
+ accountNumberPreview: string;
53
+ /**
54
+ * If applicable/available, the current expiration we have on file for the payment method.
55
+ */
56
+ assignedPreferences: AuctanePayTransactionCategory[];
57
+ /**
58
+ * Date the payment method was last used. If the date it was last used is unavailable,
59
+ * this will be the date created/updated.
60
+ */
61
+ dateLastUsed: string;
62
+ /**
63
+ * If applicable/available, the current expiration we have on file for the payment method.
64
+ */
65
+ expiration: string;
66
+ /**
67
+ * The Payment Method ID
68
+ */
69
+ id: string;
70
+ /**
71
+ * The nickname of the payment method
72
+ */
73
+ nickname: string;
74
+ /**
75
+ * Enumeration of supported payment methods.
76
+ */
77
+ paymentMethod: "Unknown" | "Visa" | "Mastercard" | "Amex" | "Discover" | "Maestro" | "DinersClub" | "ACH" | "JCB" | "Pulse" | "Star" | "UnionPay";
78
+ /**
79
+ * The Display Name to show in any text based UI/context for the Logo.
80
+ */
81
+ paymentMethodDisplayName: string;
82
+ /**
83
+ * Source account ID
84
+ */
85
+ sourceAccountId: string;
86
+ }
87
+ /**
88
+ * @category Entities
89
+ */
90
+ export interface CreateSessionResponse {
91
+ /**
92
+ * Active payment methods
93
+ */
94
+ activePaymentMethods: PaymentMethodHolderAddress[];
95
+ /**
96
+ * Client key
97
+ */
98
+ clientKey: string;
99
+ /**
100
+ * Eligible payment method types
101
+ */
102
+ eligiblePaymentMethodTypes: AuctanePayPaymentMethod[];
103
+ /**
104
+ * The Auctane Pay Internal Session ID, use this ID to request the result of this session
105
+ * and payment methods created from it.
106
+ */
107
+ id: string;
108
+ /**
109
+ * Metadata
110
+ */
111
+ metadata: {
112
+ [key: string]: string;
113
+ };
114
+ /**
115
+ * Recent payment methods
116
+ */
117
+ recentPaymentMethods: PaymentMethodHolderAddress[];
118
+ /** @deprecated */
119
+ sessionData: string;
120
+ /** @deprecated */
121
+ sessionId: string;
122
+ }
package/client.d.ts CHANGED
@@ -2,6 +2,7 @@ import { AxiosError, AxiosRequestHeaders } from "axios";
2
2
  import { AccountBillingPlanAPI } from "./account-billing-plan";
3
3
  import { AccountSettingsAPI } from "./account-settings";
4
4
  import { AddressesAPI } from "./addresses";
5
+ import { AuctanePayAPI } from "./auctane-pay";
5
6
  import { CarriersAPI } from "./carriers";
6
7
  import { ConnectionsAPI } from "./connections";
7
8
  import { CustomPackagesAPI } from "./custom-packages";
@@ -238,4 +239,11 @@ export declare class ShipEngineAPI {
238
239
  * @see {@link SellersAPI | The Sellers API module}
239
240
  */
240
241
  get sellers(): SellersAPI;
242
+ /**
243
+ * The `auctanePay` method provides access to the Auctane Pay endpoints in ShipEngine
244
+ * API. e.g. Create Payment Session
245
+ *
246
+ * @see {@link AuctanePayAPI | The Auctane Pay API module}
247
+ */
248
+ get auctanePay(): AuctanePayAPI;
241
249
  }
@@ -131,12 +131,14 @@ export declare enum MetadataRequirement {
131
131
  Nickname = "nickname",
132
132
  PaymentMethod = "payment_method",
133
133
  PickupAddress = "pickup_address",
134
+ RequestActivation = "request_activation",
134
135
  Unknown = "unknown"
135
136
  }
136
137
  /** @internal */
137
138
  export declare enum MetadataSatisfyingFormTypes {
138
139
  Address = "address",
139
140
  CreditCard = "credit_card",
141
+ ExplicitIntent = "explicit_intent",
140
142
  StampsAccountCredentials = "stamps_account_credentials",
141
143
  StampsSellerLabelProvider = "stamps_seller_label_provider",
142
144
  Unknown = "unknown"
package/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * as SE from "./types";
2
2
  export * from "./account-settings";
3
3
  export * from "./addresses";
4
+ export * from "./auctane-pay";
4
5
  export * from "./carriers";
5
6
  export * from "./connections";
6
7
  export * from "./client";
package/index.js CHANGED
@@ -59,12 +59,14 @@ var MetadataRequirement = /* @__PURE__ */ ((MetadataRequirement2) => {
59
59
  MetadataRequirement2["Nickname"] = "nickname";
60
60
  MetadataRequirement2["PaymentMethod"] = "payment_method";
61
61
  MetadataRequirement2["PickupAddress"] = "pickup_address";
62
+ MetadataRequirement2["RequestActivation"] = "request_activation";
62
63
  MetadataRequirement2["Unknown"] = "unknown";
63
64
  return MetadataRequirement2;
64
65
  })(MetadataRequirement || {});
65
66
  var MetadataSatisfyingFormTypes = /* @__PURE__ */ ((MetadataSatisfyingFormTypes2) => {
66
67
  MetadataSatisfyingFormTypes2["Address"] = "address";
67
68
  MetadataSatisfyingFormTypes2["CreditCard"] = "credit_card";
69
+ MetadataSatisfyingFormTypes2["ExplicitIntent"] = "explicit_intent";
68
70
  MetadataSatisfyingFormTypes2["StampsAccountCredentials"] = "stamps_account_credentials";
69
71
  MetadataSatisfyingFormTypes2["StampsSellerLabelProvider"] = "stamps_seller_label_provider";
70
72
  MetadataSatisfyingFormTypes2["Unknown"] = "unknown";
@@ -238,6 +240,22 @@ class AddressesAPI {
238
240
  }
239
241
  }
240
242
 
243
+ class AuctanePayAPI {
244
+ constructor(client) {
245
+ this.client = client;
246
+ /**
247
+ * The `createSession` method creates a new payment session.
248
+ *
249
+ * @param request - The request object containing the session details
250
+ * @returns a promise that resolves to the created session
251
+ */
252
+ this.createSession = (request) => {
253
+ return this.client.post("/internal/auctane_pay/sessions", request);
254
+ };
255
+ this.client = client;
256
+ }
257
+ }
258
+
241
259
  const isCodedErrors = (errs) => Array.isArray(errs) && errs.every((err) => isCodedError(err));
242
260
  const isCodedError = (err) => !!err.errorCode;
243
261
  const isDataCodedErrors = (data) => !!data.errors && isCodedErrors(data.errors);
@@ -21895,10 +21913,20 @@ class ShipEngineAPI {
21895
21913
  get sellers() {
21896
21914
  return new SellersAPI(this.client);
21897
21915
  }
21916
+ /**
21917
+ * The `auctanePay` method provides access to the Auctane Pay endpoints in ShipEngine
21918
+ * API. e.g. Create Payment Session
21919
+ *
21920
+ * @see {@link AuctanePayAPI | The Auctane Pay API module}
21921
+ */
21922
+ get auctanePay() {
21923
+ return new AuctanePayAPI(this.client);
21924
+ }
21898
21925
  }
21899
21926
 
21900
21927
  exports.AccountSettingsAPI = AccountSettingsAPI;
21901
21928
  exports.AddressesAPI = AddressesAPI;
21929
+ exports.AuctanePayAPI = AuctanePayAPI;
21902
21930
  exports.CarriersAPI = CarriersAPI;
21903
21931
  exports.CodedError = CodedError;
21904
21932
  exports.ConfirmationType = ConfirmationType;
package/index.mjs CHANGED
@@ -55,12 +55,14 @@ var MetadataRequirement = /* @__PURE__ */ ((MetadataRequirement2) => {
55
55
  MetadataRequirement2["Nickname"] = "nickname";
56
56
  MetadataRequirement2["PaymentMethod"] = "payment_method";
57
57
  MetadataRequirement2["PickupAddress"] = "pickup_address";
58
+ MetadataRequirement2["RequestActivation"] = "request_activation";
58
59
  MetadataRequirement2["Unknown"] = "unknown";
59
60
  return MetadataRequirement2;
60
61
  })(MetadataRequirement || {});
61
62
  var MetadataSatisfyingFormTypes = /* @__PURE__ */ ((MetadataSatisfyingFormTypes2) => {
62
63
  MetadataSatisfyingFormTypes2["Address"] = "address";
63
64
  MetadataSatisfyingFormTypes2["CreditCard"] = "credit_card";
65
+ MetadataSatisfyingFormTypes2["ExplicitIntent"] = "explicit_intent";
64
66
  MetadataSatisfyingFormTypes2["StampsAccountCredentials"] = "stamps_account_credentials";
65
67
  MetadataSatisfyingFormTypes2["StampsSellerLabelProvider"] = "stamps_seller_label_provider";
66
68
  MetadataSatisfyingFormTypes2["Unknown"] = "unknown";
@@ -234,6 +236,22 @@ class AddressesAPI {
234
236
  }
235
237
  }
236
238
 
239
+ class AuctanePayAPI {
240
+ constructor(client) {
241
+ this.client = client;
242
+ /**
243
+ * The `createSession` method creates a new payment session.
244
+ *
245
+ * @param request - The request object containing the session details
246
+ * @returns a promise that resolves to the created session
247
+ */
248
+ this.createSession = (request) => {
249
+ return this.client.post("/internal/auctane_pay/sessions", request);
250
+ };
251
+ this.client = client;
252
+ }
253
+ }
254
+
237
255
  const isCodedErrors = (errs) => Array.isArray(errs) && errs.every((err) => isCodedError(err));
238
256
  const isCodedError = (err) => !!err.errorCode;
239
257
  const isDataCodedErrors = (data) => !!data.errors && isCodedErrors(data.errors);
@@ -21891,6 +21909,15 @@ class ShipEngineAPI {
21891
21909
  get sellers() {
21892
21910
  return new SellersAPI(this.client);
21893
21911
  }
21912
+ /**
21913
+ * The `auctanePay` method provides access to the Auctane Pay endpoints in ShipEngine
21914
+ * API. e.g. Create Payment Session
21915
+ *
21916
+ * @see {@link AuctanePayAPI | The Auctane Pay API module}
21917
+ */
21918
+ get auctanePay() {
21919
+ return new AuctanePayAPI(this.client);
21920
+ }
21894
21921
  }
21895
21922
 
21896
- export { AccountSettingsAPI, AddressesAPI, CarriersAPI, CodedError, ConfirmationType, ConnectionsAPI, CreditCardVendor, Currency, CustomPackagesAPI, CustomsContentsType, CustomsNonDeliveryType, FundingSourcesAPI, InsuranceAPI, InsuranceProviderType, InvoiceAddressAPI, LabelsAPI, MetadataCapability, MetadataRequirement, MetadataSatisfyingFormTypes, MovementIndicator, OrderSourcesAPI, RateCardStatus, RateCardsAPI, RatesAPI, types as SE, SalesOrderShipmentsAPI, SalesOrdersAPI, SellersAPI, ServicePointsAPI, ShipEngineAPI, ShipmentsAPI, ShippingRulesAPI, ThemesAPI, WarehousesAPI, WebhooksAPI, camelizeKeys, decamelizeKeys, getEndUserIpAddress, isCodedError, isCodedErrors, isDataCodedErrors, isInvalidTokenError, parseError };
21923
+ export { AccountSettingsAPI, AddressesAPI, AuctanePayAPI, CarriersAPI, CodedError, ConfirmationType, ConnectionsAPI, CreditCardVendor, Currency, CustomPackagesAPI, CustomsContentsType, CustomsNonDeliveryType, FundingSourcesAPI, InsuranceAPI, InsuranceProviderType, InvoiceAddressAPI, LabelsAPI, MetadataCapability, MetadataRequirement, MetadataSatisfyingFormTypes, MovementIndicator, OrderSourcesAPI, RateCardStatus, RateCardsAPI, RatesAPI, types as SE, SalesOrderShipmentsAPI, SalesOrdersAPI, SellersAPI, ServicePointsAPI, ShipEngineAPI, ShipmentsAPI, ShippingRulesAPI, ThemesAPI, WarehousesAPI, WebhooksAPI, camelizeKeys, decamelizeKeys, getEndUserIpAddress, isCodedError, isCodedErrors, isDataCodedErrors, isInvalidTokenError, parseError };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/js-api",
3
- "version": "3.10.0",
3
+ "version": "3.12.0",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {
package/types.d.ts CHANGED
@@ -2,6 +2,7 @@ export type RequiredFields<T, K extends keyof T> = T & Required<Pick<T, K>>;
2
2
  export * from "./account-settings/types";
3
3
  export * from "./account-billing-plan/types";
4
4
  export * from "./addresses/types";
5
+ export * from "./auctane-pay/types";
5
6
  export * from "./carriers/types";
6
7
  export * from "./connections/types";
7
8
  export * from "./custom-packages/types";