@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
package/api.ts ADDED
@@ -0,0 +1,46 @@
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 { Configuration } from './configuration';
17
+ import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
18
+ // URLSearchParams not necessarily used
19
+ // @ts-ignore
20
+ import { URL, URLSearchParams } from 'url';
21
+ import FormData from 'form-data'
22
+ // Some imports not used depending on template conditions
23
+ // @ts-ignore
24
+ import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common';
25
+ // @ts-ignore
26
+ import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base';
27
+ import { BankAccountsApi } from './api';
28
+ import { PaymentMethodsApi } from './api';
29
+ import { PaymentServiceProvidersApi } from './api';
30
+ import { PaymentSetupApi } from './api';
31
+ import { PaymentsApi } from './api';
32
+ import { WebhooksApi } from './api';
33
+
34
+
35
+ export * from './api/bank-accounts-api';
36
+ export * from './api/payment-methods-api';
37
+ export * from './api/payment-service-providers-api';
38
+ export * from './api/payment-setup-api';
39
+ export * from './api/payments-api';
40
+ export * from './api/webhooks-api';
41
+
42
+
43
+ export enum Environment {
44
+ Production = 'https://apiv2.emil.de',
45
+ Test = 'https://apiv2-test.emil.de',
46
+ }
package/base.ts ADDED
@@ -0,0 +1,293 @@
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 { Configuration } from "./configuration";
17
+ // Some imports not used depending on template conditions
18
+ // @ts-ignore
19
+ import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
20
+ import * as fs from 'fs';
21
+ import * as path from 'path';
22
+ import * as os from 'os';
23
+
24
+ export const BASE_PATH = "https://apiv2.emil.de".replace(/\/+$/, "");
25
+ const CONFIG_DIRECTORY = '.emil';
26
+ const CONFIG_FILENAME = 'credentials';
27
+ const KEY_USERNAME = 'emil_username';
28
+ const KEY_PASSWORD = 'emil_password';
29
+
30
+ const filePath = os.homedir() + path.sep + CONFIG_DIRECTORY + path.sep + CONFIG_FILENAME;
31
+ /**
32
+ *
33
+ * @export
34
+ */
35
+ export const COLLECTION_FORMATS = {
36
+ csv: ",",
37
+ ssv: " ",
38
+ tsv: "\t",
39
+ pipes: "|",
40
+ };
41
+
42
+ export interface LoginClass {
43
+ accessToken: string;
44
+ permissions: Array<string>;
45
+ newPasswordRequired: boolean;
46
+ }
47
+
48
+ export enum Environment {
49
+ Production = 'https://apiv2.emil.de',
50
+ Test = 'https://apiv2-test.emil.de',
51
+ }
52
+
53
+ /**
54
+ *
55
+ * @export
56
+ * @interface RequestArgs
57
+ */
58
+ export interface RequestArgs {
59
+ url: string;
60
+ options: AxiosRequestConfig;
61
+ }
62
+
63
+ const NETWORK_ERROR_MESSAGE = "Network Error";
64
+
65
+ /**
66
+ *
67
+ * @export
68
+ * @class BaseAPI
69
+ */
70
+ export class BaseAPI {
71
+ protected configuration: Configuration;
72
+ private lastRequestConfig?: AxiosRequestConfig;
73
+ private username?: string;
74
+ private password?: string;
75
+
76
+ constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
77
+ if (configuration) {
78
+ this.configuration = configuration;
79
+ this.basePath = configuration.basePath || this.basePath;
80
+ } else {
81
+ this.configuration = new Configuration({
82
+ basePath: this.basePath,
83
+ });
84
+ }
85
+
86
+ this.attachInterceptor(axios);
87
+ }
88
+
89
+ async initialize(env: Environment = Environment.Production) {
90
+ this.configuration.basePath = env;
91
+
92
+ await this.loadCredentials();
93
+
94
+ if (this.username) {
95
+ await this.authorize(this.username, this.password);
96
+ this.password = null; // to avoid keeping password loaded in memory.
97
+ }
98
+ }
99
+
100
+ private async loadCredentials() {
101
+ try {
102
+ await this.readConfigFile();
103
+ } catch (error) {
104
+ console.warn(`No credentials file found. Check that ${filePath} exists.`);
105
+ }
106
+
107
+ this.readEnvVariables();
108
+
109
+ if (!this.username) {
110
+ console.info(`No credentials found in credentials file or environment variables. Either provide some or use
111
+ authorize() function.`);
112
+ }
113
+ }
114
+
115
+ private async readConfigFile() {
116
+ const file = await fs.promises.readFile(filePath, 'utf-8');
117
+
118
+ const lines = file.split(os.EOL)
119
+ .filter(Boolean);
120
+
121
+ lines.forEach((line: string) => {
122
+ if (line.startsWith(KEY_USERNAME)) {
123
+ this.username = line.length > KEY_USERNAME.length + 1 ? line.substring(KEY_USERNAME.length + 1) : '';
124
+ } else if (line.startsWith(KEY_PASSWORD)) {
125
+ this.password = line.length > KEY_PASSWORD.length + 1 ? line.substring(KEY_PASSWORD.length + 1) : '';
126
+ }
127
+ });
128
+ }
129
+
130
+ private readEnvVariables(): boolean {
131
+ if (process.env.EMIL_USERNAME) {
132
+ this.username = process.env.EMIL_USERNAME;
133
+ this.password = process.env.EMIL_PASSWORD || '';
134
+
135
+ return true;
136
+ }
137
+
138
+ return false;
139
+ }
140
+
141
+ selectEnvironment(env: Environment) {
142
+ this.configuration.basePath = env;
143
+ }
144
+
145
+ async authorize(username: string, password: string): Promise<void> {
146
+ const options: AxiosRequestConfig = {
147
+ method: 'POST',
148
+ url: `${this.configuration.basePath}/authservice/v1/login`,
149
+ headers: { 'Content-Type': 'application/json' },
150
+ data: {
151
+ username,
152
+ password,
153
+ },
154
+ withCredentials: true,
155
+ };
156
+
157
+ const response = await globalAxios.request<LoginClass>(options);
158
+
159
+ const { data: { accessToken } } = response;
160
+ this.configuration.username = username;
161
+ this.configuration.accessToken = `Bearer ${accessToken}`;
162
+
163
+ const refreshToken = this.extractRefreshToken(response)
164
+ this.configuration.refreshToken = refreshToken;
165
+ }
166
+
167
+ async refreshToken(): Promise<string> {
168
+ const { username, refreshToken } = this.configuration;
169
+
170
+
171
+ if (!username || !refreshToken) {
172
+ return '';
173
+ }
174
+
175
+ const options: AxiosRequestConfig = {
176
+ method: 'POST',
177
+ url: `${this.configuration.basePath}/authservice/v1/refresh-token`,
178
+ headers: {
179
+ 'Content-Type': 'application/json',
180
+ Cookie: refreshToken,
181
+ },
182
+ data: { username: username },
183
+ withCredentials: true,
184
+ };
185
+ const { data: { accessToken } } = await globalAxios.request<LoginClass>(options);
186
+
187
+ return accessToken;
188
+ }
189
+
190
+ private extractRefreshToken(response: AxiosResponse): string {
191
+ if (response.headers && response.headers['set-cookie']
192
+ && response.headers['set-cookie'].length > 0) {
193
+
194
+ return `${response.headers['set-cookie'][0].split(';')[0]};`;
195
+ }
196
+
197
+ return '';
198
+ }
199
+
200
+ getConfiguration(): Configuration {
201
+ return this.configuration;
202
+ }
203
+
204
+ private attachInterceptor(axios: AxiosInstance) {
205
+ axios.interceptors.request.use((config) => {
206
+ if (config.url?.indexOf('refresh-token') === -1) {
207
+ this.lastRequestConfig = config;
208
+ }
209
+
210
+ return config;
211
+ });
212
+ axios.interceptors.response.use(
213
+ (res) => {
214
+ return res;
215
+ },
216
+ async (err) => {
217
+ let originalConfig = err.config;
218
+ if (err.response) {
219
+ // Access Token was expired
220
+ if (err.response.status === 401 && !originalConfig._retry) {
221
+ originalConfig._retry = true;
222
+ try {
223
+ const tokenString = await this.refreshToken();
224
+ const accessToken = `Bearer ${tokenString}`;
225
+
226
+ const localVarHeaderParameter = {} as any;
227
+ localVarHeaderParameter['Authorization'] = accessToken;
228
+
229
+ originalConfig.headers = {
230
+ ...originalConfig.headers,
231
+ ...localVarHeaderParameter,
232
+ };
233
+
234
+ this.configuration.accessToken = accessToken;
235
+
236
+ return axios(originalConfig);
237
+ } catch (_error) {
238
+ if (_error.response && _error.response.data) {
239
+ return Promise.reject(_error.response.data);
240
+ }
241
+ return Promise.reject(_error);
242
+ }
243
+ }
244
+ if (err.response.status === 403 && err.response.data) {
245
+ return Promise.reject(err.response.data);
246
+ }
247
+ } else if (err.message === NETWORK_ERROR_MESSAGE && !originalConfig._retry) {
248
+ try {
249
+ const tokenString = await this.refreshToken();
250
+ const accessToken = `Bearer ${tokenString}`;
251
+
252
+ const localVarHeaderParameter = {} as any;
253
+ localVarHeaderParameter['Authorization'] = accessToken;
254
+
255
+ this.lastRequestConfig.headers = {
256
+ ...originalConfig.headers,
257
+ ...localVarHeaderParameter,
258
+ };
259
+
260
+ originalConfig = {
261
+ ...this.lastRequestConfig,
262
+ }
263
+
264
+ originalConfig._retry = true;
265
+
266
+ this.configuration.accessToken = accessToken;
267
+
268
+ return axios(originalConfig);
269
+ } catch (_error) {
270
+ if (_error.response && _error.response.data) {
271
+ return Promise.reject(_error.response.data);
272
+ }
273
+ return Promise.reject(_error);
274
+ }
275
+ }
276
+ return Promise.reject(err);
277
+ }
278
+ );
279
+ }
280
+ };
281
+
282
+ /**
283
+ *
284
+ * @export
285
+ * @class RequiredError
286
+ * @extends {Error}
287
+ */
288
+ export class RequiredError extends Error {
289
+ name: "RequiredError" = "RequiredError";
290
+ constructor(public field: string, msg?: string) {
291
+ super(msg);
292
+ }
293
+ }
package/common.ts ADDED
@@ -0,0 +1,138 @@
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 { Configuration } from "./configuration";
17
+ import { RequiredError, RequestArgs } from "./base";
18
+ import { AxiosInstance, AxiosResponse } from 'axios';
19
+ import { URL, URLSearchParams } from 'url';
20
+ /**
21
+ *
22
+ * @export
23
+ */
24
+ export const DUMMY_BASE_URL = 'https://example.com'
25
+
26
+ /**
27
+ *
28
+ * @throws {RequiredError}
29
+ * @export
30
+ */
31
+ export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {
32
+ if (paramValue === null || paramValue === undefined) {
33
+ throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
34
+ }
35
+ }
36
+
37
+ /**
38
+ *
39
+ * @export
40
+ */
41
+ export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) {
42
+ if (configuration && configuration.apiKey) {
43
+ const localVarApiKeyValue = typeof configuration.apiKey === 'function'
44
+ ? await configuration.apiKey(keyParamName)
45
+ : await configuration.apiKey;
46
+ object[keyParamName] = localVarApiKeyValue;
47
+ }
48
+ }
49
+
50
+ /**
51
+ *
52
+ * @export
53
+ */
54
+ export const setBasicAuthToObject = function (object: any, configuration?: Configuration) {
55
+ if (configuration && (configuration.username || configuration.password)) {
56
+ object["auth"] = { username: configuration.username, password: configuration.password };
57
+ }
58
+ }
59
+
60
+ /**
61
+ *
62
+ * @export
63
+ */
64
+ export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
65
+ if (configuration && configuration.accessToken) {
66
+ const accessToken = typeof configuration.accessToken === 'function'
67
+ ? await configuration.accessToken()
68
+ : await configuration.accessToken;
69
+ object["Authorization"] = "Bearer " + accessToken;
70
+ }
71
+ }
72
+
73
+ /**
74
+ *
75
+ * @export
76
+ */
77
+ export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {
78
+ if (configuration && configuration.accessToken) {
79
+ const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
80
+ ? await configuration.accessToken(name, scopes)
81
+ : await configuration.accessToken;
82
+ object["Authorization"] = "Bearer " + localVarAccessTokenValue;
83
+ }
84
+ }
85
+
86
+ /**
87
+ *
88
+ * @export
89
+ */
90
+ export const setSearchParams = function (url: URL, ...objects: any[]) {
91
+ const searchParams = new URLSearchParams(url.search);
92
+ for (const object of objects) {
93
+ for (const key in object) {
94
+ if (Array.isArray(object[key])) {
95
+ searchParams.delete(key);
96
+ for (const item of object[key]) {
97
+ searchParams.append(key, item);
98
+ }
99
+ } else {
100
+ searchParams.set(key, object[key]);
101
+ }
102
+ }
103
+ }
104
+ url.search = searchParams.toString();
105
+ }
106
+
107
+ /**
108
+ *
109
+ * @export
110
+ */
111
+ export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
112
+ const nonString = typeof value !== 'string';
113
+ const needsSerialization = nonString && configuration && configuration.isJsonMime
114
+ ? configuration.isJsonMime(requestOptions.headers['Content-Type'])
115
+ : nonString;
116
+ return needsSerialization
117
+ ? JSON.stringify(value !== undefined ? value : {})
118
+ : (value || "");
119
+ }
120
+
121
+ /**
122
+ *
123
+ * @export
124
+ */
125
+ export const toPathString = function (url: URL) {
126
+ return url.pathname + url.search + url.hash
127
+ }
128
+
129
+ /**
130
+ *
131
+ * @export
132
+ */
133
+ export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
134
+ return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
135
+ const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
136
+ return axios.request<T, R>(axiosRequestArgs);
137
+ };
138
+ }
@@ -0,0 +1,109 @@
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
+ export interface ConfigurationParameters {
17
+ apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
18
+ username?: string;
19
+ password?: string;
20
+ accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
21
+ basePath?: string;
22
+ baseOptions?: any;
23
+ formDataCtor?: new () => any;
24
+ }
25
+
26
+ export class Configuration {
27
+ /**
28
+ * parameter for apiKey security
29
+ * @param name security name
30
+ * @memberof Configuration
31
+ */
32
+ apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
33
+ /**
34
+ * parameter for basic security
35
+ *
36
+ * @type {string}
37
+ * @memberof Configuration
38
+ */
39
+ username?: string;
40
+ /**
41
+ * parameter for basic security
42
+ *
43
+ * @type {string}
44
+ * @memberof Configuration
45
+ */
46
+ password?: string;
47
+ /**
48
+ * parameter for oauth2 security
49
+ * @param name security name
50
+ * @param scopes oauth2 scope
51
+ * @memberof Configuration
52
+ */
53
+ accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
54
+ /**
55
+ * override base path
56
+ *
57
+ * @type {string}
58
+ * @memberof Configuration
59
+ */
60
+ basePath?: string;
61
+ /**
62
+ * base options for axios calls
63
+ *
64
+ * @type {any}
65
+ * @memberof Configuration
66
+ */
67
+ baseOptions?: any;
68
+ /**
69
+ * The FormData constructor that will be used to create multipart form data
70
+ * requests. You can inject this here so that execution environments that
71
+ * do not support the FormData class can still run the generated client.
72
+ *
73
+ * @type {new () => FormData}
74
+ */
75
+ formDataCtor?: new () => any;
76
+
77
+ /**
78
+ * parameter for automatically refreshing access token for oauth2 security
79
+ *
80
+ * @type {string}
81
+ * @memberof Configuration
82
+ */
83
+ refreshToken?: string;
84
+
85
+ constructor(param: ConfigurationParameters = {}) {
86
+ this.apiKey = param.apiKey;
87
+ this.username = param.username;
88
+ this.password = param.password;
89
+ this.accessToken = param.accessToken;
90
+ this.basePath = param.basePath;
91
+ this.baseOptions = param.baseOptions;
92
+ this.formDataCtor = param.formDataCtor;
93
+ }
94
+
95
+ /**
96
+ * Check if the given MIME is a JSON MIME.
97
+ * JSON MIME examples:
98
+ * application/json
99
+ * application/json; charset=UTF8
100
+ * APPLICATION/JSON
101
+ * application/vnd.company+json
102
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
103
+ * @return True if the given MIME is JSON, false otherwise.
104
+ */
105
+ public isJsonMime(mime: string): boolean {
106
+ const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
107
+ return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
108
+ }
109
+ }
@@ -0,0 +1,96 @@
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
+ *
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
+ import { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
13
+ import { Configuration } from '../configuration';
14
+ import { RequestArgs, BaseAPI } from '../base';
15
+ import { CreateBankAccountRequestDto } from '../models';
16
+ /**
17
+ * BankAccountsApi - axios parameter creator
18
+ * @export
19
+ */
20
+ export declare const BankAccountsApiAxiosParamCreator: (configuration?: Configuration) => {
21
+ /**
22
+ * Creates a bank account for a specified account.
23
+ * @summary Create a bank account
24
+ * @param {CreateBankAccountRequestDto} createBankAccountRequestDto
25
+ * @param {string} [authorization] Bearer Token
26
+ * @param {*} [options] Override http request option.
27
+ * @throws {RequiredError}
28
+ */
29
+ createBankAccount: (createBankAccountRequestDto: CreateBankAccountRequestDto, authorization?: string, options?: AxiosRequestConfig) => Promise<RequestArgs>;
30
+ };
31
+ /**
32
+ * BankAccountsApi - functional programming interface
33
+ * @export
34
+ */
35
+ export declare const BankAccountsApiFp: (configuration?: Configuration) => {
36
+ /**
37
+ * Creates a bank account for a specified account.
38
+ * @summary Create a bank account
39
+ * @param {CreateBankAccountRequestDto} createBankAccountRequestDto
40
+ * @param {string} [authorization] Bearer Token
41
+ * @param {*} [options] Override http request option.
42
+ * @throws {RequiredError}
43
+ */
44
+ createBankAccount(createBankAccountRequestDto: CreateBankAccountRequestDto, authorization?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<object>>;
45
+ };
46
+ /**
47
+ * BankAccountsApi - factory interface
48
+ * @export
49
+ */
50
+ export declare const BankAccountsApiFactory: (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) => {
51
+ /**
52
+ * Creates a bank account for a specified account.
53
+ * @summary Create a bank account
54
+ * @param {CreateBankAccountRequestDto} createBankAccountRequestDto
55
+ * @param {string} [authorization] Bearer Token
56
+ * @param {*} [options] Override http request option.
57
+ * @throws {RequiredError}
58
+ */
59
+ createBankAccount(createBankAccountRequestDto: CreateBankAccountRequestDto, authorization?: string, options?: any): AxiosPromise<object>;
60
+ };
61
+ /**
62
+ * Request parameters for createBankAccount operation in BankAccountsApi.
63
+ * @export
64
+ * @interface BankAccountsApiCreateBankAccountRequest
65
+ */
66
+ export interface BankAccountsApiCreateBankAccountRequest {
67
+ /**
68
+ *
69
+ * @type {CreateBankAccountRequestDto}
70
+ * @memberof BankAccountsApiCreateBankAccount
71
+ */
72
+ readonly createBankAccountRequestDto: CreateBankAccountRequestDto;
73
+ /**
74
+ * Bearer Token
75
+ * @type {string}
76
+ * @memberof BankAccountsApiCreateBankAccount
77
+ */
78
+ readonly authorization?: string;
79
+ }
80
+ /**
81
+ * BankAccountsApi - object-oriented interface
82
+ * @export
83
+ * @class BankAccountsApi
84
+ * @extends {BaseAPI}
85
+ */
86
+ export declare class BankAccountsApi extends BaseAPI {
87
+ /**
88
+ * Creates a bank account for a specified account.
89
+ * @summary Create a bank account
90
+ * @param {BankAccountsApiCreateBankAccountRequest} requestParameters Request parameters.
91
+ * @param {*} [options] Override http request option.
92
+ * @throws {RequiredError}
93
+ * @memberof BankAccountsApi
94
+ */
95
+ createBankAccount(requestParameters: BankAccountsApiCreateBankAccountRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<object, any>>;
96
+ }