@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,44 @@
1
+ .gitignore
2
+ .npmignore
3
+ .openapi-generator-ignore
4
+ README.md
5
+ api.ts
6
+ api/bank-accounts-api.ts
7
+ api/payment-methods-api.ts
8
+ api/payment-service-providers-api.ts
9
+ api/payment-setup-api.ts
10
+ api/payments-api.ts
11
+ api/webhooks-api.ts
12
+ base.ts
13
+ common.ts
14
+ configuration.ts
15
+ git_push.sh
16
+ index.ts
17
+ models/complete-braintree-payment-setup-request-dto.ts
18
+ models/complete-payment-setup-request-dto.ts
19
+ models/complete-payment-setup-response-class.ts
20
+ models/complete-stripe-payment-setup-request-dto.ts
21
+ models/create-bank-account-request-dto.ts
22
+ models/create-payment-method-response-class.ts
23
+ models/create-payment-request-dto.ts
24
+ models/create-payment-response-class.ts
25
+ models/create-psp-payment-method-request-dto.ts
26
+ models/get-payment-method-response-class.ts
27
+ models/get-payment-response-class.ts
28
+ models/get-request-dto.ts
29
+ models/index.ts
30
+ models/initiate-braintree-payment-setup-request-dto.ts
31
+ models/initiate-braintree-payment-setup-response-class.ts
32
+ models/initiate-payment-setup-request-dto.ts
33
+ models/initiate-payment-setup-response-class.ts
34
+ models/initiate-stripe-payment-setup-request-dto.ts
35
+ models/initiate-stripe-payment-setup-response-class.ts
36
+ models/list-payment-methods-response-class.ts
37
+ models/list-payments-response-class.ts
38
+ models/payment-class.ts
39
+ models/payment-method-class.ts
40
+ models/sepa-direct-dto.ts
41
+ models/validate-pspconfig-request-dto.ts
42
+ models/validate-pspconfig-response-class.ts
43
+ package.json
44
+ tsconfig.json
@@ -0,0 +1 @@
1
+ 5.4.0
@@ -0,0 +1,23 @@
1
+ # OpenAPI Generator Ignore
2
+ # Generated by openapi-generator https://github.com/openapitools/openapi-generator
3
+
4
+ # Use this file to prevent files from being overwritten by the generator.
5
+ # The patterns follow closely to .gitignore or .dockerignore.
6
+
7
+ # As an example, the C# client generator defines ApiClient.cs.
8
+ # You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
9
+ #ApiClient.cs
10
+
11
+ # You can match any string of characters against a directory, file or extension with a single asterisk (*):
12
+ #foo/*/qux
13
+ # The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14
+
15
+ # You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16
+ #foo/**/qux
17
+ # This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18
+
19
+ # You can also negate patterns with an exclamation (!).
20
+ # For example, you can ignore all files in a docs folder with the file extension .md:
21
+ #docs/*.md
22
+ # Then explicitly reverse the ignore rule for a single file:
23
+ #!docs/README.md
package/README.md ADDED
@@ -0,0 +1,68 @@
1
+ # Emil Payment SDK for Nodejs
2
+
3
+ This TypeScript/JavaScript client utilizes [axios](https://github.com/axios/axios). The generated Node module can be used with Nodejs based applications.
4
+
5
+ Language level
6
+ * ES5 - you must have a Promises/A+ library installed
7
+ * ES6
8
+
9
+ Module system
10
+ * CommonJS
11
+ * ES6 module system
12
+
13
+ Although this package can be used in both TypeScript and JavaScript, it is intended to be used with TypeScript. The definition should be automatically resolved via `package.json`. ([Reference](http://www.typescriptlang.org/docs/handbook/typings-for-npm-packages.html))
14
+
15
+ ## Consuming
16
+
17
+ Navigate to the folder of your consuming project and run one of the following commands:
18
+
19
+ ```
20
+ npm install @emilgroup/payment-sdk-node@1.0.0 --save
21
+ ```
22
+ or
23
+ ```
24
+ yarn add @emilgroup/payment-sdk-node@1.0.0
25
+ ```
26
+
27
+ And then you can import `PaymentsApi`.
28
+
29
+ ```ts
30
+ import { PaymentsApi } from '@emilgroup/payment-sdk-node'
31
+
32
+ const paymentsApi = new PaymentsApi();
33
+ ```
34
+ ## Credentials
35
+
36
+ To use authentication protected endpoints, you have to first authorize. To do so, the easiest way is to provide a configuration file under `~/.emil/credentials` with the following content:
37
+
38
+ ```shell
39
+ emil_username=XXXXX@XXXX.XXX
40
+ emil_password=XXXXXXXXXXXXXX
41
+ ```
42
+
43
+ It is also possible to provide environment variables instead:
44
+
45
+ ```shell
46
+ export EMIL_USERNAME=XXXXX@XXXX.XXX
47
+ export EMIL_PASSWORD=XXXXXXXXXXXXXX
48
+ ```
49
+
50
+ ## Example
51
+
52
+ Here is a basic functionning example:
53
+
54
+ ```ts
55
+ async function listPayments(): Promise<Void> {
56
+ try {
57
+ const paymentsApi = new PaymentsApi();
58
+
59
+ await paymentsApi.initialize(); // should be called only once per Api.
60
+
61
+ const { data: { items } } = await paymentsApi.listPayments();
62
+
63
+ console.log(items);
64
+ } catch(error) {
65
+ // process error
66
+ }
67
+ }
68
+ ```
@@ -0,0 +1,167 @@
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 { CreateBankAccountRequestDto } from '../models';
25
+ // URLSearchParams not necessarily used
26
+ // @ts-ignore
27
+ import { URL, URLSearchParams } from 'url';
28
+ const FormData = require('form-data');
29
+ /**
30
+ * BankAccountsApi - axios parameter creator
31
+ * @export
32
+ */
33
+ export const BankAccountsApiAxiosParamCreator = function (configuration?: Configuration) {
34
+ return {
35
+ /**
36
+ * Creates a bank account for a specified account.
37
+ * @summary Create a bank account
38
+ * @param {CreateBankAccountRequestDto} createBankAccountRequestDto
39
+ * @param {string} [authorization] Bearer Token
40
+ * @param {*} [options] Override http request option.
41
+ * @throws {RequiredError}
42
+ */
43
+ createBankAccount: async (createBankAccountRequestDto: CreateBankAccountRequestDto, authorization?: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
44
+ // verify required parameter 'createBankAccountRequestDto' is not null or undefined
45
+ assertParamExists('createBankAccount', 'createBankAccountRequestDto', createBankAccountRequestDto)
46
+ const localVarPath = `/paymentservice/v1/bank-accounts`;
47
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
48
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
49
+ let baseOptions;
50
+ let baseAccessToken;
51
+ if (configuration) {
52
+ baseOptions = configuration.baseOptions;
53
+ baseAccessToken = configuration.accessToken;
54
+ }
55
+
56
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
57
+ const localVarHeaderParameter = {} as any;
58
+ const localVarQueryParameter = {} as any;
59
+
60
+ // authentication bearer required
61
+ // http bearer authentication required
62
+ await setBearerAuthToObject(localVarHeaderParameter, configuration)
63
+
64
+ if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
65
+ localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
66
+ }
67
+
68
+
69
+
70
+ localVarHeaderParameter['Content-Type'] = 'application/json';
71
+
72
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
73
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
74
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
75
+ localVarRequestOptions.data = serializeDataIfNeeded(createBankAccountRequestDto, localVarRequestOptions, configuration)
76
+
77
+ return {
78
+ url: toPathString(localVarUrlObj),
79
+ options: localVarRequestOptions,
80
+ };
81
+ },
82
+ }
83
+ };
84
+
85
+ /**
86
+ * BankAccountsApi - functional programming interface
87
+ * @export
88
+ */
89
+ export const BankAccountsApiFp = function(configuration?: Configuration) {
90
+ const localVarAxiosParamCreator = BankAccountsApiAxiosParamCreator(configuration)
91
+ return {
92
+ /**
93
+ * Creates a bank account for a specified account.
94
+ * @summary Create a bank account
95
+ * @param {CreateBankAccountRequestDto} createBankAccountRequestDto
96
+ * @param {string} [authorization] Bearer Token
97
+ * @param {*} [options] Override http request option.
98
+ * @throws {RequiredError}
99
+ */
100
+ async createBankAccount(createBankAccountRequestDto: CreateBankAccountRequestDto, authorization?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<object>> {
101
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createBankAccount(createBankAccountRequestDto, authorization, options);
102
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
103
+ },
104
+ }
105
+ };
106
+
107
+ /**
108
+ * BankAccountsApi - factory interface
109
+ * @export
110
+ */
111
+ export const BankAccountsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
112
+ const localVarFp = BankAccountsApiFp(configuration)
113
+ return {
114
+ /**
115
+ * Creates a bank account for a specified account.
116
+ * @summary Create a bank account
117
+ * @param {CreateBankAccountRequestDto} createBankAccountRequestDto
118
+ * @param {string} [authorization] Bearer Token
119
+ * @param {*} [options] Override http request option.
120
+ * @throws {RequiredError}
121
+ */
122
+ createBankAccount(createBankAccountRequestDto: CreateBankAccountRequestDto, authorization?: string, options?: any): AxiosPromise<object> {
123
+ return localVarFp.createBankAccount(createBankAccountRequestDto, authorization, options).then((request) => request(axios, basePath));
124
+ },
125
+ };
126
+ };
127
+
128
+ /**
129
+ * Request parameters for createBankAccount operation in BankAccountsApi.
130
+ * @export
131
+ * @interface BankAccountsApiCreateBankAccountRequest
132
+ */
133
+ export interface BankAccountsApiCreateBankAccountRequest {
134
+ /**
135
+ *
136
+ * @type {CreateBankAccountRequestDto}
137
+ * @memberof BankAccountsApiCreateBankAccount
138
+ */
139
+ readonly createBankAccountRequestDto: CreateBankAccountRequestDto
140
+
141
+ /**
142
+ * Bearer Token
143
+ * @type {string}
144
+ * @memberof BankAccountsApiCreateBankAccount
145
+ */
146
+ readonly authorization?: string
147
+ }
148
+
149
+ /**
150
+ * BankAccountsApi - object-oriented interface
151
+ * @export
152
+ * @class BankAccountsApi
153
+ * @extends {BaseAPI}
154
+ */
155
+ export class BankAccountsApi extends BaseAPI {
156
+ /**
157
+ * Creates a bank account for a specified account.
158
+ * @summary Create a bank account
159
+ * @param {BankAccountsApiCreateBankAccountRequest} requestParameters Request parameters.
160
+ * @param {*} [options] Override http request option.
161
+ * @throws {RequiredError}
162
+ * @memberof BankAccountsApi
163
+ */
164
+ public createBankAccount(requestParameters: BankAccountsApiCreateBankAccountRequest, options?: AxiosRequestConfig) {
165
+ return BankAccountsApiFp(this.configuration).createBankAccount(requestParameters.createBankAccountRequestDto, requestParameters.authorization, options).then((request) => request(this.axios, this.basePath));
166
+ }
167
+ }