@emilgroup/payment-sdk-node 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/.openapi-generator/FILES +44 -0
  2. package/.openapi-generator/VERSION +1 -0
  3. package/.openapi-generator-ignore +23 -0
  4. package/README.md +68 -0
  5. package/api/bank-accounts-api.ts +167 -0
  6. package/api/payment-methods-api.ts +581 -0
  7. package/api/payment-service-providers-api.ts +165 -0
  8. package/api/payment-setup-api.ts +268 -0
  9. package/api/payments-api.ts +491 -0
  10. package/api/webhooks-api.ts +154 -0
  11. package/api.ts +46 -0
  12. package/base.ts +293 -0
  13. package/common.ts +138 -0
  14. package/configuration.ts +109 -0
  15. package/dist/api/bank-accounts-api.d.ts +96 -0
  16. package/dist/api/bank-accounts-api.js +228 -0
  17. package/dist/api/payment-methods-api.d.ts +327 -0
  18. package/dist/api/payment-methods-api.js +551 -0
  19. package/dist/api/payment-service-providers-api.d.ts +93 -0
  20. package/dist/api/payment-service-providers-api.js +224 -0
  21. package/dist/api/payment-setup-api.d.ts +146 -0
  22. package/dist/api/payment-setup-api.js +313 -0
  23. package/dist/api/payments-api.d.ts +281 -0
  24. package/dist/api/payments-api.js +463 -0
  25. package/dist/api/webhooks-api.d.ts +91 -0
  26. package/dist/api/webhooks-api.js +213 -0
  27. package/dist/api.d.ts +21 -0
  28. package/dist/api.js +41 -0
  29. package/dist/base.d.ts +77 -0
  30. package/dist/base.js +394 -0
  31. package/dist/common.d.ts +66 -0
  32. package/dist/common.js +244 -0
  33. package/dist/configuration.d.ts +90 -0
  34. package/dist/configuration.js +44 -0
  35. package/dist/index.d.ts +15 -0
  36. package/dist/index.js +35 -0
  37. package/dist/models/complete-braintree-payment-setup-request-dto.d.ts +48 -0
  38. package/dist/models/complete-braintree-payment-setup-request-dto.js +15 -0
  39. package/dist/models/complete-payment-setup-request-dto.d.ts +32 -0
  40. package/dist/models/complete-payment-setup-request-dto.js +15 -0
  41. package/dist/models/complete-payment-setup-response-class.d.ts +25 -0
  42. package/dist/models/complete-payment-setup-response-class.js +15 -0
  43. package/dist/models/complete-stripe-payment-setup-request-dto.d.ts +54 -0
  44. package/dist/models/complete-stripe-payment-setup-request-dto.js +15 -0
  45. package/dist/models/create-bank-account-request-dto.d.ts +30 -0
  46. package/dist/models/create-bank-account-request-dto.js +15 -0
  47. package/dist/models/create-payment-method-response-class.d.ts +25 -0
  48. package/dist/models/create-payment-method-response-class.js +15 -0
  49. package/dist/models/create-payment-request-dto.d.ts +42 -0
  50. package/dist/models/create-payment-request-dto.js +15 -0
  51. package/dist/models/create-payment-response-class.d.ts +25 -0
  52. package/dist/models/create-payment-response-class.js +15 -0
  53. package/dist/models/create-psp-payment-method-request-dto.d.ts +53 -0
  54. package/dist/models/create-psp-payment-method-request-dto.js +31 -0
  55. package/dist/models/get-payment-method-response-class.d.ts +25 -0
  56. package/dist/models/get-payment-method-response-class.js +15 -0
  57. package/dist/models/get-payment-response-class.d.ts +25 -0
  58. package/dist/models/get-payment-response-class.js +15 -0
  59. package/dist/models/get-request-dto.d.ts +30 -0
  60. package/dist/models/get-request-dto.js +15 -0
  61. package/dist/models/index.d.ts +25 -0
  62. package/dist/models/index.js +41 -0
  63. package/dist/models/initiate-braintree-payment-setup-request-dto.d.ts +24 -0
  64. package/dist/models/initiate-braintree-payment-setup-request-dto.js +15 -0
  65. package/dist/models/initiate-braintree-payment-setup-response-class.d.ts +24 -0
  66. package/dist/models/initiate-braintree-payment-setup-response-class.js +15 -0
  67. package/dist/models/initiate-payment-setup-request-dto.d.ts +32 -0
  68. package/dist/models/initiate-payment-setup-request-dto.js +15 -0
  69. package/dist/models/initiate-payment-setup-response-class.d.ts +32 -0
  70. package/dist/models/initiate-payment-setup-response-class.js +15 -0
  71. package/dist/models/initiate-stripe-payment-setup-request-dto.d.ts +24 -0
  72. package/dist/models/initiate-stripe-payment-setup-request-dto.js +15 -0
  73. package/dist/models/initiate-stripe-payment-setup-response-class.d.ts +30 -0
  74. package/dist/models/initiate-stripe-payment-setup-response-class.js +15 -0
  75. package/dist/models/list-payment-methods-response-class.d.ts +30 -0
  76. package/dist/models/list-payment-methods-response-class.js +15 -0
  77. package/dist/models/list-payments-response-class.d.ts +30 -0
  78. package/dist/models/list-payments-response-class.js +15 -0
  79. package/dist/models/payment-class.d.ts +72 -0
  80. package/dist/models/payment-class.js +15 -0
  81. package/dist/models/payment-method-class.d.ts +60 -0
  82. package/dist/models/payment-method-class.js +15 -0
  83. package/dist/models/sepa-direct-dto.d.ts +24 -0
  84. package/dist/models/sepa-direct-dto.js +15 -0
  85. package/dist/models/validate-pspconfig-request-dto.d.ts +41 -0
  86. package/dist/models/validate-pspconfig-request-dto.js +20 -0
  87. package/dist/models/validate-pspconfig-response-class.d.ts +24 -0
  88. package/dist/models/validate-pspconfig-response-class.js +15 -0
  89. package/git_push.sh +57 -0
  90. package/index.ts +19 -0
  91. package/models/complete-braintree-payment-setup-request-dto.ts +54 -0
  92. package/models/complete-payment-setup-request-dto.ts +38 -0
  93. package/models/complete-payment-setup-response-class.ts +31 -0
  94. package/models/complete-stripe-payment-setup-request-dto.ts +60 -0
  95. package/models/create-bank-account-request-dto.ts +36 -0
  96. package/models/create-payment-method-response-class.ts +31 -0
  97. package/models/create-payment-request-dto.ts +48 -0
  98. package/models/create-payment-response-class.ts +31 -0
  99. package/models/create-psp-payment-method-request-dto.ts +62 -0
  100. package/models/get-payment-method-response-class.ts +31 -0
  101. package/models/get-payment-response-class.ts +31 -0
  102. package/models/get-request-dto.ts +36 -0
  103. package/models/index.ts +25 -0
  104. package/models/initiate-braintree-payment-setup-request-dto.ts +30 -0
  105. package/models/initiate-braintree-payment-setup-response-class.ts +30 -0
  106. package/models/initiate-payment-setup-request-dto.ts +38 -0
  107. package/models/initiate-payment-setup-response-class.ts +38 -0
  108. package/models/initiate-stripe-payment-setup-request-dto.ts +30 -0
  109. package/models/initiate-stripe-payment-setup-response-class.ts +36 -0
  110. package/models/list-payment-methods-response-class.ts +36 -0
  111. package/models/list-payments-response-class.ts +36 -0
  112. package/models/payment-class.ts +78 -0
  113. package/models/payment-method-class.ts +66 -0
  114. package/models/sepa-direct-dto.ts +30 -0
  115. package/models/validate-pspconfig-request-dto.ts +50 -0
  116. package/models/validate-pspconfig-response-class.ts +30 -0
  117. package/package.json +30 -0
  118. package/tsconfig.json +22 -0
