@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,503 @@
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 { BankAccountAlreadyExistException } from '../models/BankAccountAlreadyExistException';
15
+ import { BankAccountNotFoundException } from '../models/BankAccountNotFoundException';
16
+ import { BusinessBankAccount } from '../models/BusinessBankAccount';
17
+ import { BusinessNotFoundException } from '../models/BusinessNotFoundException';
18
+ import { CreateBusinessBankAccountRequestBody } from '../models/CreateBusinessBankAccountRequestBody';
19
+ import { ForbiddenException } from '../models/ForbiddenException';
20
+ import { GetBusinessBankAccountsResponse } from '../models/GetBusinessBankAccountsResponse';
21
+ import { InternalServerErrorException } from '../models/InternalServerErrorException';
22
+ import { UpdateBusinessAccountRequestBody } from '../models/UpdateBusinessAccountRequestBody';
23
+
24
+ /**
25
+ * no description
26
+ */
27
+ export class BankAccountsApiRequestFactory extends BaseAPIRequestFactory {
28
+
29
+ /**
30
+ * We only support creating disbursement checking accounts at the moment. Each business can only have one disbursement checking account. Please contact Kanmon to enable access to bank account APIs.
31
+ * Create a business bank account
32
+ * @param createBusinessBankAccountRequestBody
33
+ */
34
+ public async createBusinessBankAccount(createBusinessBankAccountRequestBody: CreateBusinessBankAccountRequestBody, _options?: Configuration): Promise<RequestContext> {
35
+ let _config = _options || this.configuration;
36
+
37
+ // verify required parameter 'createBusinessBankAccountRequestBody' is not null or undefined
38
+ if (createBusinessBankAccountRequestBody === null || createBusinessBankAccountRequestBody === undefined) {
39
+ throw new RequiredError("BankAccountsApi", "createBusinessBankAccount", "createBusinessBankAccountRequestBody");
40
+ }
41
+
42
+
43
+ // Path Params
44
+ const localVarPath = '/api/platform/v2/bank-accounts';
45
+
46
+ // Make Request Context
47
+ const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST);
48
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
49
+
50
+
51
+ // Body Params
52
+ const contentType = ObjectSerializer.getPreferredMediaType([
53
+ "application/json"
54
+ ]);
55
+ requestContext.setHeaderParam("Content-Type", contentType);
56
+ const serializedBody = ObjectSerializer.stringify(
57
+ ObjectSerializer.serialize(createBusinessBankAccountRequestBody, "CreateBusinessBankAccountRequestBody", ""),
58
+ contentType
59
+ );
60
+ requestContext.setBody(serializedBody);
61
+
62
+ let authMethod: SecurityAuthentication | undefined;
63
+ // Apply auth methods
64
+ authMethod = _config.authMethods["Authorization"]
65
+ if (authMethod?.applySecurityAuthentication) {
66
+ await authMethod?.applySecurityAuthentication(requestContext);
67
+ }
68
+
69
+ const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
70
+ if (defaultAuth?.applySecurityAuthentication) {
71
+ await defaultAuth?.applySecurityAuthentication(requestContext);
72
+ }
73
+
74
+ return requestContext;
75
+ }
76
+
77
+ /**
78
+ * Please contact Kanmon to enable access to bank account APIs.
79
+ * Fetch a business bank account
80
+ * @param id Either the Kanmon bank account UUID or your platform’s bank account ID, depending on &#x60;idType&#x60;.
81
+ * @param idType Which ID type to query the bank account by. Defaults to &#x60;KANMON&#x60;. Use &#x60;PLATFORM&#x60; if you want to query by your platform’s ID.
82
+ */
83
+ public async getBusinessBankAccount(id: string, idType?: 'KANMON' | 'PLATFORM', _options?: Configuration): Promise<RequestContext> {
84
+ let _config = _options || this.configuration;
85
+
86
+ // verify required parameter 'id' is not null or undefined
87
+ if (id === null || id === undefined) {
88
+ throw new RequiredError("BankAccountsApi", "getBusinessBankAccount", "id");
89
+ }
90
+
91
+
92
+
93
+ // Path Params
94
+ const localVarPath = '/api/platform/v2/bank-accounts/{id}'
95
+ .replace('{' + 'id' + '}', encodeURIComponent(String(id)));
96
+
97
+ // Make Request Context
98
+ const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
99
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
100
+
101
+ // Query Params
102
+ if (idType !== undefined) {
103
+ requestContext.setQueryParam("idType", ObjectSerializer.serialize(idType, "'KANMON' | 'PLATFORM'", ""));
104
+ }
105
+
106
+
107
+ let authMethod: SecurityAuthentication | undefined;
108
+ // Apply auth methods
109
+ authMethod = _config.authMethods["Authorization"]
110
+ if (authMethod?.applySecurityAuthentication) {
111
+ await authMethod?.applySecurityAuthentication(requestContext);
112
+ }
113
+
114
+ const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
115
+ if (defaultAuth?.applySecurityAuthentication) {
116
+ await defaultAuth?.applySecurityAuthentication(requestContext);
117
+ }
118
+
119
+ return requestContext;
120
+ }
121
+
122
+ /**
123
+ * Please contact Kanmon to enable access to bank account APIs.
124
+ * Fetch business bank accounts
125
+ * @param ids A comma delimited list of Kanmon’s unique IDs for bank accounts.
126
+ * @param platformBankAccountIds A comma delimited list of your platform’s unique IDs for bank accounts.
127
+ * @param platformBusinessIds A comma delimited list of your platform’s unique business IDs for bannk accounts.
128
+ * @param businessIds A comma delimited list of your Kanmon’s unique business IDs for bannk accounts.
129
+ * @param offset The number of records to skip when performing pagination. Defaults to &#x60;0&#x60;.
130
+ * @param limit The number of records to limit when performing pagination. Defaults to &#x60;100&#x60;, which is the max.
131
+ * @param createdAtStart Filter for records where &#x60;createdAt&#x60; is greater than or equal to this value. ISO 8601 format.
132
+ * @param createdAtEnd Filter for records where &#x60;createdAt&#x60; is less than or equal to this value. ISO 8601 format.
133
+ */
134
+ public async getBusinessBankAccounts(ids?: string, platformBankAccountIds?: string, platformBusinessIds?: string, businessIds?: string, offset?: number, limit?: number, createdAtStart?: string, createdAtEnd?: string, _options?: Configuration): Promise<RequestContext> {
135
+ let _config = _options || this.configuration;
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+ // Path Params
146
+ const localVarPath = '/api/platform/v2/bank-accounts';
147
+
148
+ // Make Request Context
149
+ const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
150
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
151
+
152
+ // Query Params
153
+ if (ids !== undefined) {
154
+ requestContext.setQueryParam("ids", ObjectSerializer.serialize(ids, "string", ""));
155
+ }
156
+
157
+ // Query Params
158
+ if (platformBankAccountIds !== undefined) {
159
+ requestContext.setQueryParam("platformBankAccountIds", ObjectSerializer.serialize(platformBankAccountIds, "string", ""));
160
+ }
161
+
162
+ // Query Params
163
+ if (platformBusinessIds !== undefined) {
164
+ requestContext.setQueryParam("platformBusinessIds", ObjectSerializer.serialize(platformBusinessIds, "string", ""));
165
+ }
166
+
167
+ // Query Params
168
+ if (businessIds !== undefined) {
169
+ requestContext.setQueryParam("businessIds", ObjectSerializer.serialize(businessIds, "string", ""));
170
+ }
171
+
172
+ // Query Params
173
+ if (offset !== undefined) {
174
+ requestContext.setQueryParam("offset", ObjectSerializer.serialize(offset, "number", ""));
175
+ }
176
+
177
+ // Query Params
178
+ if (limit !== undefined) {
179
+ requestContext.setQueryParam("limit", ObjectSerializer.serialize(limit, "number", ""));
180
+ }
181
+
182
+ // Query Params
183
+ if (createdAtStart !== undefined) {
184
+ requestContext.setQueryParam("createdAtStart", ObjectSerializer.serialize(createdAtStart, "string", ""));
185
+ }
186
+
187
+ // Query Params
188
+ if (createdAtEnd !== undefined) {
189
+ requestContext.setQueryParam("createdAtEnd", ObjectSerializer.serialize(createdAtEnd, "string", ""));
190
+ }
191
+
192
+
193
+ let authMethod: SecurityAuthentication | undefined;
194
+ // Apply auth methods
195
+ authMethod = _config.authMethods["Authorization"]
196
+ if (authMethod?.applySecurityAuthentication) {
197
+ await authMethod?.applySecurityAuthentication(requestContext);
198
+ }
199
+
200
+ const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
201
+ if (defaultAuth?.applySecurityAuthentication) {
202
+ await defaultAuth?.applySecurityAuthentication(requestContext);
203
+ }
204
+
205
+ return requestContext;
206
+ }
207
+
208
+ /**
209
+ * We only support creating disbursement checking accounts at the moment. Each business can only have one disbursement checking account. Please contact Kanmon to enable access to bank account APIs.
210
+ * Update a business bank account
211
+ * @param id Either the Kanmon bank account UUID or your platform’s bank account ID, depending on &#x60;idType&#x60;.
212
+ * @param updateBusinessAccountRequestBody
213
+ * @param idType Which ID type to query the bank account by. Defaults to &#x60;KANMON&#x60;. Use &#x60;PLATFORM&#x60; if you want to query by your platform’s ID.
214
+ */
215
+ public async updateBusinessBankAccount(id: string, updateBusinessAccountRequestBody: UpdateBusinessAccountRequestBody, idType?: 'KANMON' | 'PLATFORM', _options?: Configuration): Promise<RequestContext> {
216
+ let _config = _options || this.configuration;
217
+
218
+ // verify required parameter 'id' is not null or undefined
219
+ if (id === null || id === undefined) {
220
+ throw new RequiredError("BankAccountsApi", "updateBusinessBankAccount", "id");
221
+ }
222
+
223
+
224
+ // verify required parameter 'updateBusinessAccountRequestBody' is not null or undefined
225
+ if (updateBusinessAccountRequestBody === null || updateBusinessAccountRequestBody === undefined) {
226
+ throw new RequiredError("BankAccountsApi", "updateBusinessBankAccount", "updateBusinessAccountRequestBody");
227
+ }
228
+
229
+
230
+
231
+ // Path Params
232
+ const localVarPath = '/api/platform/v2/bank-accounts/{id}'
233
+ .replace('{' + 'id' + '}', encodeURIComponent(String(id)));
234
+
235
+ // Make Request Context
236
+ const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PATCH);
237
+ requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")
238
+
239
+ // Query Params
240
+ if (idType !== undefined) {
241
+ requestContext.setQueryParam("idType", ObjectSerializer.serialize(idType, "'KANMON' | 'PLATFORM'", ""));
242
+ }
243
+
244
+
245
+ // Body Params
246
+ const contentType = ObjectSerializer.getPreferredMediaType([
247
+ "application/json"
248
+ ]);
249
+ requestContext.setHeaderParam("Content-Type", contentType);
250
+ const serializedBody = ObjectSerializer.stringify(
251
+ ObjectSerializer.serialize(updateBusinessAccountRequestBody, "UpdateBusinessAccountRequestBody", ""),
252
+ contentType
253
+ );
254
+ requestContext.setBody(serializedBody);
255
+
256
+ let authMethod: SecurityAuthentication | undefined;
257
+ // Apply auth methods
258
+ authMethod = _config.authMethods["Authorization"]
259
+ if (authMethod?.applySecurityAuthentication) {
260
+ await authMethod?.applySecurityAuthentication(requestContext);
261
+ }
262
+
263
+ const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
264
+ if (defaultAuth?.applySecurityAuthentication) {
265
+ await defaultAuth?.applySecurityAuthentication(requestContext);
266
+ }
267
+
268
+ return requestContext;
269
+ }
270
+
271
+ }
272
+
273
+ export class BankAccountsApiResponseProcessor {
274
+
275
+ /**
276
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
277
+ * to the expected objects
278
+ *
279
+ * @params response Response returned by the server for a request to createBusinessBankAccount
280
+ * @throws ApiException if the response code was not in [200, 299]
281
+ */
282
+ public async createBusinessBankAccountWithHttpInfo(response: ResponseContext): Promise<HttpInfo<BusinessBankAccount >> {
283
+ const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
284
+ if (isCodeInRange("200", response.httpStatusCode)) {
285
+ const body: BusinessBankAccount = ObjectSerializer.deserialize(
286
+ ObjectSerializer.parse(await response.body.text(), contentType),
287
+ "BusinessBankAccount", ""
288
+ ) as BusinessBankAccount;
289
+ return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
290
+ }
291
+ if (isCodeInRange("400", response.httpStatusCode)) {
292
+ const body: BadRequestException = ObjectSerializer.deserialize(
293
+ ObjectSerializer.parse(await response.body.text(), contentType),
294
+ "BadRequestException", ""
295
+ ) as BadRequestException;
296
+ throw new ApiException<BadRequestException>(response.httpStatusCode, "BadRequestException", body, response.headers);
297
+ }
298
+ if (isCodeInRange("403", response.httpStatusCode)) {
299
+ const body: ForbiddenException = ObjectSerializer.deserialize(
300
+ ObjectSerializer.parse(await response.body.text(), contentType),
301
+ "ForbiddenException", ""
302
+ ) as ForbiddenException;
303
+ throw new ApiException<ForbiddenException>(response.httpStatusCode, "ForbiddenException", body, response.headers);
304
+ }
305
+ if (isCodeInRange("404", response.httpStatusCode)) {
306
+ const body: BusinessNotFoundException = ObjectSerializer.deserialize(
307
+ ObjectSerializer.parse(await response.body.text(), contentType),
308
+ "BusinessNotFoundException", ""
309
+ ) as BusinessNotFoundException;
310
+ throw new ApiException<BusinessNotFoundException>(response.httpStatusCode, "BusinessNotFoundException", body, response.headers);
311
+ }
312
+ if (isCodeInRange("409", response.httpStatusCode)) {
313
+ const body: BankAccountAlreadyExistException = ObjectSerializer.deserialize(
314
+ ObjectSerializer.parse(await response.body.text(), contentType),
315
+ "BankAccountAlreadyExistException", ""
316
+ ) as BankAccountAlreadyExistException;
317
+ throw new ApiException<BankAccountAlreadyExistException>(response.httpStatusCode, "BankAccountAlreadyExistException", body, response.headers);
318
+ }
319
+ if (isCodeInRange("500", response.httpStatusCode)) {
320
+ const body: InternalServerErrorException = ObjectSerializer.deserialize(
321
+ ObjectSerializer.parse(await response.body.text(), contentType),
322
+ "InternalServerErrorException", ""
323
+ ) as InternalServerErrorException;
324
+ throw new ApiException<InternalServerErrorException>(response.httpStatusCode, "InternalServerErrorException", body, response.headers);
325
+ }
326
+
327
+ // Work around for missing responses in specification, e.g. for petstore.yaml
328
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
329
+ const body: BusinessBankAccount = ObjectSerializer.deserialize(
330
+ ObjectSerializer.parse(await response.body.text(), contentType),
331
+ "BusinessBankAccount", ""
332
+ ) as BusinessBankAccount;
333
+ return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
334
+ }
335
+
336
+ throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
337
+ }
338
+
339
+ /**
340
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
341
+ * to the expected objects
342
+ *
343
+ * @params response Response returned by the server for a request to getBusinessBankAccount
344
+ * @throws ApiException if the response code was not in [200, 299]
345
+ */
346
+ public async getBusinessBankAccountWithHttpInfo(response: ResponseContext): Promise<HttpInfo<BusinessBankAccount >> {
347
+ const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
348
+ if (isCodeInRange("201", response.httpStatusCode)) {
349
+ const body: BusinessBankAccount = ObjectSerializer.deserialize(
350
+ ObjectSerializer.parse(await response.body.text(), contentType),
351
+ "BusinessBankAccount", ""
352
+ ) as BusinessBankAccount;
353
+ return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
354
+ }
355
+ if (isCodeInRange("400", response.httpStatusCode)) {
356
+ const body: BadRequestException = ObjectSerializer.deserialize(
357
+ ObjectSerializer.parse(await response.body.text(), contentType),
358
+ "BadRequestException", ""
359
+ ) as BadRequestException;
360
+ throw new ApiException<BadRequestException>(response.httpStatusCode, "BadRequestException", body, response.headers);
361
+ }
362
+ if (isCodeInRange("403", response.httpStatusCode)) {
363
+ const body: ForbiddenException = ObjectSerializer.deserialize(
364
+ ObjectSerializer.parse(await response.body.text(), contentType),
365
+ "ForbiddenException", ""
366
+ ) as ForbiddenException;
367
+ throw new ApiException<ForbiddenException>(response.httpStatusCode, "ForbiddenException", body, response.headers);
368
+ }
369
+ if (isCodeInRange("404", response.httpStatusCode)) {
370
+ const body: BankAccountNotFoundException = ObjectSerializer.deserialize(
371
+ ObjectSerializer.parse(await response.body.text(), contentType),
372
+ "BankAccountNotFoundException", ""
373
+ ) as BankAccountNotFoundException;
374
+ throw new ApiException<BankAccountNotFoundException>(response.httpStatusCode, "BankAccountNotFoundException", body, response.headers);
375
+ }
376
+ if (isCodeInRange("500", response.httpStatusCode)) {
377
+ const body: InternalServerErrorException = ObjectSerializer.deserialize(
378
+ ObjectSerializer.parse(await response.body.text(), contentType),
379
+ "InternalServerErrorException", ""
380
+ ) as InternalServerErrorException;
381
+ throw new ApiException<InternalServerErrorException>(response.httpStatusCode, "InternalServerErrorException", body, response.headers);
382
+ }
383
+
384
+ // Work around for missing responses in specification, e.g. for petstore.yaml
385
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
386
+ const body: BusinessBankAccount = ObjectSerializer.deserialize(
387
+ ObjectSerializer.parse(await response.body.text(), contentType),
388
+ "BusinessBankAccount", ""
389
+ ) as BusinessBankAccount;
390
+ return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
391
+ }
392
+
393
+ throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
394
+ }
395
+
396
+ /**
397
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
398
+ * to the expected objects
399
+ *
400
+ * @params response Response returned by the server for a request to getBusinessBankAccounts
401
+ * @throws ApiException if the response code was not in [200, 299]
402
+ */
403
+ public async getBusinessBankAccountsWithHttpInfo(response: ResponseContext): Promise<HttpInfo<GetBusinessBankAccountsResponse >> {
404
+ const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
405
+ if (isCodeInRange("200", response.httpStatusCode)) {
406
+ const body: GetBusinessBankAccountsResponse = ObjectSerializer.deserialize(
407
+ ObjectSerializer.parse(await response.body.text(), contentType),
408
+ "GetBusinessBankAccountsResponse", ""
409
+ ) as GetBusinessBankAccountsResponse;
410
+ return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
411
+ }
412
+ if (isCodeInRange("400", response.httpStatusCode)) {
413
+ const body: BadRequestException = ObjectSerializer.deserialize(
414
+ ObjectSerializer.parse(await response.body.text(), contentType),
415
+ "BadRequestException", ""
416
+ ) as BadRequestException;
417
+ throw new ApiException<BadRequestException>(response.httpStatusCode, "BadRequestException", body, response.headers);
418
+ }
419
+ if (isCodeInRange("403", response.httpStatusCode)) {
420
+ const body: ForbiddenException = ObjectSerializer.deserialize(
421
+ ObjectSerializer.parse(await response.body.text(), contentType),
422
+ "ForbiddenException", ""
423
+ ) as ForbiddenException;
424
+ throw new ApiException<ForbiddenException>(response.httpStatusCode, "ForbiddenException", body, response.headers);
425
+ }
426
+ if (isCodeInRange("500", response.httpStatusCode)) {
427
+ const body: InternalServerErrorException = ObjectSerializer.deserialize(
428
+ ObjectSerializer.parse(await response.body.text(), contentType),
429
+ "InternalServerErrorException", ""
430
+ ) as InternalServerErrorException;
431
+ throw new ApiException<InternalServerErrorException>(response.httpStatusCode, "InternalServerErrorException", body, response.headers);
432
+ }
433
+
434
+ // Work around for missing responses in specification, e.g. for petstore.yaml
435
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
436
+ const body: GetBusinessBankAccountsResponse = ObjectSerializer.deserialize(
437
+ ObjectSerializer.parse(await response.body.text(), contentType),
438
+ "GetBusinessBankAccountsResponse", ""
439
+ ) as GetBusinessBankAccountsResponse;
440
+ return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
441
+ }
442
+
443
+ throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
444
+ }
445
+
446
+ /**
447
+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
448
+ * to the expected objects
449
+ *
450
+ * @params response Response returned by the server for a request to updateBusinessBankAccount
451
+ * @throws ApiException if the response code was not in [200, 299]
452
+ */
453
+ public async updateBusinessBankAccountWithHttpInfo(response: ResponseContext): Promise<HttpInfo<BusinessBankAccount >> {
454
+ const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
455
+ if (isCodeInRange("200", response.httpStatusCode)) {
456
+ const body: BusinessBankAccount = ObjectSerializer.deserialize(
457
+ ObjectSerializer.parse(await response.body.text(), contentType),
458
+ "BusinessBankAccount", ""
459
+ ) as BusinessBankAccount;
460
+ return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
461
+ }
462
+ if (isCodeInRange("400", response.httpStatusCode)) {
463
+ const body: BadRequestException = ObjectSerializer.deserialize(
464
+ ObjectSerializer.parse(await response.body.text(), contentType),
465
+ "BadRequestException", ""
466
+ ) as BadRequestException;
467
+ throw new ApiException<BadRequestException>(response.httpStatusCode, "BadRequestException", body, response.headers);
468
+ }
469
+ if (isCodeInRange("403", response.httpStatusCode)) {
470
+ const body: ForbiddenException = ObjectSerializer.deserialize(
471
+ ObjectSerializer.parse(await response.body.text(), contentType),
472
+ "ForbiddenException", ""
473
+ ) as ForbiddenException;
474
+ throw new ApiException<ForbiddenException>(response.httpStatusCode, "ForbiddenException", body, response.headers);
475
+ }
476
+ if (isCodeInRange("404", response.httpStatusCode)) {
477
+ const body: BankAccountNotFoundException = ObjectSerializer.deserialize(
478
+ ObjectSerializer.parse(await response.body.text(), contentType),
479
+ "BankAccountNotFoundException", ""
480
+ ) as BankAccountNotFoundException;
481
+ throw new ApiException<BankAccountNotFoundException>(response.httpStatusCode, "BankAccountNotFoundException", body, response.headers);
482
+ }
483
+ if (isCodeInRange("500", response.httpStatusCode)) {
484
+ const body: InternalServerErrorException = ObjectSerializer.deserialize(
485
+ ObjectSerializer.parse(await response.body.text(), contentType),
486
+ "InternalServerErrorException", ""
487
+ ) as InternalServerErrorException;
488
+ throw new ApiException<InternalServerErrorException>(response.httpStatusCode, "InternalServerErrorException", body, response.headers);
489
+ }
490
+
491
+ // Work around for missing responses in specification, e.g. for petstore.yaml
492
+ if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
493
+ const body: BusinessBankAccount = ObjectSerializer.deserialize(
494
+ ObjectSerializer.parse(await response.body.text(), contentType),
495
+ "BusinessBankAccount", ""
496
+ ) as BusinessBankAccount;
497
+ return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
498
+ }
499
+
500
+ throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
501
+ }
502
+
503
+ }