@revenexx/sdk 0.0.4 → 0.0.6
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/dist/cjs/sdk.js +13491 -6163
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +13464 -6162
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +13491 -6163
- package/package.json +1 -1
- package/src/client.ts +1 -1
- package/src/enums/address-type.ts +4 -0
- package/src/enums/cart-export-format.ts +4 -0
- package/src/enums/cart-io-apply-mode.ts +5 -0
- package/src/enums/cart-io-direction.ts +4 -0
- package/src/enums/cart-io-entity.ts +4 -0
- package/src/enums/cart-io-format.ts +4 -0
- package/src/enums/cart-item-type.ts +5 -0
- package/src/enums/channel-status.ts +4 -0
- package/src/enums/channel-type.ts +7 -0
- package/src/enums/contact-role.ts +6 -0
- package/src/enums/contact-status.ts +5 -0
- package/src/enums/location-type.ts +6 -0
- package/src/enums/market-status.ts +4 -0
- package/src/enums/order-comment-visibility.ts +4 -0
- package/src/enums/order-item-type.ts +5 -0
- package/src/enums/order-list-kind.ts +4 -0
- package/src/enums/order-payment-status.ts +9 -0
- package/src/enums/organization-status.ts +4 -0
- package/src/enums/page-status.ts +5 -0
- package/src/enums/payment-fee-type.ts +5 -0
- package/src/enums/payment-method-kind.ts +4 -0
- package/src/enums/price-entry-type.ts +4 -0
- package/src/enums/price-list-status.ts +4 -0
- package/src/enums/shipping-method-matrix-basis.ts +6 -0
- package/src/enums/shipping-method-pricing-type.ts +5 -0
- package/src/enums/store-asset-request-visibility.ts +4 -0
- package/src/enums/visibility.ts +4 -0
- package/src/index.ts +28 -2
- package/src/models.ts +5309 -1009
- package/src/services/apps.ts +154 -154
- package/src/services/avatars.ts +57 -57
- package/src/services/carts.ts +739 -104
- package/src/services/channels.ts +147 -19
- package/src/services/customers.ts +809 -69
- package/src/services/greetings.ts +18 -18
- package/src/services/inventories.ts +620 -65
- package/src/services/locale.ts +16 -16
- package/src/services/markets.ts +690 -75
- package/src/services/messaging.ts +273 -273
- package/src/services/orderlists.ts +889 -0
- package/src/services/orders.ts +692 -137
- package/src/services/pages.ts +661 -155
- package/src/services/payments.ts +591 -64
- package/src/services/prices.ts +585 -59
- package/src/services/products.ts +1908 -272
- package/src/services/search.ts +24 -24
- package/src/services/shipping.ts +451 -59
- package/src/services/sites.ts +116 -116
- package/src/services/storage.ts +933 -599
- package/src/services/tokens.ts +14 -14
- package/types/enums/address-type.d.ts +4 -0
- package/types/enums/cart-export-format.d.ts +4 -0
- package/types/enums/cart-io-apply-mode.d.ts +5 -0
- package/types/enums/cart-io-direction.d.ts +4 -0
- package/types/enums/cart-io-entity.d.ts +4 -0
- package/types/enums/cart-io-format.d.ts +4 -0
- package/types/enums/cart-item-type.d.ts +5 -0
- package/types/enums/channel-status.d.ts +4 -0
- package/types/enums/channel-type.d.ts +7 -0
- package/types/enums/contact-role.d.ts +6 -0
- package/types/enums/contact-status.d.ts +5 -0
- package/types/enums/location-type.d.ts +6 -0
- package/types/enums/market-status.d.ts +4 -0
- package/types/enums/order-comment-visibility.d.ts +4 -0
- package/types/enums/order-item-type.d.ts +5 -0
- package/types/enums/order-list-kind.d.ts +4 -0
- package/types/enums/order-payment-status.d.ts +9 -0
- package/types/enums/organization-status.d.ts +4 -0
- package/types/enums/page-status.d.ts +5 -0
- package/types/enums/payment-fee-type.d.ts +5 -0
- package/types/enums/payment-method-kind.d.ts +4 -0
- package/types/enums/price-entry-type.d.ts +4 -0
- package/types/enums/price-list-status.d.ts +4 -0
- package/types/enums/shipping-method-matrix-basis.d.ts +6 -0
- package/types/enums/shipping-method-pricing-type.d.ts +5 -0
- package/types/enums/store-asset-request-visibility.d.ts +4 -0
- package/types/enums/visibility.d.ts +4 -0
- package/types/index.d.ts +28 -2
- package/types/models.d.ts +5170 -1010
- package/types/services/carts.d.ts +271 -12
- package/types/services/channels.d.ts +54 -2
- package/types/services/customers.d.ts +298 -12
- package/types/services/inventories.d.ts +225 -11
- package/types/services/markets.d.ts +235 -6
- package/types/services/orderlists.d.ts +324 -0
- package/types/services/orders.d.ts +238 -16
- package/types/services/pages.d.ts +190 -6
- package/types/services/payments.d.ts +221 -7
- package/types/services/prices.d.ts +218 -6
- package/types/services/products.d.ts +672 -32
- package/types/services/shipping.d.ts +168 -6
- package/types/services/storage.d.ts +353 -285
package/src/services/payments.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { Service } from '../service';
|
|
|
2
2
|
import { RevenexxException, Client, type Payload, UploadProgress } from '../client';
|
|
3
3
|
import type { Models } from '../models';
|
|
4
4
|
|
|
5
|
+
import { PaymentFeeType } from '../enums/payment-fee-type';
|
|
6
|
+
import { PaymentMethodKind } from '../enums/payment-method-kind';
|
|
5
7
|
|
|
6
8
|
export class Payments {
|
|
7
9
|
client: Client;
|
|
@@ -18,7 +20,7 @@ export class Payments {
|
|
|
18
20
|
paymentsList(): Promise<{}> {
|
|
19
21
|
|
|
20
22
|
const apiPath = '/v1/payments';
|
|
21
|
-
const
|
|
23
|
+
const apiPayload: Payload = {};
|
|
22
24
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
23
25
|
|
|
24
26
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -28,19 +30,116 @@ export class Payments {
|
|
|
28
30
|
'get',
|
|
29
31
|
uri,
|
|
30
32
|
apiHeaders,
|
|
31
|
-
|
|
33
|
+
apiPayload
|
|
32
34
|
);
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
/**
|
|
36
38
|
*
|
|
39
|
+
* @param {number} params.amount - Order amount — 0 is legal (free orders), negative is not.
|
|
40
|
+
* @param {string} params.methodCode - Code of a configured payment method.
|
|
41
|
+
* @param {string} params.cartId - The cart this payment pays for.
|
|
42
|
+
* @param {string} params.contactId - Paying customer contact.
|
|
43
|
+
* @param {string} params.country - Buyer ISO country code for the eligibility check.
|
|
44
|
+
* @param {string} params.currency - ISO 4217 code (default EUR).
|
|
45
|
+
* @param {string} params.idempotencyKey - Same key answers the same payment instead of a duplicate.
|
|
46
|
+
* @param {object} params.metadata - Free-form metadata.
|
|
47
|
+
* @param {string} params.orderRef - External order reference — also the webhook fallback key.
|
|
48
|
+
* @param {string} params.returnUrl - Where the PSP redirect flow returns the buyer to.
|
|
37
49
|
* @throws {RevenexxException}
|
|
38
50
|
* @returns {Promise<Models.Payment>}
|
|
39
51
|
*/
|
|
40
|
-
paymentsCreate(): Promise<Models.Payment
|
|
52
|
+
paymentsCreate(params: { amount: number, methodCode: string, cartId?: string, contactId?: string, country?: string, currency?: string, idempotencyKey?: string, metadata?: object, orderRef?: string, returnUrl?: string }): Promise<Models.Payment>;
|
|
53
|
+
/**
|
|
54
|
+
*
|
|
55
|
+
* @param {number} amount - Order amount — 0 is legal (free orders), negative is not.
|
|
56
|
+
* @param {string} methodCode - Code of a configured payment method.
|
|
57
|
+
* @param {string} cartId - The cart this payment pays for.
|
|
58
|
+
* @param {string} contactId - Paying customer contact.
|
|
59
|
+
* @param {string} country - Buyer ISO country code for the eligibility check.
|
|
60
|
+
* @param {string} currency - ISO 4217 code (default EUR).
|
|
61
|
+
* @param {string} idempotencyKey - Same key answers the same payment instead of a duplicate.
|
|
62
|
+
* @param {object} metadata - Free-form metadata.
|
|
63
|
+
* @param {string} orderRef - External order reference — also the webhook fallback key.
|
|
64
|
+
* @param {string} returnUrl - Where the PSP redirect flow returns the buyer to.
|
|
65
|
+
* @throws {RevenexxException}
|
|
66
|
+
* @returns {Promise<Models.Payment>}
|
|
67
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
68
|
+
*/
|
|
69
|
+
paymentsCreate(amount: number, methodCode: string, cartId?: string, contactId?: string, country?: string, currency?: string, idempotencyKey?: string, metadata?: object, orderRef?: string, returnUrl?: string): Promise<Models.Payment>;
|
|
70
|
+
paymentsCreate(
|
|
71
|
+
paramsOrFirst: { amount: number, methodCode: string, cartId?: string, contactId?: string, country?: string, currency?: string, idempotencyKey?: string, metadata?: object, orderRef?: string, returnUrl?: string } | number,
|
|
72
|
+
...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (object)?, (string)?, (string)?]
|
|
73
|
+
): Promise<Models.Payment> {
|
|
74
|
+
let params: { amount: number, methodCode: string, cartId?: string, contactId?: string, country?: string, currency?: string, idempotencyKey?: string, metadata?: object, orderRef?: string, returnUrl?: string };
|
|
75
|
+
|
|
76
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
77
|
+
params = (paramsOrFirst || {}) as { amount: number, methodCode: string, cartId?: string, contactId?: string, country?: string, currency?: string, idempotencyKey?: string, metadata?: object, orderRef?: string, returnUrl?: string };
|
|
78
|
+
} else {
|
|
79
|
+
params = {
|
|
80
|
+
amount: paramsOrFirst as number,
|
|
81
|
+
methodCode: rest[0] as string,
|
|
82
|
+
cartId: rest[1] as string,
|
|
83
|
+
contactId: rest[2] as string,
|
|
84
|
+
country: rest[3] as string,
|
|
85
|
+
currency: rest[4] as string,
|
|
86
|
+
idempotencyKey: rest[5] as string,
|
|
87
|
+
metadata: rest[6] as object,
|
|
88
|
+
orderRef: rest[7] as string,
|
|
89
|
+
returnUrl: rest[8] as string
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const amount = params.amount;
|
|
94
|
+
const methodCode = params.methodCode;
|
|
95
|
+
const cartId = params.cartId;
|
|
96
|
+
const contactId = params.contactId;
|
|
97
|
+
const country = params.country;
|
|
98
|
+
const currency = params.currency;
|
|
99
|
+
const idempotencyKey = params.idempotencyKey;
|
|
100
|
+
const metadata = params.metadata;
|
|
101
|
+
const orderRef = params.orderRef;
|
|
102
|
+
const returnUrl = params.returnUrl;
|
|
103
|
+
|
|
104
|
+
if (typeof amount === 'undefined') {
|
|
105
|
+
throw new RevenexxException('Missing required parameter: "amount"');
|
|
106
|
+
}
|
|
107
|
+
if (typeof methodCode === 'undefined') {
|
|
108
|
+
throw new RevenexxException('Missing required parameter: "methodCode"');
|
|
109
|
+
}
|
|
41
110
|
|
|
42
111
|
const apiPath = '/v1/payments';
|
|
43
|
-
const
|
|
112
|
+
const apiPayload: Payload = {};
|
|
113
|
+
if (typeof amount !== 'undefined') {
|
|
114
|
+
apiPayload['amount'] = amount;
|
|
115
|
+
}
|
|
116
|
+
if (typeof cartId !== 'undefined') {
|
|
117
|
+
apiPayload['cart_id'] = cartId;
|
|
118
|
+
}
|
|
119
|
+
if (typeof contactId !== 'undefined') {
|
|
120
|
+
apiPayload['contact_id'] = contactId;
|
|
121
|
+
}
|
|
122
|
+
if (typeof country !== 'undefined') {
|
|
123
|
+
apiPayload['country'] = country;
|
|
124
|
+
}
|
|
125
|
+
if (typeof currency !== 'undefined') {
|
|
126
|
+
apiPayload['currency'] = currency;
|
|
127
|
+
}
|
|
128
|
+
if (typeof idempotencyKey !== 'undefined') {
|
|
129
|
+
apiPayload['idempotency_key'] = idempotencyKey;
|
|
130
|
+
}
|
|
131
|
+
if (typeof metadata !== 'undefined') {
|
|
132
|
+
apiPayload['metadata'] = metadata;
|
|
133
|
+
}
|
|
134
|
+
if (typeof methodCode !== 'undefined') {
|
|
135
|
+
apiPayload['method_code'] = methodCode;
|
|
136
|
+
}
|
|
137
|
+
if (typeof orderRef !== 'undefined') {
|
|
138
|
+
apiPayload['order_ref'] = orderRef;
|
|
139
|
+
}
|
|
140
|
+
if (typeof returnUrl !== 'undefined') {
|
|
141
|
+
apiPayload['return_url'] = returnUrl;
|
|
142
|
+
}
|
|
44
143
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
45
144
|
|
|
46
145
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -51,7 +150,7 @@ export class Payments {
|
|
|
51
150
|
'post',
|
|
52
151
|
uri,
|
|
53
152
|
apiHeaders,
|
|
54
|
-
|
|
153
|
+
apiPayload
|
|
55
154
|
);
|
|
56
155
|
}
|
|
57
156
|
|
|
@@ -63,7 +162,7 @@ export class Payments {
|
|
|
63
162
|
paymentsMethodsList(): Promise<{}> {
|
|
64
163
|
|
|
65
164
|
const apiPath = '/v1/payments/methods';
|
|
66
|
-
const
|
|
165
|
+
const apiPayload: Payload = {};
|
|
67
166
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
68
167
|
|
|
69
168
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -73,19 +172,158 @@ export class Payments {
|
|
|
73
172
|
'get',
|
|
74
173
|
uri,
|
|
75
174
|
apiHeaders,
|
|
76
|
-
|
|
175
|
+
apiPayload
|
|
77
176
|
);
|
|
78
177
|
}
|
|
79
178
|
|
|
80
179
|
/**
|
|
81
180
|
*
|
|
181
|
+
* @param {string} params.code - Stable method code (unique per tenant, e.g. 'invoice', 'card').
|
|
182
|
+
* @param {string} params.name - Display name.
|
|
183
|
+
* @param {string[]} params.countries - Allowed ISO country codes — empty/omitted = unrestricted.
|
|
184
|
+
* @param {string} params.description -
|
|
185
|
+
* @param {boolean} params.enabled - Disabled methods are never eligible (default false).
|
|
186
|
+
* @param {number} params.feeAmount - Fixed amount or percent value, per fee_type (default 0).
|
|
187
|
+
* @param {string} params.feeCurrency - ISO 4217 code (default EUR).
|
|
188
|
+
* @param {PaymentFeeType} params.feeType - How 'fee_amount' applies (default 'none').
|
|
189
|
+
* @param {PaymentMethodKind} params.kind - Self-managed (merchant fulfils, default) or PSP-backed ('provider' required to transact).
|
|
190
|
+
* @param {object} params.labels - Localized display names ({ de, en, … }).
|
|
191
|
+
* @param {number} params.maxOrderValue - Maximum order amount — omitted = no upper bound.
|
|
192
|
+
* @param {object} params.metadata - Free-form metadata.
|
|
193
|
+
* @param {number} params.minOrderValue - Minimum order amount — omitted = no lower bound.
|
|
194
|
+
* @param {number} params.position - Sort position in the checkout (default 0).
|
|
195
|
+
* @param {string} params.provider - PSP code from the catalog — only for kind 'psp'.
|
|
196
|
+
* @param {string} params.providerMethod - The provider's payment method id (e.g. 'card', 'paypal').
|
|
82
197
|
* @throws {RevenexxException}
|
|
83
198
|
* @returns {Promise<Models.PaymentMethod>}
|
|
84
199
|
*/
|
|
85
|
-
paymentsMethodsCreate(): Promise<Models.PaymentMethod
|
|
200
|
+
paymentsMethodsCreate(params: { code: string, name: string, countries?: string[], description?: string, enabled?: boolean, feeAmount?: number, feeCurrency?: string, feeType?: PaymentFeeType, kind?: PaymentMethodKind, labels?: object, maxOrderValue?: number, metadata?: object, minOrderValue?: number, position?: number, provider?: string, providerMethod?: string }): Promise<Models.PaymentMethod>;
|
|
201
|
+
/**
|
|
202
|
+
*
|
|
203
|
+
* @param {string} code - Stable method code (unique per tenant, e.g. 'invoice', 'card').
|
|
204
|
+
* @param {string} name - Display name.
|
|
205
|
+
* @param {string[]} countries - Allowed ISO country codes — empty/omitted = unrestricted.
|
|
206
|
+
* @param {string} description -
|
|
207
|
+
* @param {boolean} enabled - Disabled methods are never eligible (default false).
|
|
208
|
+
* @param {number} feeAmount - Fixed amount or percent value, per fee_type (default 0).
|
|
209
|
+
* @param {string} feeCurrency - ISO 4217 code (default EUR).
|
|
210
|
+
* @param {PaymentFeeType} feeType - How 'fee_amount' applies (default 'none').
|
|
211
|
+
* @param {PaymentMethodKind} kind - Self-managed (merchant fulfils, default) or PSP-backed ('provider' required to transact).
|
|
212
|
+
* @param {object} labels - Localized display names ({ de, en, … }).
|
|
213
|
+
* @param {number} maxOrderValue - Maximum order amount — omitted = no upper bound.
|
|
214
|
+
* @param {object} metadata - Free-form metadata.
|
|
215
|
+
* @param {number} minOrderValue - Minimum order amount — omitted = no lower bound.
|
|
216
|
+
* @param {number} position - Sort position in the checkout (default 0).
|
|
217
|
+
* @param {string} provider - PSP code from the catalog — only for kind 'psp'.
|
|
218
|
+
* @param {string} providerMethod - The provider's payment method id (e.g. 'card', 'paypal').
|
|
219
|
+
* @throws {RevenexxException}
|
|
220
|
+
* @returns {Promise<Models.PaymentMethod>}
|
|
221
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
222
|
+
*/
|
|
223
|
+
paymentsMethodsCreate(code: string, name: string, countries?: string[], description?: string, enabled?: boolean, feeAmount?: number, feeCurrency?: string, feeType?: PaymentFeeType, kind?: PaymentMethodKind, labels?: object, maxOrderValue?: number, metadata?: object, minOrderValue?: number, position?: number, provider?: string, providerMethod?: string): Promise<Models.PaymentMethod>;
|
|
224
|
+
paymentsMethodsCreate(
|
|
225
|
+
paramsOrFirst: { code: string, name: string, countries?: string[], description?: string, enabled?: boolean, feeAmount?: number, feeCurrency?: string, feeType?: PaymentFeeType, kind?: PaymentMethodKind, labels?: object, maxOrderValue?: number, metadata?: object, minOrderValue?: number, position?: number, provider?: string, providerMethod?: string } | string,
|
|
226
|
+
...rest: [(string)?, (string[])?, (string)?, (boolean)?, (number)?, (string)?, (PaymentFeeType)?, (PaymentMethodKind)?, (object)?, (number)?, (object)?, (number)?, (number)?, (string)?, (string)?]
|
|
227
|
+
): Promise<Models.PaymentMethod> {
|
|
228
|
+
let params: { code: string, name: string, countries?: string[], description?: string, enabled?: boolean, feeAmount?: number, feeCurrency?: string, feeType?: PaymentFeeType, kind?: PaymentMethodKind, labels?: object, maxOrderValue?: number, metadata?: object, minOrderValue?: number, position?: number, provider?: string, providerMethod?: string };
|
|
229
|
+
|
|
230
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
231
|
+
params = (paramsOrFirst || {}) as { code: string, name: string, countries?: string[], description?: string, enabled?: boolean, feeAmount?: number, feeCurrency?: string, feeType?: PaymentFeeType, kind?: PaymentMethodKind, labels?: object, maxOrderValue?: number, metadata?: object, minOrderValue?: number, position?: number, provider?: string, providerMethod?: string };
|
|
232
|
+
} else {
|
|
233
|
+
params = {
|
|
234
|
+
code: paramsOrFirst as string,
|
|
235
|
+
name: rest[0] as string,
|
|
236
|
+
countries: rest[1] as string[],
|
|
237
|
+
description: rest[2] as string,
|
|
238
|
+
enabled: rest[3] as boolean,
|
|
239
|
+
feeAmount: rest[4] as number,
|
|
240
|
+
feeCurrency: rest[5] as string,
|
|
241
|
+
feeType: rest[6] as PaymentFeeType,
|
|
242
|
+
kind: rest[7] as PaymentMethodKind,
|
|
243
|
+
labels: rest[8] as object,
|
|
244
|
+
maxOrderValue: rest[9] as number,
|
|
245
|
+
metadata: rest[10] as object,
|
|
246
|
+
minOrderValue: rest[11] as number,
|
|
247
|
+
position: rest[12] as number,
|
|
248
|
+
provider: rest[13] as string,
|
|
249
|
+
providerMethod: rest[14] as string
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
const code = params.code;
|
|
254
|
+
const name = params.name;
|
|
255
|
+
const countries = params.countries;
|
|
256
|
+
const description = params.description;
|
|
257
|
+
const enabled = params.enabled;
|
|
258
|
+
const feeAmount = params.feeAmount;
|
|
259
|
+
const feeCurrency = params.feeCurrency;
|
|
260
|
+
const feeType = params.feeType;
|
|
261
|
+
const kind = params.kind;
|
|
262
|
+
const labels = params.labels;
|
|
263
|
+
const maxOrderValue = params.maxOrderValue;
|
|
264
|
+
const metadata = params.metadata;
|
|
265
|
+
const minOrderValue = params.minOrderValue;
|
|
266
|
+
const position = params.position;
|
|
267
|
+
const provider = params.provider;
|
|
268
|
+
const providerMethod = params.providerMethod;
|
|
269
|
+
|
|
270
|
+
if (typeof code === 'undefined') {
|
|
271
|
+
throw new RevenexxException('Missing required parameter: "code"');
|
|
272
|
+
}
|
|
273
|
+
if (typeof name === 'undefined') {
|
|
274
|
+
throw new RevenexxException('Missing required parameter: "name"');
|
|
275
|
+
}
|
|
86
276
|
|
|
87
277
|
const apiPath = '/v1/payments/methods';
|
|
88
|
-
const
|
|
278
|
+
const apiPayload: Payload = {};
|
|
279
|
+
if (typeof code !== 'undefined') {
|
|
280
|
+
apiPayload['code'] = code;
|
|
281
|
+
}
|
|
282
|
+
if (typeof countries !== 'undefined') {
|
|
283
|
+
apiPayload['countries'] = countries;
|
|
284
|
+
}
|
|
285
|
+
if (typeof description !== 'undefined') {
|
|
286
|
+
apiPayload['description'] = description;
|
|
287
|
+
}
|
|
288
|
+
if (typeof enabled !== 'undefined') {
|
|
289
|
+
apiPayload['enabled'] = enabled;
|
|
290
|
+
}
|
|
291
|
+
if (typeof feeAmount !== 'undefined') {
|
|
292
|
+
apiPayload['fee_amount'] = feeAmount;
|
|
293
|
+
}
|
|
294
|
+
if (typeof feeCurrency !== 'undefined') {
|
|
295
|
+
apiPayload['fee_currency'] = feeCurrency;
|
|
296
|
+
}
|
|
297
|
+
if (typeof feeType !== 'undefined') {
|
|
298
|
+
apiPayload['fee_type'] = feeType;
|
|
299
|
+
}
|
|
300
|
+
if (typeof kind !== 'undefined') {
|
|
301
|
+
apiPayload['kind'] = kind;
|
|
302
|
+
}
|
|
303
|
+
if (typeof labels !== 'undefined') {
|
|
304
|
+
apiPayload['labels'] = labels;
|
|
305
|
+
}
|
|
306
|
+
if (typeof maxOrderValue !== 'undefined') {
|
|
307
|
+
apiPayload['max_order_value'] = maxOrderValue;
|
|
308
|
+
}
|
|
309
|
+
if (typeof metadata !== 'undefined') {
|
|
310
|
+
apiPayload['metadata'] = metadata;
|
|
311
|
+
}
|
|
312
|
+
if (typeof minOrderValue !== 'undefined') {
|
|
313
|
+
apiPayload['min_order_value'] = minOrderValue;
|
|
314
|
+
}
|
|
315
|
+
if (typeof name !== 'undefined') {
|
|
316
|
+
apiPayload['name'] = name;
|
|
317
|
+
}
|
|
318
|
+
if (typeof position !== 'undefined') {
|
|
319
|
+
apiPayload['position'] = position;
|
|
320
|
+
}
|
|
321
|
+
if (typeof provider !== 'undefined') {
|
|
322
|
+
apiPayload['provider'] = provider;
|
|
323
|
+
}
|
|
324
|
+
if (typeof providerMethod !== 'undefined') {
|
|
325
|
+
apiPayload['provider_method'] = providerMethod;
|
|
326
|
+
}
|
|
89
327
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
90
328
|
|
|
91
329
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -96,7 +334,7 @@ export class Payments {
|
|
|
96
334
|
'post',
|
|
97
335
|
uri,
|
|
98
336
|
apiHeaders,
|
|
99
|
-
|
|
337
|
+
apiPayload
|
|
100
338
|
);
|
|
101
339
|
}
|
|
102
340
|
|
|
@@ -108,7 +346,7 @@ export class Payments {
|
|
|
108
346
|
paymentsMethodsDefaults(): Promise<{}> {
|
|
109
347
|
|
|
110
348
|
const apiPath = '/v1/payments/methods/defaults';
|
|
111
|
-
const
|
|
349
|
+
const apiPayload: Payload = {};
|
|
112
350
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
113
351
|
|
|
114
352
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -118,19 +356,61 @@ export class Payments {
|
|
|
118
356
|
'post',
|
|
119
357
|
uri,
|
|
120
358
|
apiHeaders,
|
|
121
|
-
|
|
359
|
+
apiPayload
|
|
122
360
|
);
|
|
123
361
|
}
|
|
124
362
|
|
|
125
363
|
/**
|
|
126
364
|
*
|
|
365
|
+
* @param {number} params.amount - Order amount the fees are computed against (default 0).
|
|
366
|
+
* @param {string} params.country - Buyer ISO country code — methods with country restrictions need it.
|
|
367
|
+
* @param {string} params.currency - ISO 4217 code (default EUR).
|
|
127
368
|
* @throws {RevenexxException}
|
|
128
369
|
* @returns {Promise<{}>}
|
|
129
370
|
*/
|
|
130
|
-
paymentsMethodsEligible(): Promise<{}
|
|
371
|
+
paymentsMethodsEligible(params?: { amount?: number, country?: string, currency?: string }): Promise<{}>;
|
|
372
|
+
/**
|
|
373
|
+
*
|
|
374
|
+
* @param {number} amount - Order amount the fees are computed against (default 0).
|
|
375
|
+
* @param {string} country - Buyer ISO country code — methods with country restrictions need it.
|
|
376
|
+
* @param {string} currency - ISO 4217 code (default EUR).
|
|
377
|
+
* @throws {RevenexxException}
|
|
378
|
+
* @returns {Promise<{}>}
|
|
379
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
380
|
+
*/
|
|
381
|
+
paymentsMethodsEligible(amount?: number, country?: string, currency?: string): Promise<{}>;
|
|
382
|
+
paymentsMethodsEligible(
|
|
383
|
+
paramsOrFirst?: { amount?: number, country?: string, currency?: string } | number,
|
|
384
|
+
...rest: [(string)?, (string)?]
|
|
385
|
+
): Promise<{}> {
|
|
386
|
+
let params: { amount?: number, country?: string, currency?: string };
|
|
387
|
+
|
|
388
|
+
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
389
|
+
params = (paramsOrFirst || {}) as { amount?: number, country?: string, currency?: string };
|
|
390
|
+
} else {
|
|
391
|
+
params = {
|
|
392
|
+
amount: paramsOrFirst as number,
|
|
393
|
+
country: rest[0] as string,
|
|
394
|
+
currency: rest[1] as string
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
const amount = params.amount;
|
|
399
|
+
const country = params.country;
|
|
400
|
+
const currency = params.currency;
|
|
401
|
+
|
|
131
402
|
|
|
132
403
|
const apiPath = '/v1/payments/methods/eligible';
|
|
133
|
-
const
|
|
404
|
+
const apiPayload: Payload = {};
|
|
405
|
+
if (typeof amount !== 'undefined') {
|
|
406
|
+
apiPayload['amount'] = amount;
|
|
407
|
+
}
|
|
408
|
+
if (typeof country !== 'undefined') {
|
|
409
|
+
apiPayload['country'] = country;
|
|
410
|
+
}
|
|
411
|
+
if (typeof currency !== 'undefined') {
|
|
412
|
+
apiPayload['currency'] = currency;
|
|
413
|
+
}
|
|
134
414
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
135
415
|
|
|
136
416
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -141,7 +421,7 @@ export class Payments {
|
|
|
141
421
|
'post',
|
|
142
422
|
uri,
|
|
143
423
|
apiHeaders,
|
|
144
|
-
|
|
424
|
+
apiPayload
|
|
145
425
|
);
|
|
146
426
|
}
|
|
147
427
|
|
|
@@ -180,7 +460,7 @@ export class Payments {
|
|
|
180
460
|
}
|
|
181
461
|
|
|
182
462
|
const apiPath = '/v1/payments/methods/{id}'.replace('{id}', id);
|
|
183
|
-
const
|
|
463
|
+
const apiPayload: Payload = {};
|
|
184
464
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
185
465
|
|
|
186
466
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -190,7 +470,7 @@ export class Payments {
|
|
|
190
470
|
'delete',
|
|
191
471
|
uri,
|
|
192
472
|
apiHeaders,
|
|
193
|
-
|
|
473
|
+
apiPayload
|
|
194
474
|
);
|
|
195
475
|
}
|
|
196
476
|
|
|
@@ -229,7 +509,7 @@ export class Payments {
|
|
|
229
509
|
}
|
|
230
510
|
|
|
231
511
|
const apiPath = '/v1/payments/methods/{id}'.replace('{id}', id);
|
|
232
|
-
const
|
|
512
|
+
const apiPayload: Payload = {};
|
|
233
513
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
234
514
|
|
|
235
515
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -239,46 +519,159 @@ export class Payments {
|
|
|
239
519
|
'get',
|
|
240
520
|
uri,
|
|
241
521
|
apiHeaders,
|
|
242
|
-
|
|
522
|
+
apiPayload
|
|
243
523
|
);
|
|
244
524
|
}
|
|
245
525
|
|
|
246
526
|
/**
|
|
247
527
|
*
|
|
248
528
|
* @param {string} params.id -
|
|
529
|
+
* @param {string} params.code - Stable method code (unique per tenant, e.g. 'invoice', 'card').
|
|
530
|
+
* @param {string[]} params.countries - Allowed ISO country codes — empty/omitted = unrestricted.
|
|
531
|
+
* @param {string} params.description -
|
|
532
|
+
* @param {boolean} params.enabled - Disabled methods are never eligible (default false).
|
|
533
|
+
* @param {number} params.feeAmount - Fixed amount or percent value, per fee_type (default 0).
|
|
534
|
+
* @param {string} params.feeCurrency - ISO 4217 code (default EUR).
|
|
535
|
+
* @param {PaymentFeeType} params.feeType - How 'fee_amount' applies (default 'none').
|
|
536
|
+
* @param {PaymentMethodKind} params.kind - Self-managed (merchant fulfils, default) or PSP-backed ('provider' required to transact).
|
|
537
|
+
* @param {object} params.labels - Localized display names ({ de, en, … }).
|
|
538
|
+
* @param {number} params.maxOrderValue - Maximum order amount — omitted = no upper bound.
|
|
539
|
+
* @param {object} params.metadata - Free-form metadata.
|
|
540
|
+
* @param {number} params.minOrderValue - Minimum order amount — omitted = no lower bound.
|
|
541
|
+
* @param {string} params.name - Display name.
|
|
542
|
+
* @param {number} params.position - Sort position in the checkout (default 0).
|
|
543
|
+
* @param {string} params.provider - PSP code from the catalog — only for kind 'psp'.
|
|
544
|
+
* @param {string} params.providerMethod - The provider's payment method id (e.g. 'card', 'paypal').
|
|
249
545
|
* @throws {RevenexxException}
|
|
250
546
|
* @returns {Promise<Models.PaymentMethod>}
|
|
251
547
|
*/
|
|
252
|
-
paymentsMethodsUpdate(params: { id: string }): Promise<Models.PaymentMethod>;
|
|
548
|
+
paymentsMethodsUpdate(params: { id: string, code?: string, countries?: string[], description?: string, enabled?: boolean, feeAmount?: number, feeCurrency?: string, feeType?: PaymentFeeType, kind?: PaymentMethodKind, labels?: object, maxOrderValue?: number, metadata?: object, minOrderValue?: number, name?: string, position?: number, provider?: string, providerMethod?: string }): Promise<Models.PaymentMethod>;
|
|
253
549
|
/**
|
|
254
550
|
*
|
|
255
551
|
* @param {string} id -
|
|
552
|
+
* @param {string} code - Stable method code (unique per tenant, e.g. 'invoice', 'card').
|
|
553
|
+
* @param {string[]} countries - Allowed ISO country codes — empty/omitted = unrestricted.
|
|
554
|
+
* @param {string} description -
|
|
555
|
+
* @param {boolean} enabled - Disabled methods are never eligible (default false).
|
|
556
|
+
* @param {number} feeAmount - Fixed amount or percent value, per fee_type (default 0).
|
|
557
|
+
* @param {string} feeCurrency - ISO 4217 code (default EUR).
|
|
558
|
+
* @param {PaymentFeeType} feeType - How 'fee_amount' applies (default 'none').
|
|
559
|
+
* @param {PaymentMethodKind} kind - Self-managed (merchant fulfils, default) or PSP-backed ('provider' required to transact).
|
|
560
|
+
* @param {object} labels - Localized display names ({ de, en, … }).
|
|
561
|
+
* @param {number} maxOrderValue - Maximum order amount — omitted = no upper bound.
|
|
562
|
+
* @param {object} metadata - Free-form metadata.
|
|
563
|
+
* @param {number} minOrderValue - Minimum order amount — omitted = no lower bound.
|
|
564
|
+
* @param {string} name - Display name.
|
|
565
|
+
* @param {number} position - Sort position in the checkout (default 0).
|
|
566
|
+
* @param {string} provider - PSP code from the catalog — only for kind 'psp'.
|
|
567
|
+
* @param {string} providerMethod - The provider's payment method id (e.g. 'card', 'paypal').
|
|
256
568
|
* @throws {RevenexxException}
|
|
257
569
|
* @returns {Promise<Models.PaymentMethod>}
|
|
258
570
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
259
571
|
*/
|
|
260
|
-
paymentsMethodsUpdate(id: string): Promise<Models.PaymentMethod>;
|
|
572
|
+
paymentsMethodsUpdate(id: string, code?: string, countries?: string[], description?: string, enabled?: boolean, feeAmount?: number, feeCurrency?: string, feeType?: PaymentFeeType, kind?: PaymentMethodKind, labels?: object, maxOrderValue?: number, metadata?: object, minOrderValue?: number, name?: string, position?: number, provider?: string, providerMethod?: string): Promise<Models.PaymentMethod>;
|
|
261
573
|
paymentsMethodsUpdate(
|
|
262
|
-
paramsOrFirst: { id: string } | string
|
|
574
|
+
paramsOrFirst: { id: string, code?: string, countries?: string[], description?: string, enabled?: boolean, feeAmount?: number, feeCurrency?: string, feeType?: PaymentFeeType, kind?: PaymentMethodKind, labels?: object, maxOrderValue?: number, metadata?: object, minOrderValue?: number, name?: string, position?: number, provider?: string, providerMethod?: string } | string,
|
|
575
|
+
...rest: [(string)?, (string[])?, (string)?, (boolean)?, (number)?, (string)?, (PaymentFeeType)?, (PaymentMethodKind)?, (object)?, (number)?, (object)?, (number)?, (string)?, (number)?, (string)?, (string)?]
|
|
263
576
|
): Promise<Models.PaymentMethod> {
|
|
264
|
-
let params: { id: string };
|
|
577
|
+
let params: { id: string, code?: string, countries?: string[], description?: string, enabled?: boolean, feeAmount?: number, feeCurrency?: string, feeType?: PaymentFeeType, kind?: PaymentMethodKind, labels?: object, maxOrderValue?: number, metadata?: object, minOrderValue?: number, name?: string, position?: number, provider?: string, providerMethod?: string };
|
|
265
578
|
|
|
266
579
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
267
|
-
params = (paramsOrFirst || {}) as { id: string };
|
|
580
|
+
params = (paramsOrFirst || {}) as { id: string, code?: string, countries?: string[], description?: string, enabled?: boolean, feeAmount?: number, feeCurrency?: string, feeType?: PaymentFeeType, kind?: PaymentMethodKind, labels?: object, maxOrderValue?: number, metadata?: object, minOrderValue?: number, name?: string, position?: number, provider?: string, providerMethod?: string };
|
|
268
581
|
} else {
|
|
269
582
|
params = {
|
|
270
|
-
id: paramsOrFirst as string
|
|
583
|
+
id: paramsOrFirst as string,
|
|
584
|
+
code: rest[0] as string,
|
|
585
|
+
countries: rest[1] as string[],
|
|
586
|
+
description: rest[2] as string,
|
|
587
|
+
enabled: rest[3] as boolean,
|
|
588
|
+
feeAmount: rest[4] as number,
|
|
589
|
+
feeCurrency: rest[5] as string,
|
|
590
|
+
feeType: rest[6] as PaymentFeeType,
|
|
591
|
+
kind: rest[7] as PaymentMethodKind,
|
|
592
|
+
labels: rest[8] as object,
|
|
593
|
+
maxOrderValue: rest[9] as number,
|
|
594
|
+
metadata: rest[10] as object,
|
|
595
|
+
minOrderValue: rest[11] as number,
|
|
596
|
+
name: rest[12] as string,
|
|
597
|
+
position: rest[13] as number,
|
|
598
|
+
provider: rest[14] as string,
|
|
599
|
+
providerMethod: rest[15] as string
|
|
271
600
|
};
|
|
272
601
|
}
|
|
273
602
|
|
|
274
603
|
const id = params.id;
|
|
604
|
+
const code = params.code;
|
|
605
|
+
const countries = params.countries;
|
|
606
|
+
const description = params.description;
|
|
607
|
+
const enabled = params.enabled;
|
|
608
|
+
const feeAmount = params.feeAmount;
|
|
609
|
+
const feeCurrency = params.feeCurrency;
|
|
610
|
+
const feeType = params.feeType;
|
|
611
|
+
const kind = params.kind;
|
|
612
|
+
const labels = params.labels;
|
|
613
|
+
const maxOrderValue = params.maxOrderValue;
|
|
614
|
+
const metadata = params.metadata;
|
|
615
|
+
const minOrderValue = params.minOrderValue;
|
|
616
|
+
const name = params.name;
|
|
617
|
+
const position = params.position;
|
|
618
|
+
const provider = params.provider;
|
|
619
|
+
const providerMethod = params.providerMethod;
|
|
275
620
|
|
|
276
621
|
if (typeof id === 'undefined') {
|
|
277
622
|
throw new RevenexxException('Missing required parameter: "id"');
|
|
278
623
|
}
|
|
279
624
|
|
|
280
625
|
const apiPath = '/v1/payments/methods/{id}'.replace('{id}', id);
|
|
281
|
-
const
|
|
626
|
+
const apiPayload: Payload = {};
|
|
627
|
+
if (typeof code !== 'undefined') {
|
|
628
|
+
apiPayload['code'] = code;
|
|
629
|
+
}
|
|
630
|
+
if (typeof countries !== 'undefined') {
|
|
631
|
+
apiPayload['countries'] = countries;
|
|
632
|
+
}
|
|
633
|
+
if (typeof description !== 'undefined') {
|
|
634
|
+
apiPayload['description'] = description;
|
|
635
|
+
}
|
|
636
|
+
if (typeof enabled !== 'undefined') {
|
|
637
|
+
apiPayload['enabled'] = enabled;
|
|
638
|
+
}
|
|
639
|
+
if (typeof feeAmount !== 'undefined') {
|
|
640
|
+
apiPayload['fee_amount'] = feeAmount;
|
|
641
|
+
}
|
|
642
|
+
if (typeof feeCurrency !== 'undefined') {
|
|
643
|
+
apiPayload['fee_currency'] = feeCurrency;
|
|
644
|
+
}
|
|
645
|
+
if (typeof feeType !== 'undefined') {
|
|
646
|
+
apiPayload['fee_type'] = feeType;
|
|
647
|
+
}
|
|
648
|
+
if (typeof kind !== 'undefined') {
|
|
649
|
+
apiPayload['kind'] = kind;
|
|
650
|
+
}
|
|
651
|
+
if (typeof labels !== 'undefined') {
|
|
652
|
+
apiPayload['labels'] = labels;
|
|
653
|
+
}
|
|
654
|
+
if (typeof maxOrderValue !== 'undefined') {
|
|
655
|
+
apiPayload['max_order_value'] = maxOrderValue;
|
|
656
|
+
}
|
|
657
|
+
if (typeof metadata !== 'undefined') {
|
|
658
|
+
apiPayload['metadata'] = metadata;
|
|
659
|
+
}
|
|
660
|
+
if (typeof minOrderValue !== 'undefined') {
|
|
661
|
+
apiPayload['min_order_value'] = minOrderValue;
|
|
662
|
+
}
|
|
663
|
+
if (typeof name !== 'undefined') {
|
|
664
|
+
apiPayload['name'] = name;
|
|
665
|
+
}
|
|
666
|
+
if (typeof position !== 'undefined') {
|
|
667
|
+
apiPayload['position'] = position;
|
|
668
|
+
}
|
|
669
|
+
if (typeof provider !== 'undefined') {
|
|
670
|
+
apiPayload['provider'] = provider;
|
|
671
|
+
}
|
|
672
|
+
if (typeof providerMethod !== 'undefined') {
|
|
673
|
+
apiPayload['provider_method'] = providerMethod;
|
|
674
|
+
}
|
|
282
675
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
283
676
|
|
|
284
677
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -289,7 +682,7 @@ export class Payments {
|
|
|
289
682
|
'put',
|
|
290
683
|
uri,
|
|
291
684
|
apiHeaders,
|
|
292
|
-
|
|
685
|
+
apiPayload
|
|
293
686
|
);
|
|
294
687
|
}
|
|
295
688
|
|
|
@@ -301,7 +694,7 @@ export class Payments {
|
|
|
301
694
|
paymentsProvidersList(): Promise<{}> {
|
|
302
695
|
|
|
303
696
|
const apiPath = '/v1/payments/providers';
|
|
304
|
-
const
|
|
697
|
+
const apiPayload: Payload = {};
|
|
305
698
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
306
699
|
|
|
307
700
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -311,19 +704,92 @@ export class Payments {
|
|
|
311
704
|
'get',
|
|
312
705
|
uri,
|
|
313
706
|
apiHeaders,
|
|
314
|
-
|
|
707
|
+
apiPayload
|
|
315
708
|
);
|
|
316
709
|
}
|
|
317
710
|
|
|
318
711
|
/**
|
|
319
712
|
*
|
|
713
|
+
* @param {string} params.provider - Provider code — must exist in the catalog (GET /payments/providers/catalog).
|
|
714
|
+
* @param {object} params.credentials - PSP credentials — the catalog's credential_fields say which keys the auth scheme expects.
|
|
715
|
+
* @param {boolean} params.enabled - Only enabled providers transact (default false).
|
|
716
|
+
* @param {string} params.name - Display name — defaults to the catalog label.
|
|
717
|
+
* @param {object} params.options - Free-form provider options.
|
|
718
|
+
* @param {boolean} params.testMode - Sandbox/test credentials (default true).
|
|
719
|
+
* @param {string} params.webhookSecret - Shared secret for PSP callback verification.
|
|
720
|
+
* @throws {RevenexxException}
|
|
721
|
+
* @returns {Promise<Models.PaymentProvider>}
|
|
722
|
+
*/
|
|
723
|
+
paymentsProvidersCreate(params: { provider: string, credentials?: object, enabled?: boolean, name?: string, options?: object, testMode?: boolean, webhookSecret?: string }): Promise<Models.PaymentProvider>;
|
|
724
|
+
/**
|
|
725
|
+
*
|
|
726
|
+
* @param {string} provider - Provider code — must exist in the catalog (GET /payments/providers/catalog).
|
|
727
|
+
* @param {object} credentials - PSP credentials — the catalog's credential_fields say which keys the auth scheme expects.
|
|
728
|
+
* @param {boolean} enabled - Only enabled providers transact (default false).
|
|
729
|
+
* @param {string} name - Display name — defaults to the catalog label.
|
|
730
|
+
* @param {object} options - Free-form provider options.
|
|
731
|
+
* @param {boolean} testMode - Sandbox/test credentials (default true).
|
|
732
|
+
* @param {string} webhookSecret - Shared secret for PSP callback verification.
|
|
320
733
|
* @throws {RevenexxException}
|
|
321
734
|
* @returns {Promise<Models.PaymentProvider>}
|
|
735
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
322
736
|
*/
|
|
323
|
-
paymentsProvidersCreate(): Promise<Models.PaymentProvider
|
|
737
|
+
paymentsProvidersCreate(provider: string, credentials?: object, enabled?: boolean, name?: string, options?: object, testMode?: boolean, webhookSecret?: string): Promise<Models.PaymentProvider>;
|
|
738
|
+
paymentsProvidersCreate(
|
|
739
|
+
paramsOrFirst: { provider: string, credentials?: object, enabled?: boolean, name?: string, options?: object, testMode?: boolean, webhookSecret?: string } | string,
|
|
740
|
+
...rest: [(object)?, (boolean)?, (string)?, (object)?, (boolean)?, (string)?]
|
|
741
|
+
): Promise<Models.PaymentProvider> {
|
|
742
|
+
let params: { provider: string, credentials?: object, enabled?: boolean, name?: string, options?: object, testMode?: boolean, webhookSecret?: string };
|
|
743
|
+
|
|
744
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
745
|
+
params = (paramsOrFirst || {}) as { provider: string, credentials?: object, enabled?: boolean, name?: string, options?: object, testMode?: boolean, webhookSecret?: string };
|
|
746
|
+
} else {
|
|
747
|
+
params = {
|
|
748
|
+
provider: paramsOrFirst as string,
|
|
749
|
+
credentials: rest[0] as object,
|
|
750
|
+
enabled: rest[1] as boolean,
|
|
751
|
+
name: rest[2] as string,
|
|
752
|
+
options: rest[3] as object,
|
|
753
|
+
testMode: rest[4] as boolean,
|
|
754
|
+
webhookSecret: rest[5] as string
|
|
755
|
+
};
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
const provider = params.provider;
|
|
759
|
+
const credentials = params.credentials;
|
|
760
|
+
const enabled = params.enabled;
|
|
761
|
+
const name = params.name;
|
|
762
|
+
const options = params.options;
|
|
763
|
+
const testMode = params.testMode;
|
|
764
|
+
const webhookSecret = params.webhookSecret;
|
|
765
|
+
|
|
766
|
+
if (typeof provider === 'undefined') {
|
|
767
|
+
throw new RevenexxException('Missing required parameter: "provider"');
|
|
768
|
+
}
|
|
324
769
|
|
|
325
770
|
const apiPath = '/v1/payments/providers';
|
|
326
|
-
const
|
|
771
|
+
const apiPayload: Payload = {};
|
|
772
|
+
if (typeof credentials !== 'undefined') {
|
|
773
|
+
apiPayload['credentials'] = credentials;
|
|
774
|
+
}
|
|
775
|
+
if (typeof enabled !== 'undefined') {
|
|
776
|
+
apiPayload['enabled'] = enabled;
|
|
777
|
+
}
|
|
778
|
+
if (typeof name !== 'undefined') {
|
|
779
|
+
apiPayload['name'] = name;
|
|
780
|
+
}
|
|
781
|
+
if (typeof options !== 'undefined') {
|
|
782
|
+
apiPayload['options'] = options;
|
|
783
|
+
}
|
|
784
|
+
if (typeof provider !== 'undefined') {
|
|
785
|
+
apiPayload['provider'] = provider;
|
|
786
|
+
}
|
|
787
|
+
if (typeof testMode !== 'undefined') {
|
|
788
|
+
apiPayload['test_mode'] = testMode;
|
|
789
|
+
}
|
|
790
|
+
if (typeof webhookSecret !== 'undefined') {
|
|
791
|
+
apiPayload['webhook_secret'] = webhookSecret;
|
|
792
|
+
}
|
|
327
793
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
328
794
|
|
|
329
795
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -334,7 +800,7 @@ export class Payments {
|
|
|
334
800
|
'post',
|
|
335
801
|
uri,
|
|
336
802
|
apiHeaders,
|
|
337
|
-
|
|
803
|
+
apiPayload
|
|
338
804
|
);
|
|
339
805
|
}
|
|
340
806
|
|
|
@@ -346,7 +812,7 @@ export class Payments {
|
|
|
346
812
|
paymentsProvidersCatalog(): Promise<{}> {
|
|
347
813
|
|
|
348
814
|
const apiPath = '/v1/payments/providers/catalog';
|
|
349
|
-
const
|
|
815
|
+
const apiPayload: Payload = {};
|
|
350
816
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
351
817
|
|
|
352
818
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -356,7 +822,7 @@ export class Payments {
|
|
|
356
822
|
'get',
|
|
357
823
|
uri,
|
|
358
824
|
apiHeaders,
|
|
359
|
-
|
|
825
|
+
apiPayload
|
|
360
826
|
);
|
|
361
827
|
}
|
|
362
828
|
|
|
@@ -395,7 +861,7 @@ export class Payments {
|
|
|
395
861
|
}
|
|
396
862
|
|
|
397
863
|
const apiPath = '/v1/payments/providers/{id}'.replace('{id}', id);
|
|
398
|
-
const
|
|
864
|
+
const apiPayload: Payload = {};
|
|
399
865
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
400
866
|
|
|
401
867
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -405,7 +871,7 @@ export class Payments {
|
|
|
405
871
|
'delete',
|
|
406
872
|
uri,
|
|
407
873
|
apiHeaders,
|
|
408
|
-
|
|
874
|
+
apiPayload
|
|
409
875
|
);
|
|
410
876
|
}
|
|
411
877
|
|
|
@@ -444,7 +910,7 @@ export class Payments {
|
|
|
444
910
|
}
|
|
445
911
|
|
|
446
912
|
const apiPath = '/v1/payments/providers/{id}'.replace('{id}', id);
|
|
447
|
-
const
|
|
913
|
+
const apiPayload: Payload = {};
|
|
448
914
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
449
915
|
|
|
450
916
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -454,46 +920,96 @@ export class Payments {
|
|
|
454
920
|
'get',
|
|
455
921
|
uri,
|
|
456
922
|
apiHeaders,
|
|
457
|
-
|
|
923
|
+
apiPayload
|
|
458
924
|
);
|
|
459
925
|
}
|
|
460
926
|
|
|
461
927
|
/**
|
|
462
928
|
*
|
|
463
929
|
* @param {string} params.id -
|
|
930
|
+
* @param {object} params.credentials - PSP credentials — the catalog's credential_fields say which keys the auth scheme expects.
|
|
931
|
+
* @param {boolean} params.enabled - Only enabled providers transact (default false).
|
|
932
|
+
* @param {string} params.name - Display name — defaults to the catalog label.
|
|
933
|
+
* @param {object} params.options - Free-form provider options.
|
|
934
|
+
* @param {string} params.provider - Provider code — must exist in the catalog (GET /payments/providers/catalog).
|
|
935
|
+
* @param {boolean} params.testMode - Sandbox/test credentials (default true).
|
|
936
|
+
* @param {string} params.webhookSecret - Shared secret for PSP callback verification.
|
|
464
937
|
* @throws {RevenexxException}
|
|
465
938
|
* @returns {Promise<Models.PaymentProvider>}
|
|
466
939
|
*/
|
|
467
|
-
paymentsProvidersUpdate(params: { id: string }): Promise<Models.PaymentProvider>;
|
|
940
|
+
paymentsProvidersUpdate(params: { id: string, credentials?: object, enabled?: boolean, name?: string, options?: object, provider?: string, testMode?: boolean, webhookSecret?: string }): Promise<Models.PaymentProvider>;
|
|
468
941
|
/**
|
|
469
942
|
*
|
|
470
943
|
* @param {string} id -
|
|
944
|
+
* @param {object} credentials - PSP credentials — the catalog's credential_fields say which keys the auth scheme expects.
|
|
945
|
+
* @param {boolean} enabled - Only enabled providers transact (default false).
|
|
946
|
+
* @param {string} name - Display name — defaults to the catalog label.
|
|
947
|
+
* @param {object} options - Free-form provider options.
|
|
948
|
+
* @param {string} provider - Provider code — must exist in the catalog (GET /payments/providers/catalog).
|
|
949
|
+
* @param {boolean} testMode - Sandbox/test credentials (default true).
|
|
950
|
+
* @param {string} webhookSecret - Shared secret for PSP callback verification.
|
|
471
951
|
* @throws {RevenexxException}
|
|
472
952
|
* @returns {Promise<Models.PaymentProvider>}
|
|
473
953
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
474
954
|
*/
|
|
475
|
-
paymentsProvidersUpdate(id: string): Promise<Models.PaymentProvider>;
|
|
955
|
+
paymentsProvidersUpdate(id: string, credentials?: object, enabled?: boolean, name?: string, options?: object, provider?: string, testMode?: boolean, webhookSecret?: string): Promise<Models.PaymentProvider>;
|
|
476
956
|
paymentsProvidersUpdate(
|
|
477
|
-
paramsOrFirst: { id: string } | string
|
|
957
|
+
paramsOrFirst: { id: string, credentials?: object, enabled?: boolean, name?: string, options?: object, provider?: string, testMode?: boolean, webhookSecret?: string } | string,
|
|
958
|
+
...rest: [(object)?, (boolean)?, (string)?, (object)?, (string)?, (boolean)?, (string)?]
|
|
478
959
|
): Promise<Models.PaymentProvider> {
|
|
479
|
-
let params: { id: string };
|
|
960
|
+
let params: { id: string, credentials?: object, enabled?: boolean, name?: string, options?: object, provider?: string, testMode?: boolean, webhookSecret?: string };
|
|
480
961
|
|
|
481
962
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
482
|
-
params = (paramsOrFirst || {}) as { id: string };
|
|
963
|
+
params = (paramsOrFirst || {}) as { id: string, credentials?: object, enabled?: boolean, name?: string, options?: object, provider?: string, testMode?: boolean, webhookSecret?: string };
|
|
483
964
|
} else {
|
|
484
965
|
params = {
|
|
485
|
-
id: paramsOrFirst as string
|
|
966
|
+
id: paramsOrFirst as string,
|
|
967
|
+
credentials: rest[0] as object,
|
|
968
|
+
enabled: rest[1] as boolean,
|
|
969
|
+
name: rest[2] as string,
|
|
970
|
+
options: rest[3] as object,
|
|
971
|
+
provider: rest[4] as string,
|
|
972
|
+
testMode: rest[5] as boolean,
|
|
973
|
+
webhookSecret: rest[6] as string
|
|
486
974
|
};
|
|
487
975
|
}
|
|
488
976
|
|
|
489
977
|
const id = params.id;
|
|
978
|
+
const credentials = params.credentials;
|
|
979
|
+
const enabled = params.enabled;
|
|
980
|
+
const name = params.name;
|
|
981
|
+
const options = params.options;
|
|
982
|
+
const provider = params.provider;
|
|
983
|
+
const testMode = params.testMode;
|
|
984
|
+
const webhookSecret = params.webhookSecret;
|
|
490
985
|
|
|
491
986
|
if (typeof id === 'undefined') {
|
|
492
987
|
throw new RevenexxException('Missing required parameter: "id"');
|
|
493
988
|
}
|
|
494
989
|
|
|
495
990
|
const apiPath = '/v1/payments/providers/{id}'.replace('{id}', id);
|
|
496
|
-
const
|
|
991
|
+
const apiPayload: Payload = {};
|
|
992
|
+
if (typeof credentials !== 'undefined') {
|
|
993
|
+
apiPayload['credentials'] = credentials;
|
|
994
|
+
}
|
|
995
|
+
if (typeof enabled !== 'undefined') {
|
|
996
|
+
apiPayload['enabled'] = enabled;
|
|
997
|
+
}
|
|
998
|
+
if (typeof name !== 'undefined') {
|
|
999
|
+
apiPayload['name'] = name;
|
|
1000
|
+
}
|
|
1001
|
+
if (typeof options !== 'undefined') {
|
|
1002
|
+
apiPayload['options'] = options;
|
|
1003
|
+
}
|
|
1004
|
+
if (typeof provider !== 'undefined') {
|
|
1005
|
+
apiPayload['provider'] = provider;
|
|
1006
|
+
}
|
|
1007
|
+
if (typeof testMode !== 'undefined') {
|
|
1008
|
+
apiPayload['test_mode'] = testMode;
|
|
1009
|
+
}
|
|
1010
|
+
if (typeof webhookSecret !== 'undefined') {
|
|
1011
|
+
apiPayload['webhook_secret'] = webhookSecret;
|
|
1012
|
+
}
|
|
497
1013
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
498
1014
|
|
|
499
1015
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -504,7 +1020,7 @@ export class Payments {
|
|
|
504
1020
|
'put',
|
|
505
1021
|
uri,
|
|
506
1022
|
apiHeaders,
|
|
507
|
-
|
|
1023
|
+
apiPayload
|
|
508
1024
|
);
|
|
509
1025
|
}
|
|
510
1026
|
|
|
@@ -512,40 +1028,51 @@ export class Payments {
|
|
|
512
1028
|
* Consumes the dispatch envelope from webhooks.revenexx.com: normalizes the provider callback (stripe payment intents + a generic shape), resolves the payment by psp_payment_id or order_ref and moves the ledger. Facts only move forward — provider retries and redeliveries are idempotent no-ops; unverified envelopes are refused.
|
|
513
1029
|
*
|
|
514
1030
|
* @param {string} params.provider -
|
|
1031
|
+
* @param {object} params.data - Request body
|
|
515
1032
|
* @throws {RevenexxException}
|
|
516
1033
|
* @returns {Promise<{}>}
|
|
517
1034
|
*/
|
|
518
|
-
paymentsWebhooksIngest(params: { provider: string }): Promise<{}>;
|
|
1035
|
+
paymentsWebhooksIngest(params: { provider: string, data: object }): Promise<{}>;
|
|
519
1036
|
/**
|
|
520
1037
|
* Consumes the dispatch envelope from webhooks.revenexx.com: normalizes the provider callback (stripe payment intents + a generic shape), resolves the payment by psp_payment_id or order_ref and moves the ledger. Facts only move forward — provider retries and redeliveries are idempotent no-ops; unverified envelopes are refused.
|
|
521
1038
|
*
|
|
522
1039
|
* @param {string} provider -
|
|
1040
|
+
* @param {object} data - Request body
|
|
523
1041
|
* @throws {RevenexxException}
|
|
524
1042
|
* @returns {Promise<{}>}
|
|
525
1043
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
526
1044
|
*/
|
|
527
|
-
paymentsWebhooksIngest(provider: string): Promise<{}>;
|
|
1045
|
+
paymentsWebhooksIngest(provider: string, data: object): Promise<{}>;
|
|
528
1046
|
paymentsWebhooksIngest(
|
|
529
|
-
paramsOrFirst: { provider: string } | string
|
|
1047
|
+
paramsOrFirst: { provider: string, data: object } | string,
|
|
1048
|
+
...rest: [(object)?]
|
|
530
1049
|
): Promise<{}> {
|
|
531
|
-
let params: { provider: string };
|
|
1050
|
+
let params: { provider: string, data: object };
|
|
532
1051
|
|
|
533
1052
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
534
|
-
params = (paramsOrFirst || {}) as { provider: string };
|
|
1053
|
+
params = (paramsOrFirst || {}) as { provider: string, data: object };
|
|
535
1054
|
} else {
|
|
536
1055
|
params = {
|
|
537
|
-
provider: paramsOrFirst as string
|
|
1056
|
+
provider: paramsOrFirst as string,
|
|
1057
|
+
data: rest[0] as object
|
|
538
1058
|
};
|
|
539
1059
|
}
|
|
540
1060
|
|
|
541
1061
|
const provider = params.provider;
|
|
1062
|
+
const data = params.data;
|
|
542
1063
|
|
|
543
1064
|
if (typeof provider === 'undefined') {
|
|
544
1065
|
throw new RevenexxException('Missing required parameter: "provider"');
|
|
545
1066
|
}
|
|
1067
|
+
if (typeof data === 'undefined') {
|
|
1068
|
+
throw new RevenexxException('Missing required parameter: "data"');
|
|
1069
|
+
}
|
|
546
1070
|
|
|
547
1071
|
const apiPath = '/v1/payments/webhooks/{provider}'.replace('{provider}', provider);
|
|
548
|
-
const
|
|
1072
|
+
const apiPayload: Payload = {};
|
|
1073
|
+
if (typeof data !== 'undefined') {
|
|
1074
|
+
Object.assign(apiPayload, data);
|
|
1075
|
+
}
|
|
549
1076
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
550
1077
|
|
|
551
1078
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -556,7 +1083,7 @@ export class Payments {
|
|
|
556
1083
|
'post',
|
|
557
1084
|
uri,
|
|
558
1085
|
apiHeaders,
|
|
559
|
-
|
|
1086
|
+
apiPayload
|
|
560
1087
|
);
|
|
561
1088
|
}
|
|
562
1089
|
|
|
@@ -595,7 +1122,7 @@ export class Payments {
|
|
|
595
1122
|
}
|
|
596
1123
|
|
|
597
1124
|
const apiPath = '/v1/payments/{id}'.replace('{id}', id);
|
|
598
|
-
const
|
|
1125
|
+
const apiPayload: Payload = {};
|
|
599
1126
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
600
1127
|
|
|
601
1128
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -605,7 +1132,7 @@ export class Payments {
|
|
|
605
1132
|
'get',
|
|
606
1133
|
uri,
|
|
607
1134
|
apiHeaders,
|
|
608
|
-
|
|
1135
|
+
apiPayload
|
|
609
1136
|
);
|
|
610
1137
|
}
|
|
611
1138
|
|
|
@@ -644,7 +1171,7 @@ export class Payments {
|
|
|
644
1171
|
}
|
|
645
1172
|
|
|
646
1173
|
const apiPath = '/v1/payments/{id}/cancel'.replace('{id}', id);
|
|
647
|
-
const
|
|
1174
|
+
const apiPayload: Payload = {};
|
|
648
1175
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
649
1176
|
|
|
650
1177
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -654,7 +1181,7 @@ export class Payments {
|
|
|
654
1181
|
'post',
|
|
655
1182
|
uri,
|
|
656
1183
|
apiHeaders,
|
|
657
|
-
|
|
1184
|
+
apiPayload
|
|
658
1185
|
);
|
|
659
1186
|
}
|
|
660
1187
|
|
|
@@ -693,7 +1220,7 @@ export class Payments {
|
|
|
693
1220
|
}
|
|
694
1221
|
|
|
695
1222
|
const apiPath = '/v1/payments/{id}/capture'.replace('{id}', id);
|
|
696
|
-
const
|
|
1223
|
+
const apiPayload: Payload = {};
|
|
697
1224
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
698
1225
|
|
|
699
1226
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -703,7 +1230,7 @@ export class Payments {
|
|
|
703
1230
|
'post',
|
|
704
1231
|
uri,
|
|
705
1232
|
apiHeaders,
|
|
706
|
-
|
|
1233
|
+
apiPayload
|
|
707
1234
|
);
|
|
708
1235
|
}
|
|
709
1236
|
|
|
@@ -742,7 +1269,7 @@ export class Payments {
|
|
|
742
1269
|
}
|
|
743
1270
|
|
|
744
1271
|
const apiPath = '/v1/payments/{id}/confirm'.replace('{id}', id);
|
|
745
|
-
const
|
|
1272
|
+
const apiPayload: Payload = {};
|
|
746
1273
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
747
1274
|
|
|
748
1275
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -752,7 +1279,7 @@ export class Payments {
|
|
|
752
1279
|
'post',
|
|
753
1280
|
uri,
|
|
754
1281
|
apiHeaders,
|
|
755
|
-
|
|
1282
|
+
apiPayload
|
|
756
1283
|
);
|
|
757
1284
|
}
|
|
758
1285
|
|
|
@@ -791,7 +1318,7 @@ export class Payments {
|
|
|
791
1318
|
}
|
|
792
1319
|
|
|
793
1320
|
const apiPath = '/v1/payments/{id}/refund'.replace('{id}', id);
|
|
794
|
-
const
|
|
1321
|
+
const apiPayload: Payload = {};
|
|
795
1322
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
796
1323
|
|
|
797
1324
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -801,7 +1328,7 @@ export class Payments {
|
|
|
801
1328
|
'post',
|
|
802
1329
|
uri,
|
|
803
1330
|
apiHeaders,
|
|
804
|
-
|
|
1331
|
+
apiPayload
|
|
805
1332
|
);
|
|
806
1333
|
}
|
|
807
1334
|
}
|