@@ -0,0 +1,491 @@
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
+ *
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
+ import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
17
+ import { Configuration } from '../configuration';
18
+ // Some imports not used depending on template conditions
19
+ // @ts-ignore
20
+ import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common';
21
+ // @ts-ignore
22
+ import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base';
23
+ // @ts-ignore
24
+ import { CreatePaymentRequestDto } from '../models';
25
+ // @ts-ignore
26
+ import { CreatePaymentResponseClass } from '../models';
27
+ // @ts-ignore
28
+ import { GetPaymentResponseClass } from '../models';
29
+ // @ts-ignore
30
+ import { ListPaymentsResponseClass } from '../models';
31
+ // URLSearchParams not necessarily used
32
+ // @ts-ignore
33
+ import { URL, URLSearchParams } from 'url';
34
+ const FormData = require('form-data');
35
+ /**
36
+ * PaymentsApi - axios parameter creator
37
+ * @export
38
+ */
39
+ export const PaymentsApiAxiosParamCreator = function (configuration?: Configuration) {
40
+ return {
41
+ /**
42
+ * Creates a payment for a specified account. This function is idempotent.
43
+ * @summary Create a payment
44
+ * @param {CreatePaymentRequestDto} createPaymentRequestDto
45
+ * @param {string} [authorization] Bearer Token
46
+ * @param {string} [idempotencyKey] Idempotency Key used to make the request idempotent. The key should be unique. Usually, a generated v4 UUID is enough.
47
+ * @param {*} [options] Override http request option.
48
+ * @throws {RequiredError}
49
+ */
50
+ createPayment: async (createPaymentRequestDto: CreatePaymentRequestDto, authorization?: string, idempotencyKey?: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
51
+ // verify required parameter 'createPaymentRequestDto' is not null or undefined
52
+ assertParamExists('createPayment', 'createPaymentRequestDto', createPaymentRequestDto)
53
+ const localVarPath = `/paymentservice/v1/payments`;
54
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
55
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
56
+ let baseOptions;
57
+ let baseAccessToken;
58
+ if (configuration) {
59
+ baseOptions = configuration.baseOptions;
60
+ baseAccessToken = configuration.accessToken;
61
+ }
62
+
63
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
64
+ const localVarHeaderParameter = {} as any;
65
+ const localVarQueryParameter = {} as any;
66
+
67
+ // authentication bearer required
68
+ // http bearer authentication required
69
+ await setBearerAuthToObject(localVarHeaderParameter, configuration)
70
+
71
+ if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
72
+ localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
73
+ }
74
+
75
+ if (idempotencyKey !== undefined && idempotencyKey !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
76
+ localVarHeaderParameter['Idempotency-Key'] = String(idempotencyKey ? idempotencyKey : baseAccessToken);
77
+ }
78
+
79
+
80
+
81
+ localVarHeaderParameter['Content-Type'] = 'application/json';
82
+
83
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
84
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
85
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
86
+ localVarRequestOptions.data = serializeDataIfNeeded(createPaymentRequestDto, localVarRequestOptions, configuration)
87
+
88
+ return {
89
+ url: toPathString(localVarUrlObj),
90
+ options: localVarRequestOptions,
91
+ };
92
+ },
93
+ /**
94
+ * Retrieves the details of a payment that was previously created. Supply the unique payment code that was returned when you created the payment and Emil Api will return the corresponding payment information.
95
+ * @summary Retrieve a payment
96
+ * @param {string} code Unique identifier for the object.
97
+ * @param {string} [authorization] Bearer Token
98
+ * @param {string} [expand] Fields to expand response by
99
+ * @param {string} [expand2] Fields to expand response by
100
+ * @param {*} [options] Override http request option.
101
+ * @throws {RequiredError}
102
+ */
103
+ getPayment: async (code: string, authorization?: string, expand?: string, expand2?: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
104
+ // verify required parameter 'code' is not null or undefined
105
+ assertParamExists('getPayment', 'code', code)
106
+ const localVarPath = `/paymentservice/v1/payments/{code}`;
107
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
108
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
109
+ let baseOptions;
110
+ let baseAccessToken;
111
+ if (configuration) {
112
+ baseOptions = configuration.baseOptions;
113
+ baseAccessToken = configuration.accessToken;
114
+ }
115
+
116
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
117
+ const localVarHeaderParameter = {} as any;
118
+ const localVarQueryParameter = {} as any;
119
+
120
+ // authentication bearer required
121
+ // http bearer authentication required
122
+ await setBearerAuthToObject(localVarHeaderParameter, configuration)
123
+
124
+ if (code !== undefined) {
125
+ localVarQueryParameter['code'] = code;
126
+ }
127
+
128
+ if (expand !== undefined) {
129
+ localVarQueryParameter['expand'] = expand;
130
+ }
131
+
132
+ if (expand2 !== undefined) {
133
+ localVarQueryParameter['expand'] = expand2;
134
+ }
135
+
136
+ if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
137
+ localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
138
+ }
139
+
140
+
141
+
142
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
143
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
144
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
145
+
146
+ return {
147
+ url: toPathString(localVarUrlObj),
148
+ options: localVarRequestOptions,
149
+ };
150
+ },
151
+ /**
152
+ * Returns a list of payments you’ve previously created. The payments are returned in sorted order, with the oldest payment appearing first. For more information about pagination, read the Pagination documentation.
153
+ * @summary List payments
154
+ * @param {string} [authorization] Bearer Token
155
+ * @param {any} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 100. Default: 10.
156
+ * @param {any} [pageToken] A cursor for use in pagination. pageToken is an ID that defines your place in the list. For instance, if you make a list request and receive 100 objects and pageToken&#x3D;1, your subsequent call can include pageToken&#x3D;2 in order to fetch the next page of the list.
157
+ * @param {any} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.
158
+ * @param {any} [search] Search the list by any field. For instance, if you want to search by code add code&#x3D;xxx in order to fetch the result.
159
+ * @param {any} [order] The order parameter determines how the results should be sorted according to a specified field. It functions similarly to an SQL ORDER BY. Sorting can be performed in either ascending (ASC) or descending (DESC) order. Default: ASC.
160
+ * @param {any} [expand] Use this parameter to fetch additional information about the list items. The expand query parameter increases the set of fields that appear in the response in addition to the default ones. Expanding resources can reduce the number of API calls required to accomplish a task. However, use this with parsimony as some expanded fields can drastically increase payload size.
161
+ * @param {*} [options] Override http request option.
162
+ * @throws {RequiredError}
163
+ */
164
+ listPayments: async (authorization?: string, pageSize?: any, pageToken?: any, filter?: any, search?: any, order?: any, expand?: any, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
165
+ const localVarPath = `/paymentservice/v1/payments`;
166
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
167
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
168
+ let baseOptions;
169
+ let baseAccessToken;
170
+ if (configuration) {
171
+ baseOptions = configuration.baseOptions;
172
+ baseAccessToken = configuration.accessToken;
173
+ }
174
+
175
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
176
+ const localVarHeaderParameter = {} as any;
177
+ const localVarQueryParameter = {} as any;
178
+
179
+ // authentication bearer required
180
+ // http bearer authentication required
181
+ await setBearerAuthToObject(localVarHeaderParameter, configuration)
182
+
183
+ if (pageSize !== undefined) {
184
+ localVarQueryParameter['pageSize'] = pageSize;
185
+ }
186
+
187
+ if (pageToken !== undefined) {
188
+ localVarQueryParameter['pageToken'] = pageToken;
189
+ }
190
+
191
+ if (filter !== undefined) {
192
+ localVarQueryParameter['filter'] = filter;
193
+ }
194
+
195
+ if (search !== undefined) {
196
+ localVarQueryParameter['search'] = search;
197
+ }
198
+
199
+ if (order !== undefined) {
200
+ localVarQueryParameter['order'] = order;
201
+ }
202
+
203
+ if (expand !== undefined) {
204
+ localVarQueryParameter['expand'] = expand;
205
+ }
206
+
207
+ if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
208
+ localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
209
+ }
210
+
211
+
212
+
213
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
214
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
215
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
216
+
217
+ return {
218
+ url: toPathString(localVarUrlObj),
219
+ options: localVarRequestOptions,
220
+ };
221
+ },
222
+ }
223
+ };
224
+
225
+ /**
226
+ * PaymentsApi - functional programming interface
227
+ * @export
228
+ */
229
+ export const PaymentsApiFp = function(configuration?: Configuration) {
230
+ const localVarAxiosParamCreator = PaymentsApiAxiosParamCreator(configuration)
231
+ return {
232
+ /**
233
+ * Creates a payment for a specified account. This function is idempotent.
234
+ * @summary Create a payment
235
+ * @param {CreatePaymentRequestDto} createPaymentRequestDto
236
+ * @param {string} [authorization] Bearer Token
237
+ * @param {string} [idempotencyKey] Idempotency Key used to make the request idempotent. The key should be unique. Usually, a generated v4 UUID is enough.
238
+ * @param {*} [options] Override http request option.
239
+ * @throws {RequiredError}
240
+ */
241
+ async createPayment(createPaymentRequestDto: CreatePaymentRequestDto, authorization?: string, idempotencyKey?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CreatePaymentResponseClass>> {
242
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createPayment(createPaymentRequestDto, authorization, idempotencyKey, options);
243
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
244
+ },
245
+ /**
246
+ * Retrieves the details of a payment that was previously created. Supply the unique payment code that was returned when you created the payment and Emil Api will return the corresponding payment information.
247
+ * @summary Retrieve a payment
248
+ * @param {string} code Unique identifier for the object.
249
+ * @param {string} [authorization] Bearer Token
250
+ * @param {string} [expand] Fields to expand response by
251
+ * @param {string} [expand2] Fields to expand response by
252
+ * @param {*} [options] Override http request option.
253
+ * @throws {RequiredError}
254
+ */
255
+ async getPayment(code: string, authorization?: string, expand?: string, expand2?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GetPaymentResponseClass>> {
256
+ const localVarAxiosArgs = await localVarAxiosParamCreator.getPayment(code, authorization, expand, expand2, options);
257
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
258
+ },
259
+ /**
260
+ * Returns a list of payments you’ve previously created. The payments are returned in sorted order, with the oldest payment appearing first. For more information about pagination, read the Pagination documentation.
261
+ * @summary List payments
262
+ * @param {string} [authorization] Bearer Token
263
+ * @param {any} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 100. Default: 10.
264
+ * @param {any} [pageToken] A cursor for use in pagination. pageToken is an ID that defines your place in the list. For instance, if you make a list request and receive 100 objects and pageToken&#x3D;1, your subsequent call can include pageToken&#x3D;2 in order to fetch the next page of the list.
265
+ * @param {any} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.
266
+ * @param {any} [search] Search the list by any field. For instance, if you want to search by code add code&#x3D;xxx in order to fetch the result.
267
+ * @param {any} [order] The order parameter determines how the results should be sorted according to a specified field. It functions similarly to an SQL ORDER BY. Sorting can be performed in either ascending (ASC) or descending (DESC) order. Default: ASC.
268
+ * @param {any} [expand] Use this parameter to fetch additional information about the list items. The expand query parameter increases the set of fields that appear in the response in addition to the default ones. Expanding resources can reduce the number of API calls required to accomplish a task. However, use this with parsimony as some expanded fields can drastically increase payload size.
269
+ * @param {*} [options] Override http request option.
270
+ * @throws {RequiredError}
271
+ */
272
+ async listPayments(authorization?: string, pageSize?: any, pageToken?: any, filter?: any, search?: any, order?: any, expand?: any, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ListPaymentsResponseClass>> {
273
+ const localVarAxiosArgs = await localVarAxiosParamCreator.listPayments(authorization, pageSize, pageToken, filter, search, order, expand, options);
274
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
275
+ },
276
+ }
277
+ };
278
+
279
+ /**
280
+ * PaymentsApi - factory interface
281
+ * @export
282
+ */
283
+ export const PaymentsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
284
+ const localVarFp = PaymentsApiFp(configuration)
285
+ return {
286
+ /**
287
+ * Creates a payment for a specified account. This function is idempotent.
288
+ * @summary Create a payment
289
+ * @param {CreatePaymentRequestDto} createPaymentRequestDto
290
+ * @param {string} [authorization] Bearer Token
291
+ * @param {string} [idempotencyKey] Idempotency Key used to make the request idempotent. The key should be unique. Usually, a generated v4 UUID is enough.
292
+ * @param {*} [options] Override http request option.
293
+ * @throws {RequiredError}
294
+ */
295
+ createPayment(createPaymentRequestDto: CreatePaymentRequestDto, authorization?: string, idempotencyKey?: string, options?: any): AxiosPromise<CreatePaymentResponseClass> {
296
+ return localVarFp.createPayment(createPaymentRequestDto, authorization, idempotencyKey, options).then((request) => request(axios, basePath));
297
+ },
298
+ /**
299
+ * Retrieves the details of a payment that was previously created. Supply the unique payment code that was returned when you created the payment and Emil Api will return the corresponding payment information.
300
+ * @summary Retrieve a payment
301
+ * @param {string} code Unique identifier for the object.
302
+ * @param {string} [authorization] Bearer Token
303
+ * @param {string} [expand] Fields to expand response by
304
+ * @param {string} [expand2] Fields to expand response by
305
+ * @param {*} [options] Override http request option.
306
+ * @throws {RequiredError}
307
+ */
308
+ getPayment(code: string, authorization?: string, expand?: string, expand2?: string, options?: any): AxiosPromise<GetPaymentResponseClass> {
309
+ return localVarFp.getPayment(code, authorization, expand, expand2, options).then((request) => request(axios, basePath));
310
+ },
311
+ /**
312
+ * Returns a list of payments you’ve previously created. The payments are returned in sorted order, with the oldest payment appearing first. For more information about pagination, read the Pagination documentation.
313
+ * @summary List payments
314
+ * @param {string} [authorization] Bearer Token
315
+ * @param {any} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 100. Default: 10.
316
+ * @param {any} [pageToken] A cursor for use in pagination. pageToken is an ID that defines your place in the list. For instance, if you make a list request and receive 100 objects and pageToken&#x3D;1, your subsequent call can include pageToken&#x3D;2 in order to fetch the next page of the list.
317
+ * @param {any} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.
318
+ * @param {any} [search] Search the list by any field. For instance, if you want to search by code add code&#x3D;xxx in order to fetch the result.
319
+ * @param {any} [order] The order parameter determines how the results should be sorted according to a specified field. It functions similarly to an SQL ORDER BY. Sorting can be performed in either ascending (ASC) or descending (DESC) order. Default: ASC.
320
+ * @param {any} [expand] Use this parameter to fetch additional information about the list items. The expand query parameter increases the set of fields that appear in the response in addition to the default ones. Expanding resources can reduce the number of API calls required to accomplish a task. However, use this with parsimony as some expanded fields can drastically increase payload size.
321
+ * @param {*} [options] Override http request option.
322
+ * @throws {RequiredError}
323
+ */
324
+ listPayments(authorization?: string, pageSize?: any, pageToken?: any, filter?: any, search?: any, order?: any, expand?: any, options?: any): AxiosPromise<ListPaymentsResponseClass> {
325
+ return localVarFp.listPayments(authorization, pageSize, pageToken, filter, search, order, expand, options).then((request) => request(axios, basePath));
326
+ },
327
+ };
328
+ };
329
+
330
+ /**
331
+ * Request parameters for createPayment operation in PaymentsApi.
332
+ * @export
333
+ * @interface PaymentsApiCreatePaymentRequest
334
+ */
335
+ export interface PaymentsApiCreatePaymentRequest {
336
+ /**
337
+ *
338
+ * @type {CreatePaymentRequestDto}
339
+ * @memberof PaymentsApiCreatePayment
340
+ */
341
+ readonly createPaymentRequestDto: CreatePaymentRequestDto
342
+
343
+ /**
344
+ * Bearer Token
345
+ * @type {string}
346
+ * @memberof PaymentsApiCreatePayment
347
+ */
348
+ readonly authorization?: string
349
+
350
+ /**
351
+ * Idempotency Key used to make the request idempotent. The key should be unique. Usually, a generated v4 UUID is enough.
352
+ * @type {string}
353
+ * @memberof PaymentsApiCreatePayment
354
+ */
355
+ readonly idempotencyKey?: string
356
+ }
357
+
358
+ /**
359
+ * Request parameters for getPayment operation in PaymentsApi.
360
+ * @export
361
+ * @interface PaymentsApiGetPaymentRequest
362
+ */
363
+ export interface PaymentsApiGetPaymentRequest {
364
+ /**
365
+ * Unique identifier for the object.
366
+ * @type {string}
367
+ * @memberof PaymentsApiGetPayment
368
+ */
369
+ readonly code: string
370
+
371
+ /**
372
+ * Bearer Token
373
+ * @type {string}
374
+ * @memberof PaymentsApiGetPayment
375
+ */
376
+ readonly authorization?: string
377
+
378
+ /**
379
+ * Fields to expand response by
380
+ * @type {string}
381
+ * @memberof PaymentsApiGetPayment
382
+ */
383
+ readonly expand?: string
384
+
385
+ /**
386
+ * Fields to expand response by
387
+ * @type {string}
388
+ * @memberof PaymentsApiGetPayment
389
+ */
390
+ readonly expand2?: string
391
+ }
392
+
393
+ /**
394
+ * Request parameters for listPayments operation in PaymentsApi.
395
+ * @export
396
+ * @interface PaymentsApiListPaymentsRequest
397
+ */
398
+ export interface PaymentsApiListPaymentsRequest {
399
+ /**
400
+ * Bearer Token
401
+ * @type {string}
402
+ * @memberof PaymentsApiListPayments
403
+ */
404
+ readonly authorization?: string
405
+
406
+ /**
407
+ * A limit on the number of objects to be returned. Limit ranges between 1 and 100. Default: 10.
408
+ * @type {any}
409
+ * @memberof PaymentsApiListPayments
410
+ */
411
+ readonly pageSize?: any
412
+
413
+ /**
414
+ * A cursor for use in pagination. pageToken is an ID that defines your place in the list. For instance, if you make a list request and receive 100 objects and pageToken&#x3D;1, your subsequent call can include pageToken&#x3D;2 in order to fetch the next page of the list.
415
+ * @type {any}
416
+ * @memberof PaymentsApiListPayments
417
+ */
418
+ readonly pageToken?: any
419
+
420
+ /**
421
+ * Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.
422
+ * @type {any}
423
+ * @memberof PaymentsApiListPayments
424
+ */
425
+ readonly filter?: any
426
+
427
+ /**
428
+ * Search the list by any field. For instance, if you want to search by code add code&#x3D;xxx in order to fetch the result.
429
+ * @type {any}
430
+ * @memberof PaymentsApiListPayments
431
+ */
432
+ readonly search?: any
433
+
434
+ /**
435
+ * The order parameter determines how the results should be sorted according to a specified field. It functions similarly to an SQL ORDER BY. Sorting can be performed in either ascending (ASC) or descending (DESC) order. Default: ASC.
436
+ * @type {any}
437
+ * @memberof PaymentsApiListPayments
438
+ */
439
+ readonly order?: any
440
+
441
+ /**
442
+ * Use this parameter to fetch additional information about the list items. The expand query parameter increases the set of fields that appear in the response in addition to the default ones. Expanding resources can reduce the number of API calls required to accomplish a task. However, use this with parsimony as some expanded fields can drastically increase payload size.
443
+ * @type {any}
444
+ * @memberof PaymentsApiListPayments
445
+ */
446
+ readonly expand?: any
447
+ }
448
+
449
+ /**
450
+ * PaymentsApi - object-oriented interface
451
+ * @export
452
+ * @class PaymentsApi
453
+ * @extends {BaseAPI}
454
+ */
455
+ export class PaymentsApi extends BaseAPI {
456
+ /**
457
+ * Creates a payment for a specified account. This function is idempotent.
458
+ * @summary Create a payment
459
+ * @param {PaymentsApiCreatePaymentRequest} requestParameters Request parameters.
460
+ * @param {*} [options] Override http request option.
461
+ * @throws {RequiredError}
462
+ * @memberof PaymentsApi
463
+ */
464
+ public createPayment(requestParameters: PaymentsApiCreatePaymentRequest, options?: AxiosRequestConfig) {
465
+ return PaymentsApiFp(this.configuration).createPayment(requestParameters.createPaymentRequestDto, requestParameters.authorization, requestParameters.idempotencyKey, options).then((request) => request(this.axios, this.basePath));
466
+ }
467
+
468
+ /**
469
+ * Retrieves the details of a payment that was previously created. Supply the unique payment code that was returned when you created the payment and Emil Api will return the corresponding payment information.
470
+ * @summary Retrieve a payment
471
+ * @param {PaymentsApiGetPaymentRequest} requestParameters Request parameters.
472
+ * @param {*} [options] Override http request option.
473
+ * @throws {RequiredError}
474
+ * @memberof PaymentsApi
475
+ */
476
+ public getPayment(requestParameters: PaymentsApiGetPaymentRequest, options?: AxiosRequestConfig) {
477
+ return PaymentsApiFp(this.configuration).getPayment(requestParameters.code, requestParameters.authorization, requestParameters.expand, requestParameters.expand2, options).then((request) => request(this.axios, this.basePath));
478
+ }
479
+
480
+ /**
481
+ * Returns a list of payments you’ve previously created. The payments are returned in sorted order, with the oldest payment appearing first. For more information about pagination, read the Pagination documentation.
482
+ * @summary List payments
483
+ * @param {PaymentsApiListPaymentsRequest} requestParameters Request parameters.
484
+ * @param {*} [options] Override http request option.
485
+ * @throws {RequiredError}
486
+ * @memberof PaymentsApi
487
+ */
488
+ public listPayments(requestParameters: PaymentsApiListPaymentsRequest = {}, options?: AxiosRequestConfig) {
489
+ return PaymentsApiFp(this.configuration).listPayments(requestParameters.authorization, requestParameters.pageSize, requestParameters.pageToken, requestParameters.filter, requestParameters.search, requestParameters.order, requestParameters.expand, options).then((request) => request(this.axios, this.basePath));
490
+ }
491
+ }
@@ -0,0 +1,154 @@
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
+ *
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
+ import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
17
+ import { Configuration } from '../configuration';
18
+ // Some imports not used depending on template conditions
19
+ // @ts-ignore
20
+ import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common';
21
+ // @ts-ignore
22
+ import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base';
23
+ // URLSearchParams not necessarily used
24
+ // @ts-ignore
25
+ import { URL, URLSearchParams } from 'url';
26
+ const FormData = require('form-data');
27
+ /**
28
+ * WebhooksApi - axios parameter creator
29
+ * @export
30
+ */
31
+ export const WebhooksApiAxiosParamCreator = function (configuration?: Configuration) {
32
+ return {
33
+ /**
34
+ *
35
+ * @param {string} pspType
36
+ * @param {string} tenantSlug
37
+ * @param {*} [options] Override http request option.
38
+ * @throws {RequiredError}
39
+ */
40
+ postWebhook: async (pspType: string, tenantSlug: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
41
+ // verify required parameter 'pspType' is not null or undefined
42
+ assertParamExists('postWebhook', 'pspType', pspType)
43
+ // verify required parameter 'tenantSlug' is not null or undefined
44
+ assertParamExists('postWebhook', 'tenantSlug', tenantSlug)
45
+ const localVarPath = `/paymentservice/v1/webhooks/{pspType}/{tenantSlug}`
46
+ .replace(`{${"pspType"}}`, encodeURIComponent(String(pspType)))
47
+ .replace(`{${"tenantSlug"}}`, encodeURIComponent(String(tenantSlug)));
48
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
49
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
50
+ let baseOptions;
51
+ let baseAccessToken;
52
+ if (configuration) {
53
+ baseOptions = configuration.baseOptions;
54
+ baseAccessToken = configuration.accessToken;
55
+ }
56
+
57
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
58
+ const localVarHeaderParameter = {} as any;
59
+ const localVarQueryParameter = {} as any;
60
+
61
+
62
+
63
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
64
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
65
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
66
+
67
+ return {
68
+ url: toPathString(localVarUrlObj),
69
+ options: localVarRequestOptions,
70
+ };
71
+ },
72
+ }
73
+ };
74
+
75
+ /**
76
+ * WebhooksApi - functional programming interface
77
+ * @export
78
+ */
79
+ export const WebhooksApiFp = function(configuration?: Configuration) {
80
+ const localVarAxiosParamCreator = WebhooksApiAxiosParamCreator(configuration)
81
+ return {
82
+ /**
83
+ *
84
+ * @param {string} pspType
85
+ * @param {string} tenantSlug
86
+ * @param {*} [options] Override http request option.
87
+ * @throws {RequiredError}
88
+ */
89
+ async postWebhook(pspType: string, tenantSlug: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
90
+ const localVarAxiosArgs = await localVarAxiosParamCreator.postWebhook(pspType, tenantSlug, options);
91
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
92
+ },
93
+ }
94
+ };
95
+
96
+ /**
97
+ * WebhooksApi - factory interface
98
+ * @export
99
+ */
100
+ export const WebhooksApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
101
+ const localVarFp = WebhooksApiFp(configuration)
102
+ return {
103
+ /**
104
+ *
105
+ * @param {string} pspType
106
+ * @param {string} tenantSlug
107
+ * @param {*} [options] Override http request option.
108
+ * @throws {RequiredError}
109
+ */
110
+ postWebhook(pspType: string, tenantSlug: string, options?: any): AxiosPromise<void> {
111
+ return localVarFp.postWebhook(pspType, tenantSlug, options).then((request) => request(axios, basePath));
112
+ },
113
+ };
114
+ };
115
+
116
+ /**
117
+ * Request parameters for postWebhook operation in WebhooksApi.
118
+ * @export
119
+ * @interface WebhooksApiPostWebhookRequest
120
+ */
121
+ export interface WebhooksApiPostWebhookRequest {
122
+ /**
123
+ *
124
+ * @type {string}
125
+ * @memberof WebhooksApiPostWebhook
126
+ */
127
+ readonly pspType: string
128
+
129
+ /**
130
+ *
131
+ * @type {string}
132
+ * @memberof WebhooksApiPostWebhook
133
+ */
134
+ readonly tenantSlug: string
135
+ }
136
+
137
+ /**
138
+ * WebhooksApi - object-oriented interface
139
+ * @export
140
+ * @class WebhooksApi
141
+ * @extends {BaseAPI}
142
+ */
143
+ export class WebhooksApi extends BaseAPI {
144
+ /**
145
+ *
146
+ * @param {WebhooksApiPostWebhookRequest} requestParameters Request parameters.
147
+ * @param {*} [options] Override http request option.
148
+ * @throws {RequiredError}
149
+ * @memberof WebhooksApi
150
+ */
151
+ public postWebhook(requestParameters: WebhooksApiPostWebhookRequest, options?: AxiosRequestConfig) {
152
+ return WebhooksApiFp(this.configuration).postWebhook(requestParameters.pspType, requestParameters.tenantSlug, options).then((request) => request(this.axios, this.basePath));
153
+ }
154
+ }