@kanmon/sdk 2.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 (137) hide show
  1. package/README.md +2 -0
  2. package/package.json +45 -0
  3. package/src/index.ts +65 -0
  4. package/src/openapi/.openapi-generator/FILES +130 -0
  5. package/src/openapi/.openapi-generator/VERSION +1 -0
  6. package/src/openapi/.openapi-generator-ignore +30 -0
  7. package/src/openapi/apis/BankAccountsApi.ts +503 -0
  8. package/src/openapi/apis/BusinessesApi.ts +614 -0
  9. package/src/openapi/apis/ConnectTokensApi.ts +133 -0
  10. package/src/openapi/apis/DocumentsApi.ts +150 -0
  11. package/src/openapi/apis/DrawRequestsApi.ts +258 -0
  12. package/src/openapi/apis/EmbeddedSessionsApi.ts +141 -0
  13. package/src/openapi/apis/InvoicesApi.ts +272 -0
  14. package/src/openapi/apis/IssuedProductsApi.ts +251 -0
  15. package/src/openapi/apis/OffersApi.ts +251 -0
  16. package/src/openapi/apis/PaymentsApi.ts +268 -0
  17. package/src/openapi/apis/PrequalificationsApi.ts +141 -0
  18. package/src/openapi/apis/UsersApi.ts +622 -0
  19. package/src/openapi/apis/baseapi.ts +37 -0
  20. package/src/openapi/apis/exception.ts +15 -0
  21. package/src/openapi/auth/auth.ts +79 -0
  22. package/src/openapi/configuration.ts +82 -0
  23. package/src/openapi/http/http.ts +247 -0
  24. package/src/openapi/http/isomorphic-fetch.ts +32 -0
  25. package/src/openapi/index.ts +12 -0
  26. package/src/openapi/middleware.ts +66 -0
  27. package/src/openapi/models/ActivityLog.ts +98 -0
  28. package/src/openapi/models/Address.ts +140 -0
  29. package/src/openapi/models/BadRequestException.ts +63 -0
  30. package/src/openapi/models/BankAccountAlreadyExistException.ts +63 -0
  31. package/src/openapi/models/BankAccountNotFoundException.ts +63 -0
  32. package/src/openapi/models/BankStatementsInvalidException.ts +63 -0
  33. package/src/openapi/models/Business.ts +126 -0
  34. package/src/openapi/models/BusinessAddress.ts +143 -0
  35. package/src/openapi/models/BusinessAlreadyExistsException.ts +63 -0
  36. package/src/openapi/models/BusinessBankAccount.ts +126 -0
  37. package/src/openapi/models/BusinessDocument.ts +98 -0
  38. package/src/openapi/models/BusinessDocumentType.ts +17 -0
  39. package/src/openapi/models/BusinessHasNoInvoiceFinancingProductException.ts +63 -0
  40. package/src/openapi/models/BusinessHasNoPrimaryOwnerException.ts +63 -0
  41. package/src/openapi/models/BusinessNotFoundException.ts +63 -0
  42. package/src/openapi/models/BusinessPlaidBankAccountNotFoundException.ts +63 -0
  43. package/src/openapi/models/BusinessPrequalification.ts +116 -0
  44. package/src/openapi/models/CheckingAccountRequiredException.ts +63 -0
  45. package/src/openapi/models/ConnectToken.ts +38 -0
  46. package/src/openapi/models/CreateBusinessBankAccountRequestBody.ts +116 -0
  47. package/src/openapi/models/CreateBusinessDocumentsResponse.ts +39 -0
  48. package/src/openapi/models/CreateBusinessRequestBody.ts +99 -0
  49. package/src/openapi/models/CreateConnectTokenRequestBody.ts +48 -0
  50. package/src/openapi/models/CreateEmbeddedSession409Response.ts +65 -0
  51. package/src/openapi/models/CreateSessionTokenRequestBody.ts +56 -0
  52. package/src/openapi/models/CreateSessionTokenRequestBodyData.ts +56 -0
  53. package/src/openapi/models/CreateUser409Response.ts +66 -0
  54. package/src/openapi/models/CreateUserRequestBody.ts +125 -0
  55. package/src/openapi/models/DrawRequest.ts +138 -0
  56. package/src/openapi/models/DrawRequestNotFoundException.ts +63 -0
  57. package/src/openapi/models/DrawRequestState.ts +21 -0
  58. package/src/openapi/models/EmbeddedSession.ts +38 -0
  59. package/src/openapi/models/FixedDateInvoiceRepaymentWindow.ts +50 -0
  60. package/src/openapi/models/FixedDurationInvoiceRepaymentWindow.ts +50 -0
  61. package/src/openapi/models/ForbiddenException.ts +63 -0
  62. package/src/openapi/models/GetActivityLogsResponse.ts +50 -0
  63. package/src/openapi/models/GetBusinessBankAccountsResponse.ts +50 -0
  64. package/src/openapi/models/GetBusinessesResponse.ts +50 -0
  65. package/src/openapi/models/GetDrawRequestsResponse.ts +50 -0
  66. package/src/openapi/models/GetInvoice404Response.ts +65 -0
  67. package/src/openapi/models/GetInvoicesResponse.ts +50 -0
  68. package/src/openapi/models/GetIssuedProductsResponse.ts +50 -0
  69. package/src/openapi/models/GetOffersResponse.ts +50 -0
  70. package/src/openapi/models/GetPaymentScheduleResponse.ts +50 -0
  71. package/src/openapi/models/GetPrequalificationsResponse.ts +50 -0
  72. package/src/openapi/models/GetUsersResponse.ts +50 -0
  73. package/src/openapi/models/InternalServerErrorException.ts +63 -0
  74. package/src/openapi/models/InvalidInvoiceDueDateException.ts +63 -0
  75. package/src/openapi/models/Invoice.ts +281 -0
  76. package/src/openapi/models/InvoiceFinancingOfferTerms.ts +61 -0
  77. package/src/openapi/models/InvoiceFinancingServicingData.ts +71 -0
  78. package/src/openapi/models/InvoiceFlowSessionTokenData.ts +51 -0
  79. package/src/openapi/models/InvoiceFlowWithInvoiceFileSessionTokenData.ts +51 -0
  80. package/src/openapi/models/InvoiceNotFoundException.ts +63 -0
  81. package/src/openapi/models/InvoicePaymentPlan.ts +58 -0
  82. package/src/openapi/models/InvoicePayorAddress.ts +143 -0
  83. package/src/openapi/models/InvoiceRepaymentSchedule.ts +39 -0
  84. package/src/openapi/models/InvoiceRepaymentScheduleItem.ts +68 -0
  85. package/src/openapi/models/InvoiceStatus.ts +22 -0
  86. package/src/openapi/models/IssuedProduct.ts +115 -0
  87. package/src/openapi/models/IssuedProductNotFoundException.ts +63 -0
  88. package/src/openapi/models/IssuedProductServicingData.ts +234 -0
  89. package/src/openapi/models/LineOfCreditOfferTerms.ts +80 -0
  90. package/src/openapi/models/LineOfCreditServicingData.ts +90 -0
  91. package/src/openapi/models/McaOfferTerms.ts +96 -0
  92. package/src/openapi/models/McaServicingData.ts +116 -0
  93. package/src/openapi/models/MergeUsersRequestBody.ts +68 -0
  94. package/src/openapi/models/MergeUsersResponseBody.ts +39 -0
  95. package/src/openapi/models/MultipleDurationInvoiceRepaymentWindow.ts +48 -0
  96. package/src/openapi/models/ObjectSerializer.ts +643 -0
  97. package/src/openapi/models/Offer.ts +106 -0
  98. package/src/openapi/models/OfferAlreadySelectedException.ts +63 -0
  99. package/src/openapi/models/OfferNotFoundException.ts +63 -0
  100. package/src/openapi/models/OfferNotLockedException.ts +63 -0
  101. package/src/openapi/models/OfferTerms.ts +184 -0
  102. package/src/openapi/models/PaginationResult.ts +58 -0
  103. package/src/openapi/models/PaymentOrder.ts +198 -0
  104. package/src/openapi/models/PaymentOrderNotFoundException.ts +63 -0
  105. package/src/openapi/models/PaymentOrderStatus.ts +19 -0
  106. package/src/openapi/models/PaymentPlanRepaymentSchedule.ts +39 -0
  107. package/src/openapi/models/PaymentPlanRepaymentScheduleItem.ts +48 -0
  108. package/src/openapi/models/PaymentScheduleItem.ts +56 -0
  109. package/src/openapi/models/PaymentScheduleItemPaymentOrder.ts +201 -0
  110. package/src/openapi/models/PlaidAssetReportsInvalidException.ts +63 -0
  111. package/src/openapi/models/PlatformInvoiceIdAlreadyExistsForAnotherIssuedProductException.ts +63 -0
  112. package/src/openapi/models/PrimaryBusinessOwnerAlreadyExistsForBusinessException.ts +63 -0
  113. package/src/openapi/models/PrimaryBusinessOwnerAlreadyExistsWithEmailException.ts +63 -0
  114. package/src/openapi/models/PrimaryBusinessOwnerNotFoundException.ts +63 -0
  115. package/src/openapi/models/SessionInvoice.ts +165 -0
  116. package/src/openapi/models/SessionInvoiceWithInvoiceFile.ts +175 -0
  117. package/src/openapi/models/SomeOffersHaveExpiredException.ts +63 -0
  118. package/src/openapi/models/TermLoanOfferTerms.ts +90 -0
  119. package/src/openapi/models/TermLoanServicingData.ts +100 -0
  120. package/src/openapi/models/UnmergeableBusinessException.ts +63 -0
  121. package/src/openapi/models/UpdateBusinessAccountRequestBody.ts +68 -0
  122. package/src/openapi/models/UpdateBusinessRequestBody.ts +99 -0
  123. package/src/openapi/models/UpdateUser409Response.ts +65 -0
  124. package/src/openapi/models/UpdateUserRequestBody.ts +95 -0
  125. package/src/openapi/models/User.ts +152 -0
  126. package/src/openapi/models/UserAddress.ts +143 -0
  127. package/src/openapi/models/UserAlreadyExistsWithEmailException.ts +63 -0
  128. package/src/openapi/models/UserAlreadyExistsWithPlatformUserIdException.ts +63 -0
  129. package/src/openapi/models/UserNotFoundException.ts +63 -0
  130. package/src/openapi/models/all.ts +102 -0
  131. package/src/openapi/rxjsStub.ts +27 -0
  132. package/src/openapi/servers.ts +58 -0
  133. package/src/openapi/types/ObjectParamAPI.ts +1403 -0
  134. package/src/openapi/types/ObservableAPI.ts +1348 -0
  135. package/src/openapi/types/PromiseAPI.ts +995 -0
  136. package/src/openapi/util.ts +37 -0
  137. package/tsconfig.json +32 -0
