@shipengine/js-api 4.6.1 → 4.7.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.
- package/auctane-pay/api.d.ts +8 -1
- package/auctane-pay/types.d.ts +81 -50
- package/index.js +12 -0
- package/index.mjs +12 -0
- package/package.json +1 -1
package/auctane-pay/api.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosInstance } from "axios";
|
|
2
|
-
import { ConfigResponse, CreateSessionRequest, CreateSessionResponse } from "./types";
|
|
2
|
+
import { ConfigResponse, CreateSessionRequest, CreateSessionResponse, PreviewTransactionRequest, PreviewTransactionResponse } from "./types";
|
|
3
3
|
/**
|
|
4
4
|
* # Auctane Pay API module - /v1/payments
|
|
5
5
|
*
|
|
@@ -21,4 +21,11 @@ export declare class AuctanePayAPI {
|
|
|
21
21
|
* @returns a promise that returns the AuctanePay config
|
|
22
22
|
*/
|
|
23
23
|
getConfig: () => Promise<import("axios").AxiosResponse<ConfigResponse, any>>;
|
|
24
|
+
/**
|
|
25
|
+
* The `previewTransaction` method previews transaction costs including fees and surcharges
|
|
26
|
+
* @docs https://auctane-pay-dev.kubedev.sslocal.com/swagger/index.html#tag/Transactions
|
|
27
|
+
* @param request - The request object containing amount and transaction category
|
|
28
|
+
* @returns a promise that resolves to the transaction preview with fees
|
|
29
|
+
*/
|
|
30
|
+
previewTransaction: (request: PreviewTransactionRequest) => Promise<import("axios").AxiosResponse<PreviewTransactionResponse, any>>;
|
|
24
31
|
}
|
package/auctane-pay/types.d.ts
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @category Entities
|
|
3
|
-
* Auctane Pay Session can return a lot of metadata,
|
|
3
|
+
* Auctane Pay Session can return a lot of metadata,
|
|
4
|
+
* but will always returns the same 5 keys.
|
|
4
5
|
*/
|
|
5
6
|
export interface AuctanePaySessionMetadata {
|
|
6
7
|
[key: string]: string;
|
|
8
|
+
/** Adyen client key */
|
|
7
9
|
adyenClientKey: string;
|
|
10
|
+
/** Adyen expiration */
|
|
8
11
|
adyenExpiration: string;
|
|
12
|
+
/** Adyen session data */
|
|
9
13
|
adyenSessionData: string;
|
|
14
|
+
/** Adyen session ID */
|
|
10
15
|
adyenSessionId: string;
|
|
16
|
+
/** Client key */
|
|
11
17
|
clientKey: string;
|
|
12
18
|
}
|
|
13
19
|
/**
|
|
@@ -39,9 +45,7 @@ export interface CreateSessionRequest {
|
|
|
39
45
|
* @category Entities
|
|
40
46
|
*/
|
|
41
47
|
export interface PaymentMethodHolderAddress {
|
|
42
|
-
/**
|
|
43
|
-
* Account holder address
|
|
44
|
-
*/
|
|
48
|
+
/** Account holder address */
|
|
45
49
|
accountHolderAddress: {
|
|
46
50
|
addressLine1: string;
|
|
47
51
|
addressLine2: string | null;
|
|
@@ -50,55 +54,44 @@ export interface PaymentMethodHolderAddress {
|
|
|
50
54
|
postalCode: string;
|
|
51
55
|
stateProvince: string;
|
|
52
56
|
} | null;
|
|
53
|
-
/**
|
|
54
|
-
* Account holder name
|
|
55
|
-
*/
|
|
57
|
+
/** Account holder name */
|
|
56
58
|
accountHolderName: string | null;
|
|
57
|
-
/**
|
|
58
|
-
*
|
|
59
|
+
/** The last four of the account number, this is only
|
|
60
|
+
* provided for bank accounts and card schemes.
|
|
59
61
|
*/
|
|
60
62
|
accountNumberLastFour: string;
|
|
61
|
-
/**
|
|
62
|
-
* An account number preview, for a CC this is the last 4 digits, but shown like 1234.
|
|
63
|
+
/** An account number preview, for a CC this is the last 4 digits, but shown like 1234.
|
|
63
64
|
* For an e-mail account it might be ay@auctane.com, etc.
|
|
64
65
|
*/
|
|
65
66
|
accountNumberPreview: string;
|
|
66
|
-
/**
|
|
67
|
-
*
|
|
67
|
+
/** If applicable/available, the current expiration
|
|
68
|
+
* we have on file for the payment method.
|
|
68
69
|
*/
|
|
69
70
|
assignedPreferences: AuctanePayTransactionCategory[];
|
|
70
|
-
/**
|
|
71
|
-
*
|
|
71
|
+
/** Date the payment method was last used.
|
|
72
|
+
* If the date it was last used is unavailable,
|
|
72
73
|
* this will be the date created/updated.
|
|
73
74
|
*/
|
|
74
75
|
dateLastUsed: string;
|
|
75
|
-
/**
|
|
76
|
-
*
|
|
76
|
+
/** List of processes or payment gateways
|
|
77
|
+
* in which this Payment Method is registered
|
|
77
78
|
*/
|
|
78
79
|
enrolledProcessors: string[];
|
|
79
|
-
/**
|
|
80
|
-
*
|
|
80
|
+
/** If applicable/available, the current expiration
|
|
81
|
+
* we have on file for the payment method.
|
|
81
82
|
*/
|
|
82
83
|
expiration: string;
|
|
83
|
-
/**
|
|
84
|
-
* The Payment Method ID
|
|
85
|
-
*/
|
|
84
|
+
/** The Payment Method ID */
|
|
86
85
|
id: string;
|
|
87
|
-
/**
|
|
88
|
-
* The nickname of the payment method
|
|
89
|
-
*/
|
|
86
|
+
/** The nickname of the payment method */
|
|
90
87
|
nickname: string;
|
|
91
|
-
/**
|
|
92
|
-
* Enumeration of supported payment methods.
|
|
93
|
-
*/
|
|
88
|
+
/** Enumeration of supported payment methods. */
|
|
94
89
|
paymentMethod: "unknown" | "visa" | "mastercard" | "amex" | "discover" | "maestro" | "dinersclub" | "ach" | "jcb" | "pulse" | "star" | "unionpay";
|
|
95
|
-
/**
|
|
96
|
-
*
|
|
90
|
+
/** The Display Name to show in any text
|
|
91
|
+
* based UI/context for the Logo.
|
|
97
92
|
*/
|
|
98
93
|
paymentMethodDisplayName: string;
|
|
99
|
-
/**
|
|
100
|
-
* Source account ID
|
|
101
|
-
*/
|
|
94
|
+
/** Source account ID */
|
|
102
95
|
sourceAccountId: string;
|
|
103
96
|
}
|
|
104
97
|
/**
|
|
@@ -111,33 +104,71 @@ export interface ConfigResponse {
|
|
|
111
104
|
* @category Entities
|
|
112
105
|
*/
|
|
113
106
|
export interface CreateSessionResponse {
|
|
114
|
-
/**
|
|
115
|
-
* Active payment methods
|
|
116
|
-
*/
|
|
107
|
+
/** Active payment methods */
|
|
117
108
|
activePaymentMethods: PaymentMethodHolderAddress[];
|
|
118
|
-
/**
|
|
119
|
-
* Client key
|
|
120
|
-
*/
|
|
109
|
+
/** Client key */
|
|
121
110
|
clientKey: string;
|
|
122
|
-
/**
|
|
123
|
-
* Eligible payment method types
|
|
124
|
-
*/
|
|
111
|
+
/** Eligible payment method types */
|
|
125
112
|
eligiblePaymentMethodTypes: AuctanePayPaymentMethod[];
|
|
126
|
-
/**
|
|
127
|
-
*
|
|
113
|
+
/** The Auctane Pay Internal Session ID,
|
|
114
|
+
* use this ID to request the result of this session
|
|
128
115
|
* and payment methods created from it.
|
|
129
116
|
*/
|
|
130
117
|
id: string;
|
|
131
|
-
/**
|
|
132
|
-
* Metadata
|
|
133
|
-
*/
|
|
118
|
+
/** Metadata */
|
|
134
119
|
metadata: AuctanePaySessionMetadata;
|
|
135
|
-
/**
|
|
136
|
-
* Recent payment methods
|
|
137
|
-
*/
|
|
120
|
+
/** Recent payment methods */
|
|
138
121
|
recentPaymentMethods: PaymentMethodHolderAddress[];
|
|
139
122
|
/** @deprecated */
|
|
140
123
|
sessionData: string;
|
|
141
124
|
/** @deprecated */
|
|
142
125
|
sessionId: string;
|
|
143
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* @category Entities
|
|
129
|
+
* Request body for preview transaction endpoint
|
|
130
|
+
*/
|
|
131
|
+
export interface PreviewTransactionRequest {
|
|
132
|
+
/** Transaction amount */
|
|
133
|
+
amount: number;
|
|
134
|
+
/** Category of the transaction */
|
|
135
|
+
transactionCategory: AuctanePayTransactionCategory;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* @category Entities
|
|
139
|
+
* Money amount with currency
|
|
140
|
+
*/
|
|
141
|
+
export interface MoneyAmount {
|
|
142
|
+
/** Amount value */
|
|
143
|
+
amount: number;
|
|
144
|
+
/** Currency code */
|
|
145
|
+
currencyCode: string;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* @category Entities
|
|
149
|
+
* Fee information for a transaction
|
|
150
|
+
*/
|
|
151
|
+
export interface TransactionFee {
|
|
152
|
+
/** Fee amount */
|
|
153
|
+
amount: number;
|
|
154
|
+
/** Fee percentage */
|
|
155
|
+
percentage: number;
|
|
156
|
+
/** Fee type */
|
|
157
|
+
type: string;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* @category Entities
|
|
161
|
+
* Response from preview transaction endpoint
|
|
162
|
+
*/
|
|
163
|
+
export interface PreviewTransactionResponse {
|
|
164
|
+
/** Total transaction amount */
|
|
165
|
+
amount: MoneyAmount;
|
|
166
|
+
/** Base amount before fees */
|
|
167
|
+
baseAmount: MoneyAmount;
|
|
168
|
+
/** Array of fee details */
|
|
169
|
+
fees: TransactionFee[];
|
|
170
|
+
/** Total transaction fee */
|
|
171
|
+
totalTransactionFee: MoneyAmount;
|
|
172
|
+
/** Transaction currency code */
|
|
173
|
+
transactionCurrencyCode: string;
|
|
174
|
+
}
|
package/index.js
CHANGED
|
@@ -260,6 +260,18 @@ class AuctanePayAPI {
|
|
|
260
260
|
this.getConfig = () => {
|
|
261
261
|
return this.client.get("/v1/payments/config");
|
|
262
262
|
};
|
|
263
|
+
/**
|
|
264
|
+
* The `previewTransaction` method previews transaction costs including fees and surcharges
|
|
265
|
+
* @docs https://auctane-pay-dev.kubedev.sslocal.com/swagger/index.html#tag/Transactions
|
|
266
|
+
* @param request - The request object containing amount and transaction category
|
|
267
|
+
* @returns a promise that resolves to the transaction preview with fees
|
|
268
|
+
*/
|
|
269
|
+
this.previewTransaction = (request) => {
|
|
270
|
+
return this.client.post(
|
|
271
|
+
"/v1/payments/transaction/preview",
|
|
272
|
+
request
|
|
273
|
+
);
|
|
274
|
+
};
|
|
263
275
|
this.client = client;
|
|
264
276
|
}
|
|
265
277
|
}
|
package/index.mjs
CHANGED
|
@@ -256,6 +256,18 @@ class AuctanePayAPI {
|
|
|
256
256
|
this.getConfig = () => {
|
|
257
257
|
return this.client.get("/v1/payments/config");
|
|
258
258
|
};
|
|
259
|
+
/**
|
|
260
|
+
* The `previewTransaction` method previews transaction costs including fees and surcharges
|
|
261
|
+
* @docs https://auctane-pay-dev.kubedev.sslocal.com/swagger/index.html#tag/Transactions
|
|
262
|
+
* @param request - The request object containing amount and transaction category
|
|
263
|
+
* @returns a promise that resolves to the transaction preview with fees
|
|
264
|
+
*/
|
|
265
|
+
this.previewTransaction = (request) => {
|
|
266
|
+
return this.client.post(
|
|
267
|
+
"/v1/payments/transaction/preview",
|
|
268
|
+
request
|
|
269
|
+
);
|
|
270
|
+
};
|
|
259
271
|
this.client = client;
|
|
260
272
|
}
|
|
261
273
|
}
|