@emilgroup/payment-sdk-node 1.15.1-beta.4 → 1.15.1-beta.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/.openapi-generator/FILES +1 -0
- package/README.md +2 -2
- package/api/webhooks-api.ts +21 -6
- package/base.ts +7 -15
- package/dist/api/webhooks-api.d.ts +12 -3
- package/dist/api/webhooks-api.js +13 -6
- package/dist/base.d.ts +1 -3
- package/dist/base.js +20 -26
- package/dist/models/card-details-dto.d.ts +42 -0
- package/dist/models/card-details-dto.js +15 -0
- package/dist/models/complete-adyen-payment-setup-request-dto.d.ts +44 -6
- package/dist/models/index.d.ts +1 -0
- package/dist/models/index.js +1 -0
- package/models/card-details-dto.ts +48 -0
- package/models/complete-adyen-payment-setup-request-dto.ts +44 -6
- package/models/index.ts +1 -0
- package/package.json +1 -1
package/.openapi-generator/FILES
CHANGED
|
@@ -24,6 +24,7 @@ models/bank-transaction-class-without-expand-properties.ts
|
|
|
24
24
|
models/bank-transaction-class.ts
|
|
25
25
|
models/billing-profile-dto.ts
|
|
26
26
|
models/billing-profile-limited-response-dto.ts
|
|
27
|
+
models/card-details-dto.ts
|
|
27
28
|
models/complete-adyen-payment-setup-request-dto.ts
|
|
28
29
|
models/complete-braintree-payment-setup-request-dto.ts
|
|
29
30
|
models/complete-payment-setup-request-dto.ts
|
package/README.md
CHANGED
|
@@ -17,11 +17,11 @@ Although this package can be used in both TypeScript and JavaScript, it is inten
|
|
|
17
17
|
Navigate to the folder of your consuming project and run one of the following commands:
|
|
18
18
|
|
|
19
19
|
```
|
|
20
|
-
npm install @emilgroup/payment-sdk-node@1.15.1-beta.
|
|
20
|
+
npm install @emilgroup/payment-sdk-node@1.15.1-beta.6 --save
|
|
21
21
|
```
|
|
22
22
|
or
|
|
23
23
|
```
|
|
24
|
-
yarn add @emilgroup/payment-sdk-node@1.15.1-beta.
|
|
24
|
+
yarn add @emilgroup/payment-sdk-node@1.15.1-beta.6
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
And then you can import `PaymentsApi`.
|
package/api/webhooks-api.ts
CHANGED
|
@@ -36,16 +36,19 @@ export const WebhooksApiAxiosParamCreator = function (configuration?: Configurat
|
|
|
36
36
|
* @param {string} pspType The type of the payment service provider (PSP).<br/> <br/> <i>Supported PSP: braintree, stripe, b4u, eis, adyen</i>
|
|
37
37
|
* @param {string} tenantSlug Unique slug identifier representing a tenant.
|
|
38
38
|
* @param {string} productSlug
|
|
39
|
+
* @param {object} body Accepts a webhook payload. The structure may vary depending on the payment service provider.
|
|
39
40
|
* @param {*} [options] Override http request option.
|
|
40
41
|
* @throws {RequiredError}
|
|
41
42
|
*/
|
|
42
|
-
postWebhook: async (pspType: string, tenantSlug: string, productSlug: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
|
43
|
+
postWebhook: async (pspType: string, tenantSlug: string, productSlug: string, body: object, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
|
43
44
|
// verify required parameter 'pspType' is not null or undefined
|
|
44
45
|
assertParamExists('postWebhook', 'pspType', pspType)
|
|
45
46
|
// verify required parameter 'tenantSlug' is not null or undefined
|
|
46
47
|
assertParamExists('postWebhook', 'tenantSlug', tenantSlug)
|
|
47
48
|
// verify required parameter 'productSlug' is not null or undefined
|
|
48
49
|
assertParamExists('postWebhook', 'productSlug', productSlug)
|
|
50
|
+
// verify required parameter 'body' is not null or undefined
|
|
51
|
+
assertParamExists('postWebhook', 'body', body)
|
|
49
52
|
const localVarPath = `/paymentservice/v1/webhooks/{pspType}/{tenantSlug}/{productSlug}`
|
|
50
53
|
.replace(`{${"pspType"}}`, encodeURIComponent(String(pspType)))
|
|
51
54
|
.replace(`{${"tenantSlug"}}`, encodeURIComponent(String(tenantSlug)))
|
|
@@ -65,9 +68,12 @@ export const WebhooksApiAxiosParamCreator = function (configuration?: Configurat
|
|
|
65
68
|
|
|
66
69
|
|
|
67
70
|
|
|
71
|
+
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
72
|
+
|
|
68
73
|
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
69
74
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
70
75
|
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
|
76
|
+
localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration)
|
|
71
77
|
|
|
72
78
|
return {
|
|
73
79
|
url: toPathString(localVarUrlObj),
|
|
@@ -90,11 +96,12 @@ export const WebhooksApiFp = function(configuration?: Configuration) {
|
|
|
90
96
|
* @param {string} pspType The type of the payment service provider (PSP).<br/> <br/> <i>Supported PSP: braintree, stripe, b4u, eis, adyen</i>
|
|
91
97
|
* @param {string} tenantSlug Unique slug identifier representing a tenant.
|
|
92
98
|
* @param {string} productSlug
|
|
99
|
+
* @param {object} body Accepts a webhook payload. The structure may vary depending on the payment service provider.
|
|
93
100
|
* @param {*} [options] Override http request option.
|
|
94
101
|
* @throws {RequiredError}
|
|
95
102
|
*/
|
|
96
|
-
async postWebhook(pspType: string, tenantSlug: string, productSlug: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
|
97
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.postWebhook(pspType, tenantSlug, productSlug, options);
|
|
103
|
+
async postWebhook(pspType: string, tenantSlug: string, productSlug: string, body: object, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
|
104
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.postWebhook(pspType, tenantSlug, productSlug, body, options);
|
|
98
105
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
99
106
|
},
|
|
100
107
|
}
|
|
@@ -113,11 +120,12 @@ export const WebhooksApiFactory = function (configuration?: Configuration, baseP
|
|
|
113
120
|
* @param {string} pspType The type of the payment service provider (PSP).<br/> <br/> <i>Supported PSP: braintree, stripe, b4u, eis, adyen</i>
|
|
114
121
|
* @param {string} tenantSlug Unique slug identifier representing a tenant.
|
|
115
122
|
* @param {string} productSlug
|
|
123
|
+
* @param {object} body Accepts a webhook payload. The structure may vary depending on the payment service provider.
|
|
116
124
|
* @param {*} [options] Override http request option.
|
|
117
125
|
* @throws {RequiredError}
|
|
118
126
|
*/
|
|
119
|
-
postWebhook(pspType: string, tenantSlug: string, productSlug: string, options?: any): AxiosPromise<void> {
|
|
120
|
-
return localVarFp.postWebhook(pspType, tenantSlug, productSlug, options).then((request) => request(axios, basePath));
|
|
127
|
+
postWebhook(pspType: string, tenantSlug: string, productSlug: string, body: object, options?: any): AxiosPromise<void> {
|
|
128
|
+
return localVarFp.postWebhook(pspType, tenantSlug, productSlug, body, options).then((request) => request(axios, basePath));
|
|
121
129
|
},
|
|
122
130
|
};
|
|
123
131
|
};
|
|
@@ -148,6 +156,13 @@ export interface WebhooksApiPostWebhookRequest {
|
|
|
148
156
|
* @memberof WebhooksApiPostWebhook
|
|
149
157
|
*/
|
|
150
158
|
readonly productSlug: string
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Accepts a webhook payload. The structure may vary depending on the payment service provider.
|
|
162
|
+
* @type {object}
|
|
163
|
+
* @memberof WebhooksApiPostWebhook
|
|
164
|
+
*/
|
|
165
|
+
readonly body: object
|
|
151
166
|
}
|
|
152
167
|
|
|
153
168
|
/**
|
|
@@ -166,6 +181,6 @@ export class WebhooksApi extends BaseAPI {
|
|
|
166
181
|
* @memberof WebhooksApi
|
|
167
182
|
*/
|
|
168
183
|
public postWebhook(requestParameters: WebhooksApiPostWebhookRequest, options?: AxiosRequestConfig) {
|
|
169
|
-
return WebhooksApiFp(this.configuration).postWebhook(requestParameters.pspType, requestParameters.tenantSlug, requestParameters.productSlug, options).then((request) => request(this.axios, this.basePath));
|
|
184
|
+
return WebhooksApiFp(this.configuration).postWebhook(requestParameters.pspType, requestParameters.tenantSlug, requestParameters.productSlug, requestParameters.body, options).then((request) => request(this.axios, this.basePath));
|
|
170
185
|
}
|
|
171
186
|
}
|
package/base.ts
CHANGED
|
@@ -79,7 +79,6 @@ export class BaseAPI {
|
|
|
79
79
|
protected configuration: Configuration;
|
|
80
80
|
private username?: string;
|
|
81
81
|
private password?: string;
|
|
82
|
-
private permissions?: string;
|
|
83
82
|
|
|
84
83
|
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
|
|
85
84
|
if (configuration) {
|
|
@@ -150,10 +149,6 @@ export class BaseAPI {
|
|
|
150
149
|
this.configuration.basePath = env;
|
|
151
150
|
}
|
|
152
151
|
|
|
153
|
-
getPermissions(): Array<string> {
|
|
154
|
-
return this.permissions.split(',');
|
|
155
|
-
}
|
|
156
|
-
|
|
157
152
|
async authorize(username: string, password: string): Promise<void> {
|
|
158
153
|
const options: AxiosRequestConfig = {
|
|
159
154
|
method: 'POST',
|
|
@@ -168,21 +163,20 @@ export class BaseAPI {
|
|
|
168
163
|
|
|
169
164
|
const response = await globalAxios.request<LoginClass>(options);
|
|
170
165
|
|
|
171
|
-
const { data: { accessToken
|
|
166
|
+
const { data: { accessToken } } = response;
|
|
172
167
|
this.configuration.username = username;
|
|
173
168
|
this.configuration.accessToken = `Bearer ${accessToken}`;
|
|
174
|
-
this.permissions = permissions;
|
|
175
169
|
|
|
176
170
|
const refreshToken = this.extractRefreshToken(response)
|
|
177
171
|
this.configuration.refreshToken = refreshToken;
|
|
178
172
|
}
|
|
179
173
|
|
|
180
|
-
async refreshTokenInternal(): Promise<
|
|
174
|
+
async refreshTokenInternal(): Promise<string> {
|
|
181
175
|
const { username, refreshToken } = this.configuration;
|
|
182
176
|
|
|
183
177
|
|
|
184
178
|
if (!username || !refreshToken) {
|
|
185
|
-
|
|
179
|
+
return '';
|
|
186
180
|
}
|
|
187
181
|
|
|
188
182
|
const options: AxiosRequestConfig = {
|
|
@@ -196,9 +190,9 @@ export class BaseAPI {
|
|
|
196
190
|
withCredentials: true,
|
|
197
191
|
};
|
|
198
192
|
|
|
199
|
-
const
|
|
193
|
+
const { data: { accessToken } } = await globalAxios.request<LoginClass>(options);
|
|
200
194
|
|
|
201
|
-
return
|
|
195
|
+
return accessToken;
|
|
202
196
|
}
|
|
203
197
|
|
|
204
198
|
private extractRefreshToken(response: AxiosResponse): string {
|
|
@@ -227,9 +221,8 @@ export class BaseAPI {
|
|
|
227
221
|
if (err.response.status === 401 && !originalConfig._retry) {
|
|
228
222
|
originalConfig._retry = true;
|
|
229
223
|
try {
|
|
230
|
-
const
|
|
224
|
+
const tokenString = await this.refreshTokenInternal();
|
|
231
225
|
const accessToken = `Bearer ${tokenString}`;
|
|
232
|
-
this.permissions = permissions;
|
|
233
226
|
|
|
234
227
|
originalConfig.headers['Authorization'] = `Bearer ${accessToken}`
|
|
235
228
|
|
|
@@ -253,9 +246,8 @@ export class BaseAPI {
|
|
|
253
246
|
){
|
|
254
247
|
_retry_count++;
|
|
255
248
|
try {
|
|
256
|
-
const
|
|
249
|
+
const tokenString = await this.refreshTokenInternal();
|
|
257
250
|
const accessToken = `Bearer ${tokenString}`;
|
|
258
|
-
this.permissions = permissions;
|
|
259
251
|
|
|
260
252
|
_retry = true;
|
|
261
253
|
originalConfig.headers['Authorization'] = accessToken;
|
|
@@ -23,10 +23,11 @@ export declare const WebhooksApiAxiosParamCreator: (configuration?: Configuratio
|
|
|
23
23
|
* @param {string} pspType The type of the payment service provider (PSP).<br/> <br/> <i>Supported PSP: braintree, stripe, b4u, eis, adyen</i>
|
|
24
24
|
* @param {string} tenantSlug Unique slug identifier representing a tenant.
|
|
25
25
|
* @param {string} productSlug
|
|
26
|
+
* @param {object} body Accepts a webhook payload. The structure may vary depending on the payment service provider.
|
|
26
27
|
* @param {*} [options] Override http request option.
|
|
27
28
|
* @throws {RequiredError}
|
|
28
29
|
*/
|
|
29
|
-
postWebhook: (pspType: string, tenantSlug: string, productSlug: string, options?: AxiosRequestConfig) => Promise<RequestArgs>;
|
|
30
|
+
postWebhook: (pspType: string, tenantSlug: string, productSlug: string, body: object, options?: AxiosRequestConfig) => Promise<RequestArgs>;
|
|
30
31
|
};
|
|
31
32
|
/**
|
|
32
33
|
* WebhooksApi - functional programming interface
|
|
@@ -39,10 +40,11 @@ export declare const WebhooksApiFp: (configuration?: Configuration) => {
|
|
|
39
40
|
* @param {string} pspType The type of the payment service provider (PSP).<br/> <br/> <i>Supported PSP: braintree, stripe, b4u, eis, adyen</i>
|
|
40
41
|
* @param {string} tenantSlug Unique slug identifier representing a tenant.
|
|
41
42
|
* @param {string} productSlug
|
|
43
|
+
* @param {object} body Accepts a webhook payload. The structure may vary depending on the payment service provider.
|
|
42
44
|
* @param {*} [options] Override http request option.
|
|
43
45
|
* @throws {RequiredError}
|
|
44
46
|
*/
|
|
45
|
-
postWebhook(pspType: string, tenantSlug: string, productSlug: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>>;
|
|
47
|
+
postWebhook(pspType: string, tenantSlug: string, productSlug: string, body: object, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>>;
|
|
46
48
|
};
|
|
47
49
|
/**
|
|
48
50
|
* WebhooksApi - factory interface
|
|
@@ -55,10 +57,11 @@ export declare const WebhooksApiFactory: (configuration?: Configuration, basePat
|
|
|
55
57
|
* @param {string} pspType The type of the payment service provider (PSP).<br/> <br/> <i>Supported PSP: braintree, stripe, b4u, eis, adyen</i>
|
|
56
58
|
* @param {string} tenantSlug Unique slug identifier representing a tenant.
|
|
57
59
|
* @param {string} productSlug
|
|
60
|
+
* @param {object} body Accepts a webhook payload. The structure may vary depending on the payment service provider.
|
|
58
61
|
* @param {*} [options] Override http request option.
|
|
59
62
|
* @throws {RequiredError}
|
|
60
63
|
*/
|
|
61
|
-
postWebhook(pspType: string, tenantSlug: string, productSlug: string, options?: any): AxiosPromise<void>;
|
|
64
|
+
postWebhook(pspType: string, tenantSlug: string, productSlug: string, body: object, options?: any): AxiosPromise<void>;
|
|
62
65
|
};
|
|
63
66
|
/**
|
|
64
67
|
* Request parameters for postWebhook operation in WebhooksApi.
|
|
@@ -84,6 +87,12 @@ export interface WebhooksApiPostWebhookRequest {
|
|
|
84
87
|
* @memberof WebhooksApiPostWebhook
|
|
85
88
|
*/
|
|
86
89
|
readonly productSlug: string;
|
|
90
|
+
/**
|
|
91
|
+
* Accepts a webhook payload. The structure may vary depending on the payment service provider.
|
|
92
|
+
* @type {object}
|
|
93
|
+
* @memberof WebhooksApiPostWebhook
|
|
94
|
+
*/
|
|
95
|
+
readonly body: object;
|
|
87
96
|
}
|
|
88
97
|
/**
|
|
89
98
|
* WebhooksApi - object-oriented interface
|
package/dist/api/webhooks-api.js
CHANGED
|
@@ -102,10 +102,11 @@ var WebhooksApiAxiosParamCreator = function (configuration) {
|
|
|
102
102
|
* @param {string} pspType The type of the payment service provider (PSP).<br/> <br/> <i>Supported PSP: braintree, stripe, b4u, eis, adyen</i>
|
|
103
103
|
* @param {string} tenantSlug Unique slug identifier representing a tenant.
|
|
104
104
|
* @param {string} productSlug
|
|
105
|
+
* @param {object} body Accepts a webhook payload. The structure may vary depending on the payment service provider.
|
|
105
106
|
* @param {*} [options] Override http request option.
|
|
106
107
|
* @throws {RequiredError}
|
|
107
108
|
*/
|
|
108
|
-
postWebhook: function (pspType, tenantSlug, productSlug, options) {
|
|
109
|
+
postWebhook: function (pspType, tenantSlug, productSlug, body, options) {
|
|
109
110
|
if (options === void 0) { options = {}; }
|
|
110
111
|
return __awaiter(_this, void 0, void 0, function () {
|
|
111
112
|
var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
|
|
@@ -116,6 +117,8 @@ var WebhooksApiAxiosParamCreator = function (configuration) {
|
|
|
116
117
|
(0, common_1.assertParamExists)('postWebhook', 'tenantSlug', tenantSlug);
|
|
117
118
|
// verify required parameter 'productSlug' is not null or undefined
|
|
118
119
|
(0, common_1.assertParamExists)('postWebhook', 'productSlug', productSlug);
|
|
120
|
+
// verify required parameter 'body' is not null or undefined
|
|
121
|
+
(0, common_1.assertParamExists)('postWebhook', 'body', body);
|
|
119
122
|
localVarPath = "/paymentservice/v1/webhooks/{pspType}/{tenantSlug}/{productSlug}"
|
|
120
123
|
.replace("{".concat("pspType", "}"), encodeURIComponent(String(pspType)))
|
|
121
124
|
.replace("{".concat("tenantSlug", "}"), encodeURIComponent(String(tenantSlug)))
|
|
@@ -128,9 +131,11 @@ var WebhooksApiAxiosParamCreator = function (configuration) {
|
|
|
128
131
|
localVarRequestOptions = __assign(__assign({ method: 'POST' }, baseOptions), options);
|
|
129
132
|
localVarHeaderParameter = {};
|
|
130
133
|
localVarQueryParameter = {};
|
|
134
|
+
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
131
135
|
(0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
|
|
132
136
|
headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
133
137
|
localVarRequestOptions.headers = __assign(__assign(__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
|
|
138
|
+
localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(body, localVarRequestOptions, configuration);
|
|
134
139
|
return [2 /*return*/, {
|
|
135
140
|
url: (0, common_1.toPathString)(localVarUrlObj),
|
|
136
141
|
options: localVarRequestOptions,
|
|
@@ -154,15 +159,16 @@ var WebhooksApiFp = function (configuration) {
|
|
|
154
159
|
* @param {string} pspType The type of the payment service provider (PSP).<br/> <br/> <i>Supported PSP: braintree, stripe, b4u, eis, adyen</i>
|
|
155
160
|
* @param {string} tenantSlug Unique slug identifier representing a tenant.
|
|
156
161
|
* @param {string} productSlug
|
|
162
|
+
* @param {object} body Accepts a webhook payload. The structure may vary depending on the payment service provider.
|
|
157
163
|
* @param {*} [options] Override http request option.
|
|
158
164
|
* @throws {RequiredError}
|
|
159
165
|
*/
|
|
160
|
-
postWebhook: function (pspType, tenantSlug, productSlug, options) {
|
|
166
|
+
postWebhook: function (pspType, tenantSlug, productSlug, body, options) {
|
|
161
167
|
return __awaiter(this, void 0, void 0, function () {
|
|
162
168
|
var localVarAxiosArgs;
|
|
163
169
|
return __generator(this, function (_a) {
|
|
164
170
|
switch (_a.label) {
|
|
165
|
-
case 0: return [4 /*yield*/, localVarAxiosParamCreator.postWebhook(pspType, tenantSlug, productSlug, options)];
|
|
171
|
+
case 0: return [4 /*yield*/, localVarAxiosParamCreator.postWebhook(pspType, tenantSlug, productSlug, body, options)];
|
|
166
172
|
case 1:
|
|
167
173
|
localVarAxiosArgs = _a.sent();
|
|
168
174
|
return [2 /*return*/, (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)];
|
|
@@ -186,11 +192,12 @@ var WebhooksApiFactory = function (configuration, basePath, axios) {
|
|
|
186
192
|
* @param {string} pspType The type of the payment service provider (PSP).<br/> <br/> <i>Supported PSP: braintree, stripe, b4u, eis, adyen</i>
|
|
187
193
|
* @param {string} tenantSlug Unique slug identifier representing a tenant.
|
|
188
194
|
* @param {string} productSlug
|
|
195
|
+
* @param {object} body Accepts a webhook payload. The structure may vary depending on the payment service provider.
|
|
189
196
|
* @param {*} [options] Override http request option.
|
|
190
197
|
* @throws {RequiredError}
|
|
191
198
|
*/
|
|
192
|
-
postWebhook: function (pspType, tenantSlug, productSlug, options) {
|
|
193
|
-
return localVarFp.postWebhook(pspType, tenantSlug, productSlug, options).then(function (request) { return request(axios, basePath); });
|
|
199
|
+
postWebhook: function (pspType, tenantSlug, productSlug, body, options) {
|
|
200
|
+
return localVarFp.postWebhook(pspType, tenantSlug, productSlug, body, options).then(function (request) { return request(axios, basePath); });
|
|
194
201
|
},
|
|
195
202
|
};
|
|
196
203
|
};
|
|
@@ -216,7 +223,7 @@ var WebhooksApi = /** @class */ (function (_super) {
|
|
|
216
223
|
*/
|
|
217
224
|
WebhooksApi.prototype.postWebhook = function (requestParameters, options) {
|
|
218
225
|
var _this = this;
|
|
219
|
-
return (0, exports.WebhooksApiFp)(this.configuration).postWebhook(requestParameters.pspType, requestParameters.tenantSlug, requestParameters.productSlug, options).then(function (request) { return request(_this.axios, _this.basePath); });
|
|
226
|
+
return (0, exports.WebhooksApiFp)(this.configuration).postWebhook(requestParameters.pspType, requestParameters.tenantSlug, requestParameters.productSlug, requestParameters.body, options).then(function (request) { return request(_this.axios, _this.basePath); });
|
|
220
227
|
};
|
|
221
228
|
return WebhooksApi;
|
|
222
229
|
}(base_1.BaseAPI));
|
package/dist/base.d.ts
CHANGED
|
@@ -53,16 +53,14 @@ export declare class BaseAPI {
|
|
|
53
53
|
protected configuration: Configuration;
|
|
54
54
|
private username?;
|
|
55
55
|
private password?;
|
|
56
|
-
private permissions?;
|
|
57
56
|
constructor(configuration?: Configuration, basePath?: string, axios?: AxiosInstance);
|
|
58
57
|
initialize(env?: Environment): Promise<void>;
|
|
59
58
|
private loadCredentials;
|
|
60
59
|
private readConfigFile;
|
|
61
60
|
private readEnvVariables;
|
|
62
61
|
selectEnvironment(env: Environment): void;
|
|
63
|
-
getPermissions(): Array<string>;
|
|
64
62
|
authorize(username: string, password: string): Promise<void>;
|
|
65
|
-
refreshTokenInternal(): Promise<
|
|
63
|
+
refreshTokenInternal(): Promise<string>;
|
|
66
64
|
private extractRefreshToken;
|
|
67
65
|
getConfiguration(): Configuration;
|
|
68
66
|
private attachInterceptor;
|
package/dist/base.js
CHANGED
|
@@ -242,14 +242,11 @@ var BaseAPI = /** @class */ (function () {
|
|
|
242
242
|
BaseAPI.prototype.selectEnvironment = function (env) {
|
|
243
243
|
this.configuration.basePath = env;
|
|
244
244
|
};
|
|
245
|
-
BaseAPI.prototype.getPermissions = function () {
|
|
246
|
-
return this.permissions.split(',');
|
|
247
|
-
};
|
|
248
245
|
BaseAPI.prototype.authorize = function (username, password) {
|
|
249
246
|
return __awaiter(this, void 0, void 0, function () {
|
|
250
|
-
var options, response,
|
|
251
|
-
return __generator(this, function (
|
|
252
|
-
switch (
|
|
247
|
+
var options, response, accessToken, refreshToken;
|
|
248
|
+
return __generator(this, function (_a) {
|
|
249
|
+
switch (_a.label) {
|
|
253
250
|
case 0:
|
|
254
251
|
options = {
|
|
255
252
|
method: 'POST',
|
|
@@ -263,11 +260,10 @@ var BaseAPI = /** @class */ (function () {
|
|
|
263
260
|
};
|
|
264
261
|
return [4 /*yield*/, axios_1.default.request(options)];
|
|
265
262
|
case 1:
|
|
266
|
-
response =
|
|
267
|
-
|
|
263
|
+
response = _a.sent();
|
|
264
|
+
accessToken = response.data.accessToken;
|
|
268
265
|
this.configuration.username = username;
|
|
269
266
|
this.configuration.accessToken = "Bearer ".concat(accessToken);
|
|
270
|
-
this.permissions = permissions;
|
|
271
267
|
refreshToken = this.extractRefreshToken(response);
|
|
272
268
|
this.configuration.refreshToken = refreshToken;
|
|
273
269
|
return [2 /*return*/];
|
|
@@ -277,13 +273,13 @@ var BaseAPI = /** @class */ (function () {
|
|
|
277
273
|
};
|
|
278
274
|
BaseAPI.prototype.refreshTokenInternal = function () {
|
|
279
275
|
return __awaiter(this, void 0, void 0, function () {
|
|
280
|
-
var _a, username, refreshToken, options,
|
|
276
|
+
var _a, username, refreshToken, options, accessToken;
|
|
281
277
|
return __generator(this, function (_b) {
|
|
282
278
|
switch (_b.label) {
|
|
283
279
|
case 0:
|
|
284
280
|
_a = this.configuration, username = _a.username, refreshToken = _a.refreshToken;
|
|
285
281
|
if (!username || !refreshToken) {
|
|
286
|
-
|
|
282
|
+
return [2 /*return*/, ''];
|
|
287
283
|
}
|
|
288
284
|
options = {
|
|
289
285
|
method: 'POST',
|
|
@@ -297,8 +293,8 @@ var BaseAPI = /** @class */ (function () {
|
|
|
297
293
|
};
|
|
298
294
|
return [4 /*yield*/, axios_1.default.request(options)];
|
|
299
295
|
case 1:
|
|
300
|
-
|
|
301
|
-
return [2 /*return*/,
|
|
296
|
+
accessToken = (_b.sent()).data.accessToken;
|
|
297
|
+
return [2 /*return*/, accessToken];
|
|
302
298
|
}
|
|
303
299
|
});
|
|
304
300
|
});
|
|
@@ -318,27 +314,26 @@ var BaseAPI = /** @class */ (function () {
|
|
|
318
314
|
axios.interceptors.response.use(function (res) {
|
|
319
315
|
return res;
|
|
320
316
|
}, function (err) { return __awaiter(_this, void 0, void 0, function () {
|
|
321
|
-
var originalConfig,
|
|
322
|
-
return __generator(this, function (
|
|
323
|
-
switch (
|
|
317
|
+
var originalConfig, tokenString, accessToken, _error_1, tokenString, accessToken, _error_2;
|
|
318
|
+
return __generator(this, function (_a) {
|
|
319
|
+
switch (_a.label) {
|
|
324
320
|
case 0:
|
|
325
321
|
originalConfig = err.config;
|
|
326
322
|
if (!err.response) return [3 /*break*/, 5];
|
|
327
323
|
if (!(err.response.status === 401 && !originalConfig._retry)) return [3 /*break*/, 4];
|
|
328
324
|
originalConfig._retry = true;
|
|
329
|
-
|
|
325
|
+
_a.label = 1;
|
|
330
326
|
case 1:
|
|
331
|
-
|
|
327
|
+
_a.trys.push([1, 3, , 4]);
|
|
332
328
|
return [4 /*yield*/, this.refreshTokenInternal()];
|
|
333
329
|
case 2:
|
|
334
|
-
|
|
330
|
+
tokenString = _a.sent();
|
|
335
331
|
accessToken = "Bearer ".concat(tokenString);
|
|
336
|
-
this.permissions = permissions;
|
|
337
332
|
originalConfig.headers['Authorization'] = "Bearer ".concat(accessToken);
|
|
338
333
|
this.configuration.accessToken = accessToken;
|
|
339
334
|
return [2 /*return*/, axios.request(originalConfig)];
|
|
340
335
|
case 3:
|
|
341
|
-
_error_1 =
|
|
336
|
+
_error_1 = _a.sent();
|
|
342
337
|
if (_error_1.response && _error_1.response.data) {
|
|
343
338
|
return [2 /*return*/, Promise.reject(_error_1.response.data)];
|
|
344
339
|
}
|
|
@@ -354,20 +349,19 @@ var BaseAPI = /** @class */ (function () {
|
|
|
354
349
|
&& originalConfig.headers.hasOwnProperty('Authorization')
|
|
355
350
|
&& _retry_count < 4)) return [3 /*break*/, 9];
|
|
356
351
|
_retry_count++;
|
|
357
|
-
|
|
352
|
+
_a.label = 6;
|
|
358
353
|
case 6:
|
|
359
|
-
|
|
354
|
+
_a.trys.push([6, 8, , 9]);
|
|
360
355
|
return [4 /*yield*/, this.refreshTokenInternal()];
|
|
361
356
|
case 7:
|
|
362
|
-
|
|
357
|
+
tokenString = _a.sent();
|
|
363
358
|
accessToken = "Bearer ".concat(tokenString);
|
|
364
|
-
this.permissions = permissions;
|
|
365
359
|
_retry = true;
|
|
366
360
|
originalConfig.headers['Authorization'] = accessToken;
|
|
367
361
|
this.configuration.accessToken = accessToken;
|
|
368
362
|
return [2 /*return*/, axios.request(__assign({}, originalConfig))];
|
|
369
363
|
case 8:
|
|
370
|
-
_error_2 =
|
|
364
|
+
_error_2 = _a.sent();
|
|
371
365
|
if (_error_2.response && _error_2.response.data) {
|
|
372
366
|
return [2 /*return*/, Promise.reject(_error_2.response.data)];
|
|
373
367
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Emil Payment Service
|
|
3
|
+
* This service directly communicates with the various Payment Service Providers (PSPs) in order to charge or refund customers. This service will automatically connect to the PSP linked in your admin configuration; meaning if you configured Stripe, it will automatically create a payment on Stripe when you create it in Emil.
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 1.0
|
|
6
|
+
* Contact: kontakt@emil.de
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @export
|
|
15
|
+
* @interface CardDetailsDto
|
|
16
|
+
*/
|
|
17
|
+
export interface CardDetailsDto {
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @type {string}
|
|
21
|
+
* @memberof CardDetailsDto
|
|
22
|
+
*/
|
|
23
|
+
'encryptedCardNumber': string;
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @type {string}
|
|
27
|
+
* @memberof CardDetailsDto
|
|
28
|
+
*/
|
|
29
|
+
'encryptedExpiryMonth': string;
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
* @type {string}
|
|
33
|
+
* @memberof CardDetailsDto
|
|
34
|
+
*/
|
|
35
|
+
'encryptedExpiryYear': string;
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* @type {string}
|
|
39
|
+
* @memberof CardDetailsDto
|
|
40
|
+
*/
|
|
41
|
+
'encryptedSecurityCode': string;
|
|
42
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* Emil Payment Service
|
|
6
|
+
* This service directly communicates with the various Payment Service Providers (PSPs) in order to charge or refund customers. This service will automatically connect to the PSP linked in your admin configuration; meaning if you configured Stripe, it will automatically create a payment on Stripe when you create it in Emil.
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: 1.0
|
|
9
|
+
* Contact: kontakt@emil.de
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
* https://openapi-generator.tech
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
|
+
import { CardDetailsDto } from './card-details-dto';
|
|
13
|
+
import { SepaDirectDto } from './sepa-direct-dto';
|
|
12
14
|
/**
|
|
13
15
|
*
|
|
14
16
|
* @export
|
|
@@ -21,12 +23,6 @@ export interface CompleteAdyenPaymentSetupRequestDto {
|
|
|
21
23
|
* @memberof CompleteAdyenPaymentSetupRequestDto
|
|
22
24
|
*/
|
|
23
25
|
'shopperReference': string;
|
|
24
|
-
/**
|
|
25
|
-
* Unique identifier for the payment method on Adyen.
|
|
26
|
-
* @type {string}
|
|
27
|
-
* @memberof CompleteAdyenPaymentSetupRequestDto
|
|
28
|
-
*/
|
|
29
|
-
'pspPaymentMethodId': string;
|
|
30
26
|
/**
|
|
31
27
|
* The payment method type on Adyen.
|
|
32
28
|
* @type {string}
|
|
@@ -39,6 +35,48 @@ export interface CompleteAdyenPaymentSetupRequestDto {
|
|
|
39
35
|
* @memberof CompleteAdyenPaymentSetupRequestDto
|
|
40
36
|
*/
|
|
41
37
|
'leadCode'?: string;
|
|
38
|
+
/**
|
|
39
|
+
* The account\'s type.
|
|
40
|
+
* @type {string}
|
|
41
|
+
* @memberof CompleteAdyenPaymentSetupRequestDto
|
|
42
|
+
*/
|
|
43
|
+
'accountType': string;
|
|
44
|
+
/**
|
|
45
|
+
* The accounts holder\'s first name.
|
|
46
|
+
* @type {string}
|
|
47
|
+
* @memberof CompleteAdyenPaymentSetupRequestDto
|
|
48
|
+
*/
|
|
49
|
+
'firstName'?: string;
|
|
50
|
+
/**
|
|
51
|
+
* The account holder\'s last name.
|
|
52
|
+
* @type {string}
|
|
53
|
+
* @memberof CompleteAdyenPaymentSetupRequestDto
|
|
54
|
+
*/
|
|
55
|
+
'lastName'?: string;
|
|
56
|
+
/**
|
|
57
|
+
* The account\'s company name.
|
|
58
|
+
* @type {string}
|
|
59
|
+
* @memberof CompleteAdyenPaymentSetupRequestDto
|
|
60
|
+
*/
|
|
61
|
+
'companyName'?: string;
|
|
62
|
+
/**
|
|
63
|
+
* The account\'s email address
|
|
64
|
+
* @type {string}
|
|
65
|
+
* @memberof CompleteAdyenPaymentSetupRequestDto
|
|
66
|
+
*/
|
|
67
|
+
'email': string;
|
|
68
|
+
/**
|
|
69
|
+
*
|
|
70
|
+
* @type {CardDetailsDto}
|
|
71
|
+
* @memberof CompleteAdyenPaymentSetupRequestDto
|
|
72
|
+
*/
|
|
73
|
+
'cardDetails'?: CardDetailsDto;
|
|
74
|
+
/**
|
|
75
|
+
*
|
|
76
|
+
* @type {SepaDirectDto}
|
|
77
|
+
* @memberof CompleteAdyenPaymentSetupRequestDto
|
|
78
|
+
*/
|
|
79
|
+
'sepaDetails'?: SepaDirectDto;
|
|
42
80
|
}
|
|
43
81
|
export declare const CompleteAdyenPaymentSetupRequestDtoPaymentMethodTypeEnum: {
|
|
44
82
|
readonly Paypal: "paypal";
|
package/dist/models/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from './bank-transaction-class';
|
|
|
4
4
|
export * from './bank-transaction-class-without-expand-properties';
|
|
5
5
|
export * from './billing-profile-dto';
|
|
6
6
|
export * from './billing-profile-limited-response-dto';
|
|
7
|
+
export * from './card-details-dto';
|
|
7
8
|
export * from './complete-adyen-payment-setup-request-dto';
|
|
8
9
|
export * from './complete-braintree-payment-setup-request-dto';
|
|
9
10
|
export * from './complete-payment-setup-request-dto';
|
package/dist/models/index.js
CHANGED
|
@@ -20,6 +20,7 @@ __exportStar(require("./bank-transaction-class"), exports);
|
|
|
20
20
|
__exportStar(require("./bank-transaction-class-without-expand-properties"), exports);
|
|
21
21
|
__exportStar(require("./billing-profile-dto"), exports);
|
|
22
22
|
__exportStar(require("./billing-profile-limited-response-dto"), exports);
|
|
23
|
+
__exportStar(require("./card-details-dto"), exports);
|
|
23
24
|
__exportStar(require("./complete-adyen-payment-setup-request-dto"), exports);
|
|
24
25
|
__exportStar(require("./complete-braintree-payment-setup-request-dto"), exports);
|
|
25
26
|
__exportStar(require("./complete-payment-setup-request-dto"), exports);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Emil Payment Service
|
|
5
|
+
* This service directly communicates with the various Payment Service Providers (PSPs) in order to charge or refund customers. This service will automatically connect to the PSP linked in your admin configuration; meaning if you configured Stripe, it will automatically create a payment on Stripe when you create it in Emil.
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 1.0
|
|
8
|
+
* Contact: kontakt@emil.de
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* @export
|
|
20
|
+
* @interface CardDetailsDto
|
|
21
|
+
*/
|
|
22
|
+
export interface CardDetailsDto {
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
* @type {string}
|
|
26
|
+
* @memberof CardDetailsDto
|
|
27
|
+
*/
|
|
28
|
+
'encryptedCardNumber': string;
|
|
29
|
+
/**
|
|
30
|
+
*
|
|
31
|
+
* @type {string}
|
|
32
|
+
* @memberof CardDetailsDto
|
|
33
|
+
*/
|
|
34
|
+
'encryptedExpiryMonth': string;
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
* @type {string}
|
|
38
|
+
* @memberof CardDetailsDto
|
|
39
|
+
*/
|
|
40
|
+
'encryptedExpiryYear': string;
|
|
41
|
+
/**
|
|
42
|
+
*
|
|
43
|
+
* @type {string}
|
|
44
|
+
* @memberof CardDetailsDto
|
|
45
|
+
*/
|
|
46
|
+
'encryptedSecurityCode': string;
|
|
47
|
+
}
|
|
48
|
+
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
|
|
16
|
+
import { CardDetailsDto } from './card-details-dto';
|
|
17
|
+
import { SepaDirectDto } from './sepa-direct-dto';
|
|
16
18
|
|
|
17
19
|
/**
|
|
18
20
|
*
|
|
@@ -26,12 +28,6 @@ export interface CompleteAdyenPaymentSetupRequestDto {
|
|
|
26
28
|
* @memberof CompleteAdyenPaymentSetupRequestDto
|
|
27
29
|
*/
|
|
28
30
|
'shopperReference': string;
|
|
29
|
-
/**
|
|
30
|
-
* Unique identifier for the payment method on Adyen.
|
|
31
|
-
* @type {string}
|
|
32
|
-
* @memberof CompleteAdyenPaymentSetupRequestDto
|
|
33
|
-
*/
|
|
34
|
-
'pspPaymentMethodId': string;
|
|
35
31
|
/**
|
|
36
32
|
* The payment method type on Adyen.
|
|
37
33
|
* @type {string}
|
|
@@ -44,6 +40,48 @@ export interface CompleteAdyenPaymentSetupRequestDto {
|
|
|
44
40
|
* @memberof CompleteAdyenPaymentSetupRequestDto
|
|
45
41
|
*/
|
|
46
42
|
'leadCode'?: string;
|
|
43
|
+
/**
|
|
44
|
+
* The account\'s type.
|
|
45
|
+
* @type {string}
|
|
46
|
+
* @memberof CompleteAdyenPaymentSetupRequestDto
|
|
47
|
+
*/
|
|
48
|
+
'accountType': string;
|
|
49
|
+
/**
|
|
50
|
+
* The accounts holder\'s first name.
|
|
51
|
+
* @type {string}
|
|
52
|
+
* @memberof CompleteAdyenPaymentSetupRequestDto
|
|
53
|
+
*/
|
|
54
|
+
'firstName'?: string;
|
|
55
|
+
/**
|
|
56
|
+
* The account holder\'s last name.
|
|
57
|
+
* @type {string}
|
|
58
|
+
* @memberof CompleteAdyenPaymentSetupRequestDto
|
|
59
|
+
*/
|
|
60
|
+
'lastName'?: string;
|
|
61
|
+
/**
|
|
62
|
+
* The account\'s company name.
|
|
63
|
+
* @type {string}
|
|
64
|
+
* @memberof CompleteAdyenPaymentSetupRequestDto
|
|
65
|
+
*/
|
|
66
|
+
'companyName'?: string;
|
|
67
|
+
/**
|
|
68
|
+
* The account\'s email address
|
|
69
|
+
* @type {string}
|
|
70
|
+
* @memberof CompleteAdyenPaymentSetupRequestDto
|
|
71
|
+
*/
|
|
72
|
+
'email': string;
|
|
73
|
+
/**
|
|
74
|
+
*
|
|
75
|
+
* @type {CardDetailsDto}
|
|
76
|
+
* @memberof CompleteAdyenPaymentSetupRequestDto
|
|
77
|
+
*/
|
|
78
|
+
'cardDetails'?: CardDetailsDto;
|
|
79
|
+
/**
|
|
80
|
+
*
|
|
81
|
+
* @type {SepaDirectDto}
|
|
82
|
+
* @memberof CompleteAdyenPaymentSetupRequestDto
|
|
83
|
+
*/
|
|
84
|
+
'sepaDetails'?: SepaDirectDto;
|
|
47
85
|
}
|
|
48
86
|
|
|
49
87
|
export const CompleteAdyenPaymentSetupRequestDtoPaymentMethodTypeEnum = {
|
package/models/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from './bank-transaction-class';
|
|
|
4
4
|
export * from './bank-transaction-class-without-expand-properties';
|
|
5
5
|
export * from './billing-profile-dto';
|
|
6
6
|
export * from './billing-profile-limited-response-dto';
|
|
7
|
+
export * from './card-details-dto';
|
|
7
8
|
export * from './complete-adyen-payment-setup-request-dto';
|
|
8
9
|
export * from './complete-braintree-payment-setup-request-dto';
|
|
9
10
|
export * from './complete-payment-setup-request-dto';
|