@@ -0,0 +1,251 @@
1
+ // TODO: better import syntax?
2
+ import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi';
3
+ import {Configuration} from '../configuration';
4
+ import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http';
5
+ import FormData from "form-data";
6
+ import { URLSearchParams } from 'url';
7
+ import {ObjectSerializer} from '../models/ObjectSerializer';
8
+ import {ApiException} from './exception';
9
+ import {canConsumeForm, isCodeInRange} from '../util';
10
+ import {SecurityAuthentication} from '../auth/auth';
11
+
12
+
13
+ import { BadRequestException } from '../models/BadRequestException';
14
+ import { ForbiddenException } from '../models/ForbiddenException';
15
+ import { GetOffersResponse } from '../models/GetOffersResponse';
16
+ import { InternalServerErrorException } from '../models/InternalServerErrorException';
17
+ import { Offer } from '../models/Offer';
18
+ import { OfferNotFoundException } from '../models/OfferNotFoundException';
19
+
20
+ /**
21
+ * no description
22
+ */
23
+ export class OffersApiRequestFactory extends BaseAPIRequestFactory {
24
+
25
+ /**
26
+ * Fetch offers
27
+ * @param ids A comma delimited list of Kanmon’s unique IDs for offers.
28
+ * @param platformBusinessIds A comma delimited list of your platform’s unique IDs for businesses.
29
+ * @param businessIds A comma delimited list of Kanmon’s unique IDs for businesses.
30
+ * @param offset The number of records to skip when performing pagination. Defaults to `0`.
31
+ * @param limit The number of records to limit when performing pagination. Defaults to `100`, which is the max.
32
+ * @param createdAtStart Filter for records where `createdAt` is greater than or equal to this value. ISO 8601 format.
33
+ * @param createdAtEnd Filter for records where `createdAt` is less than or equal to this value. ISO 8601 format.
34
+ */
35
+ public async getAllOffers(ids?: string, platformBusinessIds?: string, businessIds?: string, offset?: number, limit?: number, createdAtStart?: string, createdAtEnd?: string, _options?: Configuration): Promise<RequestContext> {
36
+ let _config = _options || this.configuration;
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+ // Path Params
46
+ const localVarPath = '/api/platform/v2/offers';
47
+
48
+ // Make Request Context
49
+ const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
50
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
51
+
52
+ // Query Params
53
+ if (ids !== undefined) {
54
+ requestContext.setQueryParam("ids", ObjectSerializer.serialize(ids, "string", ""));
55
+ }
56
+
57
+ // Query Params
58
+ if (platformBusinessIds !== undefined) {
59
+ requestContext.setQueryParam("platformBusinessIds", ObjectSerializer.serialize(platformBusinessIds, "string", ""));
60
+ }
61
+
62
+ // Query Params
63
+ if (businessIds !== undefined) {
64
+ requestContext.setQueryParam("businessIds", ObjectSerializer.serialize(businessIds, "string", ""));
65
+ }
66
+
67
+ // Query Params
68
+ if (offset !== undefined) {
69
+ requestContext.setQueryParam("offset", ObjectSerializer.serialize(offset, "number", ""));
70
+ }
71
+
72
+ // Query Params
73
+ if (limit !== undefined) {
74
+ requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", ""));
75
+ }
76
+
77
+ // Query Params
78
+ if (createdAtStart !== undefined) {
79
+ requestContext.setQueryParam("createdAtStart", ObjectSerializer.serialize(createdAtStart, "string", ""));
80
+ }
81
+
82
+ // Query Params
83
+ if (createdAtEnd !== undefined) {
84
+ requestContext.setQueryParam("createdAtEnd", ObjectSerializer.serialize(createdAtEnd, "string", ""));
85
+ }
86
+
87
+
88
+ let authMethod: SecurityAuthentication | undefined;
89
+ // Apply auth methods
90
+ authMethod = _config.authMethods["Authorization"]
91
+ if (authMethod?.applySecurityAuthentication) {
92
+ await authMethod?.applySecurityAuthentication(requestContext);
93
+ }
94
+
95
+ const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
96
+ if (defaultAuth?.applySecurityAuthentication) {
97
+ await defaultAuth?.applySecurityAuthentication(requestContext);
98
+ }
99
+
100
+ return requestContext;
101
+ }
102
+
103
+ /**
104
+ * Fetch an offer
105
+ * @param id The Kanmon offer UUID.
106
+ */
107
+ public async getOfferById(id: string, _options?: Configuration): Promise<RequestContext> {
108
+ let _config = _options || this.configuration;
109
+
110
+ // verify required parameter 'id' is not null or undefined
111
+ if (id === null || id === undefined) {
112
+ throw new RequiredError("OffersApi", "getOfferById", "id");
113
+ }
114
+
115
+
116
+ // Path Params
117
+ const localVarPath = '/api/platform/v2/offers/{id}'
118
+ .replace('{' + 'id' + '}', encodeURIComponent(String(id)));
119
+
120
+ // Make Request Context
121
+ const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
122
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
123
+
124
+
125
+ let authMethod: SecurityAuthentication | undefined;
126
+ // Apply auth methods
127
+ authMethod = _config.authMethods["Authorization"]
128
+ if (authMethod?.applySecurityAuthentication) {
129
+ await authMethod?.applySecurityAuthentication(requestContext);
130
+ }
131
+
132
+ const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
133
+ if (defaultAuth?.applySecurityAuthentication) {
134
+ await defaultAuth?.applySecurityAuthentication(requestContext);
135
+ }
136
+
137
+ return requestContext;
138
+ }
139
+
140
+ }
141
+
142
+ export class OffersApiResponseProcessor {
143
+
144
+ /**
145
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
146
+ * to the expected objects
147
+ *
148
+ * @params response Response returned by the server for a request to getAllOffers
149
+ * @throws ApiException if the response code was not in [200, 299]
150
+ */
151
+ public async getAllOffersWithHttpInfo(response: ResponseContext): Promise<HttpInfo<GetOffersResponse >> {
152
+ const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
153
+ if (isCodeInRange("200", response.httpStatusCode)) {
154
+ const body: GetOffersResponse = ObjectSerializer.deserialize(
155
+ ObjectSerializer.parse(await response.body.text(), contentType),
156
+ "GetOffersResponse", ""
157
+ ) as GetOffersResponse;
158
+ return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
159
+ }
160
+ if (isCodeInRange("400", response.httpStatusCode)) {
161
+ const body: BadRequestException = ObjectSerializer.deserialize(
162
+ ObjectSerializer.parse(await response.body.text(), contentType),
163
+ "BadRequestException", ""
164
+ ) as BadRequestException;
165
+ throw new ApiException<BadRequestException>(response.httpStatusCode, "BadRequestException", body, response.headers);
166
+ }
167
+ if (isCodeInRange("403", response.httpStatusCode)) {
168
+ const body: ForbiddenException = ObjectSerializer.deserialize(
169
+ ObjectSerializer.parse(await response.body.text(), contentType),
170
+ "ForbiddenException", ""
171
+ ) as ForbiddenException;
172
+ throw new ApiException<ForbiddenException>(response.httpStatusCode, "ForbiddenException", body, response.headers);
173
+ }
174
+ if (isCodeInRange("500", response.httpStatusCode)) {
175
+ const body: InternalServerErrorException = ObjectSerializer.deserialize(
176
+ ObjectSerializer.parse(await response.body.text(), contentType),
177
+ "InternalServerErrorException", ""
178
+ ) as InternalServerErrorException;
179
+ throw new ApiException<InternalServerErrorException>(response.httpStatusCode, "InternalServerErrorException", body, response.headers);
180
+ }
181
+
182
+ // Work around for missing responses in specification, e.g. for petstore.yaml
183
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
184
+ const body: GetOffersResponse = ObjectSerializer.deserialize(
185
+ ObjectSerializer.parse(await response.body.text(), contentType),
186
+ "GetOffersResponse", ""
187
+ ) as GetOffersResponse;
188
+ return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
189
+ }
190
+
191
+ throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
192
+ }
193
+
194
+ /**
195
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
196
+ * to the expected objects
197
+ *
198
+ * @params response Response returned by the server for a request to getOfferById
199
+ * @throws ApiException if the response code was not in [200, 299]
200
+ */
201
+ public async getOfferByIdWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Offer >> {
202
+ const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
203
+ if (isCodeInRange("200", response.httpStatusCode)) {
204
+ const body: Offer = ObjectSerializer.deserialize(
205
+ ObjectSerializer.parse(await response.body.text(), contentType),
206
+ "Offer", ""
207
+ ) as Offer;
208
+ return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
209
+ }
210
+ if (isCodeInRange("400", response.httpStatusCode)) {
211
+ const body: BadRequestException = ObjectSerializer.deserialize(
212
+ ObjectSerializer.parse(await response.body.text(), contentType),
213
+ "BadRequestException", ""
214
+ ) as BadRequestException;
215
+ throw new ApiException<BadRequestException>(response.httpStatusCode, "BadRequestException", body, response.headers);
216
+ }
217
+ if (isCodeInRange("403", response.httpStatusCode)) {
218
+ const body: ForbiddenException = ObjectSerializer.deserialize(
219
+ ObjectSerializer.parse(await response.body.text(), contentType),
220
+ "ForbiddenException", ""
221
+ ) as ForbiddenException;
222
+ throw new ApiException<ForbiddenException>(response.httpStatusCode, "ForbiddenException", body, response.headers);
223
+ }
224
+ if (isCodeInRange("404", response.httpStatusCode)) {
225
+ const body: OfferNotFoundException = ObjectSerializer.deserialize(
226
+ ObjectSerializer.parse(await response.body.text(), contentType),
227
+ "OfferNotFoundException", ""
228
+ ) as OfferNotFoundException;
229
+ throw new ApiException<OfferNotFoundException>(response.httpStatusCode, "OfferNotFoundException", body, response.headers);
230
+ }
231
+ if (isCodeInRange("500", response.httpStatusCode)) {
232
+ const body: InternalServerErrorException = ObjectSerializer.deserialize(
233
+ ObjectSerializer.parse(await response.body.text(), contentType),
234
+ "InternalServerErrorException", ""
235
+ ) as InternalServerErrorException;
236
+ throw new ApiException<InternalServerErrorException>(response.httpStatusCode, "InternalServerErrorException", body, response.headers);
237
+ }
238
+
239
+ // Work around for missing responses in specification, e.g. for petstore.yaml
240
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
241
+ const body: Offer = ObjectSerializer.deserialize(
242
+ ObjectSerializer.parse(await response.body.text(), contentType),
243
+ "Offer", ""
244
+ ) as Offer;
245
+ return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
246
+ }
247
+
248
+ throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
249
+ }
250
+
251
+ }
@@ -0,0 +1,268 @@
1
+ // TODO: better import syntax?
2
+ import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi';
3
+ import {Configuration} from '../configuration';
4
+ import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http';
5
+ import FormData from "form-data";
6
+ import { URLSearchParams } from 'url';
7
+ import {ObjectSerializer} from '../models/ObjectSerializer';
8
+ import {ApiException} from './exception';
9
+ import {canConsumeForm, isCodeInRange} from '../util';
10
+ import {SecurityAuthentication} from '../auth/auth';
11
+
12
+
13
+ import { BadRequestException } from '../models/BadRequestException';
14
+ import { ForbiddenException } from '../models/ForbiddenException';
15
+ import { GetPaymentScheduleResponse } from '../models/GetPaymentScheduleResponse';
16
+ import { InternalServerErrorException } from '../models/InternalServerErrorException';
17
+ import { IssuedProductNotFoundException } from '../models/IssuedProductNotFoundException';
18
+ import { PaymentOrder } from '../models/PaymentOrder';
19
+ import { PaymentOrderNotFoundException } from '../models/PaymentOrderNotFoundException';
20
+ import { PaymentOrderStatus } from '../models/PaymentOrderStatus';
21
+
22
+ /**
23
+ * no description
24
+ */
25
+ export class PaymentsApiRequestFactory extends BaseAPIRequestFactory {
26
+
27
+ /**
28
+ * Fetch a payment
29
+ * @param id The Kanmon payment order UUID.
30
+ */
31
+ public async getPaymentById(id: string, _options?: Configuration): Promise<RequestContext> {
32
+ let _config = _options || this.configuration;
33
+
34
+ // verify required parameter 'id' is not null or undefined
35
+ if (id === null || id === undefined) {
36
+ throw new RequiredError("PaymentsApi", "getPaymentById", "id");
37
+ }
38
+
39
+
40
+ // Path Params
41
+ const localVarPath = '/api/platform/v2/payments/{id}'
42
+ .replace('{' + 'id' + '}', encodeURIComponent(String(id)));
43
+
44
+ // Make Request Context
45
+ const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
46
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
47
+
48
+
49
+ let authMethod: SecurityAuthentication | undefined;
50
+ // Apply auth methods
51
+ authMethod = _config.authMethods["Authorization"]
52
+ if (authMethod?.applySecurityAuthentication) {
53
+ await authMethod?.applySecurityAuthentication(requestContext);
54
+ }
55
+
56
+ const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
57
+ if (defaultAuth?.applySecurityAuthentication) {
58
+ await defaultAuth?.applySecurityAuthentication(requestContext);
59
+ }
60
+
61
+ return requestContext;
62
+ }
63
+
64
+ /**
65
+ * Fetch payment schedule for an issued product
66
+ * @param id The Kanmon issued product UUID.
67
+ * @param drawRequestIds A comma delimited list of Kanmon’s unique draw request IDs.
68
+ * @param invoiceIds A comma delimited list of Kanmon’s unique IDs for invoices.
69
+ * @param platformInvoiceIds A comma delimited list of your platform’s unique IDs for invoices.
70
+ * @param direction The direction of the payment.
71
+ * @param status The status of the payment.
72
+ * @param offset The number of records to skip when performing pagination. Defaults to &#x60;0&#x60;.
73
+ * @param limit The number of records to limit when performing pagination. Defaults to &#x60;100&#x60;, which is the max.
74
+ */
75
+ public async getPaymentScheduleForAIssuedProduct(id: string, drawRequestIds?: string, invoiceIds?: string, platformInvoiceIds?: string, direction?: 'DISBURSEMENT' | 'REPAYMENT', status?: PaymentOrderStatus, offset?: number, limit?: number, _options?: Configuration): Promise<RequestContext> {
76
+ let _config = _options || this.configuration;
77
+
78
+ // verify required parameter 'id' is not null or undefined
79
+ if (id === null || id === undefined) {
80
+ throw new RequiredError("PaymentsApi", "getPaymentScheduleForAIssuedProduct", "id");
81
+ }
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+ // Path Params
92
+ const localVarPath = '/api/platform/v2/issued-products/{id}/payment-schedule'
93
+ .replace('{' + 'id' + '}', encodeURIComponent(String(id)));
94
+
95
+ // Make Request Context
96
+ const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
97
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
98
+
99
+ // Query Params
100
+ if (drawRequestIds !== undefined) {
101
+ requestContext.setQueryParam("drawRequestIds", ObjectSerializer.serialize(drawRequestIds, "string", ""));
102
+ }
103
+
104
+ // Query Params
105
+ if (invoiceIds !== undefined) {
106
+ requestContext.setQueryParam("invoiceIds", ObjectSerializer.serialize(invoiceIds, "string", ""));
107
+ }
108
+
109
+ // Query Params
110
+ if (platformInvoiceIds !== undefined) {
111
+ requestContext.setQueryParam("platformInvoiceIds", ObjectSerializer.serialize(platformInvoiceIds, "string", ""));
112
+ }
113
+
114
+ // Query Params
115
+ if (direction !== undefined) {
116
+ requestContext.setQueryParam("direction", ObjectSerializer.serialize(direction, "'DISBURSEMENT' | 'REPAYMENT'", ""));
117
+ }
118
+
119
+ // Query Params
120
+ if (status !== undefined) {
121
+ requestContext.setQueryParam("status", ObjectSerializer.serialize(status, "PaymentOrderStatus", ""));
122
+ }
123
+
124
+ // Query Params
125
+ if (offset !== undefined) {
126
+ requestContext.setQueryParam("offset", ObjectSerializer.serialize(offset, "number", ""));
127
+ }
128
+
129
+ // Query Params
130
+ if (limit !== undefined) {
131
+ requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", ""));
132
+ }
133
+
134
+
135
+ let authMethod: SecurityAuthentication | undefined;
136
+ // Apply auth methods
137
+ authMethod = _config.authMethods["Authorization"]
138
+ if (authMethod?.applySecurityAuthentication) {
139
+ await authMethod?.applySecurityAuthentication(requestContext);
140
+ }
141
+
142
+ const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
143
+ if (defaultAuth?.applySecurityAuthentication) {
144
+ await defaultAuth?.applySecurityAuthentication(requestContext);
145
+ }
146
+
147
+ return requestContext;
148
+ }
149
+
150
+ }
151
+
152
+ export class PaymentsApiResponseProcessor {
153
+
154
+ /**
155
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
156
+ * to the expected objects
157
+ *
158
+ * @params response Response returned by the server for a request to getPaymentById
159
+ * @throws ApiException if the response code was not in [200, 299]
160
+ */
161
+ public async getPaymentByIdWithHttpInfo(response: ResponseContext): Promise<HttpInfo<PaymentOrder >> {
162
+ const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
163
+ if (isCodeInRange("200", response.httpStatusCode)) {
164
+ const body: PaymentOrder = ObjectSerializer.deserialize(
165
+ ObjectSerializer.parse(await response.body.text(), contentType),
166
+ "PaymentOrder", ""
167
+ ) as PaymentOrder;
168
+ return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
169
+ }
170
+ if (isCodeInRange("400", response.httpStatusCode)) {
171
+ const body: BadRequestException = ObjectSerializer.deserialize(
172
+ ObjectSerializer.parse(await response.body.text(), contentType),
173
+ "BadRequestException", ""
174
+ ) as BadRequestException;
175
+ throw new ApiException<BadRequestException>(response.httpStatusCode, "BadRequestException", body, response.headers);
176
+ }
177
+ if (isCodeInRange("403", response.httpStatusCode)) {
178
+ const body: ForbiddenException = ObjectSerializer.deserialize(
179
+ ObjectSerializer.parse(await response.body.text(), contentType),
180
+ "ForbiddenException", ""
181
+ ) as ForbiddenException;
182
+ throw new ApiException<ForbiddenException>(response.httpStatusCode, "ForbiddenException", body, response.headers);
183
+ }
184
+ if (isCodeInRange("404", response.httpStatusCode)) {
185
+ const body: PaymentOrderNotFoundException = ObjectSerializer.deserialize(
186
+ ObjectSerializer.parse(await response.body.text(), contentType),
187
+ "PaymentOrderNotFoundException", ""
188
+ ) as PaymentOrderNotFoundException;
189
+ throw new ApiException<PaymentOrderNotFoundException>(response.httpStatusCode, "PaymentOrderNotFoundException", body, response.headers);
190
+ }
191
+ if (isCodeInRange("500", response.httpStatusCode)) {
192
+ const body: InternalServerErrorException = ObjectSerializer.deserialize(
193
+ ObjectSerializer.parse(await response.body.text(), contentType),
194
+ "InternalServerErrorException", ""
195
+ ) as InternalServerErrorException;
196
+ throw new ApiException<InternalServerErrorException>(response.httpStatusCode, "InternalServerErrorException", body, response.headers);
197
+ }
198
+
199
+ // Work around for missing responses in specification, e.g. for petstore.yaml
200
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
201
+ const body: PaymentOrder = ObjectSerializer.deserialize(
202
+ ObjectSerializer.parse(await response.body.text(), contentType),
203
+ "PaymentOrder", ""
204
+ ) as PaymentOrder;
205
+ return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
206
+ }
207
+
208
+ throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
209
+ }
210
+
211
+ /**
212
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
213
+ * to the expected objects
214
+ *
215
+ * @params response Response returned by the server for a request to getPaymentScheduleForAIssuedProduct
216
+ * @throws ApiException if the response code was not in [200, 299]
217
+ */
218
+ public async getPaymentScheduleForAIssuedProductWithHttpInfo(response: ResponseContext): Promise<HttpInfo<GetPaymentScheduleResponse >> {
219
+ const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
220
+ if (isCodeInRange("200", response.httpStatusCode)) {
221
+ const body: GetPaymentScheduleResponse = ObjectSerializer.deserialize(
222
+ ObjectSerializer.parse(await response.body.text(), contentType),
223
+ "GetPaymentScheduleResponse", ""
224
+ ) as GetPaymentScheduleResponse;
225
+ return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
226
+ }
227
+ if (isCodeInRange("400", response.httpStatusCode)) {
228
+ const body: BadRequestException = ObjectSerializer.deserialize(
229
+ ObjectSerializer.parse(await response.body.text(), contentType),
230
+ "BadRequestException", ""
231
+ ) as BadRequestException;
232
+ throw new ApiException<BadRequestException>(response.httpStatusCode, "BadRequestException", body, response.headers);
233
+ }
234
+ if (isCodeInRange("403", response.httpStatusCode)) {
235
+ const body: ForbiddenException = ObjectSerializer.deserialize(
236
+ ObjectSerializer.parse(await response.body.text(), contentType),
237
+ "ForbiddenException", ""
238
+ ) as ForbiddenException;
239
+ throw new ApiException<ForbiddenException>(response.httpStatusCode, "ForbiddenException", body, response.headers);
240
+ }
241
+ if (isCodeInRange("404", response.httpStatusCode)) {
242
+ const body: IssuedProductNotFoundException = ObjectSerializer.deserialize(
243
+ ObjectSerializer.parse(await response.body.text(), contentType),
244
+ "IssuedProductNotFoundException", ""
245
+ ) as IssuedProductNotFoundException;
246
+ throw new ApiException<IssuedProductNotFoundException>(response.httpStatusCode, "IssuedProductNotFoundException", body, response.headers);
247
+ }
248
+ if (isCodeInRange("500", response.httpStatusCode)) {
249
+ const body: InternalServerErrorException = ObjectSerializer.deserialize(
250
+ ObjectSerializer.parse(await response.body.text(), contentType),
251
+ "InternalServerErrorException", ""
252
+ ) as InternalServerErrorException;
253
+ throw new ApiException<InternalServerErrorException>(response.httpStatusCode, "InternalServerErrorException", body, response.headers);
254
+ }
255
+
256
+ // Work around for missing responses in specification, e.g. for petstore.yaml
257
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
258
+ const body: GetPaymentScheduleResponse = ObjectSerializer.deserialize(
259
+ ObjectSerializer.parse(await response.body.text(), contentType),
260
+ "GetPaymentScheduleResponse", ""
261
+ ) as GetPaymentScheduleResponse;
262
+ return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
263
+ }
264
+
265
+ throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
266
+ }
267
+
268
+ }
@@ -0,0 +1,141 @@
1
+ // TODO: better import syntax?
2
+ import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi';
3
+ import {Configuration} from '../configuration';
4
+ import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http';
5
+ import FormData from "form-data";
6
+ import { URLSearchParams } from 'url';
7
+ import {ObjectSerializer} from '../models/ObjectSerializer';
8
+ import {ApiException} from './exception';
9
+ import {canConsumeForm, isCodeInRange} from '../util';
10
+ import {SecurityAuthentication} from '../auth/auth';
11
+
12
+
13
+ import { BadRequestException } from '../models/BadRequestException';
14
+ import { ForbiddenException } from '../models/ForbiddenException';
15
+ import { GetPrequalificationsResponse } from '../models/GetPrequalificationsResponse';
16
+ import { InternalServerErrorException } from '../models/InternalServerErrorException';
17
+
18
+ /**
19
+ * no description
20
+ */
21
+ export class PrequalificationsApiRequestFactory extends BaseAPIRequestFactory {
22
+
23
+ /**
24
+ * Fetch business prequalifications
25
+ * @param platformBusinessIds A comma delimited list of your platform’s unique IDs for businesses.
26
+ * @param offset The number of records to skip when performing pagination. Defaults to &#x60;0&#x60;.
27
+ * @param limit The number of records to limit when performing pagination. Defaults to &#x60;100&#x60;, which is the max.
28
+ * @param createdAtStart Filter for records where &#x60;createdAt&#x60; is greater than or equal to this value. ISO 8601 format.
29
+ * @param createdAtEnd Filter for records where &#x60;createdAt&#x60; is less than or equal to this value. ISO 8601 format.
30
+ */
31
+ public async getPrequalifiedBusinesses(platformBusinessIds?: string, offset?: number, limit?: number, createdAtStart?: string, createdAtEnd?: string, _options?: Configuration): Promise<RequestContext> {
32
+ let _config = _options || this.configuration;
33
+
34
+
35
+
36
+
37
+
38
+
39
+ // Path Params
40
+ const localVarPath = '/api/platform/v2/prequalifications';
41
+
42
+ // Make Request Context
43
+ const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
44
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
45
+
46
+ // Query Params
47
+ if (platformBusinessIds !== undefined) {
48
+ requestContext.setQueryParam("platformBusinessIds", ObjectSerializer.serialize(platformBusinessIds, "string", ""));
49
+ }
50
+
51
+ // Query Params
52
+ if (offset !== undefined) {
53
+ requestContext.setQueryParam("offset", ObjectSerializer.serialize(offset, "number", ""));
54
+ }
55
+
56
+ // Query Params
57
+ if (limit !== undefined) {
58
+ requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", ""));
59
+ }
60
+
61
+ // Query Params
62
+ if (createdAtStart !== undefined) {
63
+ requestContext.setQueryParam("createdAtStart", ObjectSerializer.serialize(createdAtStart, "string", ""));
64
+ }
65
+
66
+ // Query Params
67
+ if (createdAtEnd !== undefined) {
68
+ requestContext.setQueryParam("createdAtEnd", ObjectSerializer.serialize(createdAtEnd, "string", ""));
69
+ }
70
+
71
+
72
+ let authMethod: SecurityAuthentication | undefined;
73
+ // Apply auth methods
74
+ authMethod = _config.authMethods["Authorization"]
75
+ if (authMethod?.applySecurityAuthentication) {
76
+ await authMethod?.applySecurityAuthentication(requestContext);
77
+ }
78
+
79
+ const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
80
+ if (defaultAuth?.applySecurityAuthentication) {
81
+ await defaultAuth?.applySecurityAuthentication(requestContext);
82
+ }
83
+
84
+ return requestContext;
85
+ }
86
+
87
+ }
88
+
89
+ export class PrequalificationsApiResponseProcessor {
90
+
91
+ /**
92
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
93
+ * to the expected objects
94
+ *
95
+ * @params response Response returned by the server for a request to getPrequalifiedBusinesses
96
+ * @throws ApiException if the response code was not in [200, 299]
97
+ */
98
+ public async getPrequalifiedBusinessesWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Array<GetPrequalificationsResponse> >> {
99
+ const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
100
+ if (isCodeInRange("200", response.httpStatusCode)) {
101
+ const body: Array<GetPrequalificationsResponse> = ObjectSerializer.deserialize(
102
+ ObjectSerializer.parse(await response.body.text(), contentType),
103
+ "Array<GetPrequalificationsResponse>", ""
104
+ ) as Array<GetPrequalificationsResponse>;
105
+ return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
106
+ }
107
+ if (isCodeInRange("400", response.httpStatusCode)) {
108
+ const body: BadRequestException = ObjectSerializer.deserialize(
109
+ ObjectSerializer.parse(await response.body.text(), contentType),
110
+ "BadRequestException", ""
111
+ ) as BadRequestException;
112
+ throw new ApiException<BadRequestException>(response.httpStatusCode, "BadRequestException", body, response.headers);
113
+ }
114
+ if (isCodeInRange("403", response.httpStatusCode)) {
115
+ const body: ForbiddenException = ObjectSerializer.deserialize(
116
+ ObjectSerializer.parse(await response.body.text(), contentType),
117
+ "ForbiddenException", ""
118
+ ) as ForbiddenException;
119
+ throw new ApiException<ForbiddenException>(response.httpStatusCode, "ForbiddenException", body, response.headers);
120
+ }
121
+ if (isCodeInRange("500", response.httpStatusCode)) {
122
+ const body: InternalServerErrorException = ObjectSerializer.deserialize(
123
+ ObjectSerializer.parse(await response.body.text(), contentType),
124
+ "InternalServerErrorException", ""
125
+ ) as InternalServerErrorException;
126
+ throw new ApiException<InternalServerErrorException>(response.httpStatusCode, "InternalServerErrorException", body, response.headers);
127
+ }
128
+
129
+ // Work around for missing responses in specification, e.g. for petstore.yaml
130
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
131
+ const body: Array<GetPrequalificationsResponse> = ObjectSerializer.deserialize(
132
+ ObjectSerializer.parse(await response.body.text(), contentType),
133
+ "Array<GetPrequalificationsResponse>", ""
134
+ ) as Array<GetPrequalificationsResponse>;
135
+ return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
136
+ }
137
+
138
+ throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
139
+ }
140
+
141
+ }