@shipengine/js-api 3.11.0 → 3.12.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.
@@ -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,137 @@
1
+ /**
2
+ * @category Entities
3
+ * Auctane Pay Session can return a lot of metadata, but will always returns the same 5 keys.
4
+ */
5
+ export interface AuctanePaySessionMetadata {
6
+ [key: string]: string;
7
+ adyenClientKey: string;
8
+ adyenExpiration: string;
9
+ adyenSessionData: string;
10
+ adyenSessionId: string;
11
+ clientKey: string;
12
+ }
13
+ /**
14
+ * @category Entities
15
+ * Allowed Payment Method for AuctanePay
16
+ */
17
+ export type AuctanePayPaymentMethod = "credit_card" | "pay_pal" | "stamps" | "pay_by_bank_us" | "pay_by_bank_eu";
18
+ /**
19
+ * @category Entities
20
+ * Note: This is similar to but distinct from the TransactionCategory in funding-sources
21
+ */
22
+ export type AuctanePayTransactionCategory = "add_funds" | "subscription" | "store";
23
+ /**
24
+ * @category Entities
25
+ */
26
+ export interface CreateSessionRequest {
27
+ /**
28
+ * URL to redirect after payment session completion
29
+ * @example "https://dashboard.shipengine.com/?sessionId=:id"
30
+ */
31
+ returnUrl?: string;
32
+ /**
33
+ * Category of the transaction
34
+ * @example "add_funds"
35
+ */
36
+ transactionCategory: AuctanePayTransactionCategory;
37
+ }
38
+ /**
39
+ * @category Entities
40
+ */
41
+ export interface PaymentMethodHolderAddress {
42
+ /**
43
+ * Account holder address
44
+ */
45
+ accountHolderAddress: {
46
+ addressLine1: string;
47
+ addressLine2: string | null;
48
+ cityLocality: string;
49
+ countryCode: string;
50
+ postalCode: string;
51
+ stateProvince: string;
52
+ } | null;
53
+ /**
54
+ * Account holder name
55
+ */
56
+ accountHolderName: string | null;
57
+ /**
58
+ * The last four of the account number, this is only provided for bank accounts and card schemes.
59
+ */
60
+ accountNumberLastFour: string;
61
+ /**
62
+ * An account number preview, for a CC this is the last 4 digits, but shown like 1234.
63
+ * For an e-mail account it might be ay@auctane.com, etc.
64
+ */
65
+ accountNumberPreview: string;
66
+ /**
67
+ * If applicable/available, the current expiration we have on file for the payment method.
68
+ */
69
+ assignedPreferences: AuctanePayTransactionCategory[];
70
+ /**
71
+ * Date the payment method was last used. If the date it was last used is unavailable,
72
+ * this will be the date created/updated.
73
+ */
74
+ dateLastUsed: string;
75
+ /**
76
+ * List of processes or payment gateways in which this Payment Method is registered
77
+ */
78
+ enrolledProcessors: string[];
79
+ /**
80
+ * If applicable/available, the current expiration we have on file for the payment method.
81
+ */
82
+ expiration: string;
83
+ /**
84
+ * The Payment Method ID
85
+ */
86
+ id: string;
87
+ /**
88
+ * The nickname of the payment method
89
+ */
90
+ nickname: string;
91
+ /**
92
+ * Enumeration of supported payment methods.
93
+ */
94
+ paymentMethod: "unknown" | "visa" | "mastercard" | "amex" | "discover" | "maestro" | "dinersclub" | "ach" | "jcb" | "pulse" | "star" | "unionpay";
95
+ /**
96
+ * The Display Name to show in any text based UI/context for the Logo.
97
+ */
98
+ paymentMethodDisplayName: string;
99
+ /**
100
+ * Source account ID
101
+ */
102
+ sourceAccountId: string;
103
+ }
104
+ /**
105
+ * @category Entities
106
+ */
107
+ export interface CreateSessionResponse {
108
+ /**
109
+ * Active payment methods
110
+ */
111
+ activePaymentMethods: PaymentMethodHolderAddress[];
112
+ /**
113
+ * Client key
114
+ */
115
+ clientKey: string;
116
+ /**
117
+ * Eligible payment method types
118
+ */
119
+ eligiblePaymentMethodTypes: AuctanePayPaymentMethod[];
120
+ /**
121
+ * The Auctane Pay Internal Session ID, use this ID to request the result of this session
122
+ * and payment methods created from it.
123
+ */
124
+ id: string;
125
+ /**
126
+ * Metadata
127
+ */
128
+ metadata: AuctanePaySessionMetadata;
129
+ /**
130
+ * Recent payment methods
131
+ */
132
+ recentPaymentMethods: PaymentMethodHolderAddress[];
133
+ /** @deprecated */
134
+ sessionData: string;
135
+ /** @deprecated */
136
+ sessionId: string;
137
+ }
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
  }
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
@@ -240,6 +240,22 @@ class AddressesAPI {
240
240
  }
241
241
  }
242
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
+
243
259
  const isCodedErrors = (errs) => Array.isArray(errs) && errs.every((err) => isCodedError(err));
244
260
  const isCodedError = (err) => !!err.errorCode;
245
261
  const isDataCodedErrors = (data) => !!data.errors && isCodedErrors(data.errors);
@@ -21897,10 +21913,20 @@ class ShipEngineAPI {
21897
21913
  get sellers() {
21898
21914
  return new SellersAPI(this.client);
21899
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
+ }
21900
21925
  }
21901
21926
 
21902
21927
  exports.AccountSettingsAPI = AccountSettingsAPI;
21903
21928
  exports.AddressesAPI = AddressesAPI;
21929
+ exports.AuctanePayAPI = AuctanePayAPI;
21904
21930
  exports.CarriersAPI = CarriersAPI;
21905
21931
  exports.CodedError = CodedError;
21906
21932
  exports.ConfirmationType = ConfirmationType;
package/index.mjs CHANGED
@@ -236,6 +236,22 @@ class AddressesAPI {
236
236
  }
237
237
  }
238
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
+
239
255
  const isCodedErrors = (errs) => Array.isArray(errs) && errs.every((err) => isCodedError(err));
240
256
  const isCodedError = (err) => !!err.errorCode;
241
257
  const isDataCodedErrors = (data) => !!data.errors && isCodedErrors(data.errors);
@@ -21893,6 +21909,15 @@ class ShipEngineAPI {
21893
21909
  get sellers() {
21894
21910
  return new SellersAPI(this.client);
21895
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
+ }
21896
21921
  }
21897
21922
 
21898
- 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.11.0",
3
+ "version": "3.12.1",
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";