@finverse/sdk-typescript 0.0.19 → 0.0.22

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.
package/README.md CHANGED
@@ -6,8 +6,7 @@ This SDK enables a basic end-to-end backend integration with the Finverse API, i
6
6
  npm install @finverse/sdk-typescript
7
7
  ```
8
8
 
9
-
10
- ## Getting started
9
+ ## Getting started (Linking flow)
11
10
 
12
11
  ### 1. Authenticate with Finverse API: Obtain Customer Access Token
13
12
  ```typescript
@@ -162,3 +161,134 @@ const statementId = statements.data.statements[0].id;
162
161
  // Can download statement from here
163
162
  const satementLink = await new LoginIdentityApi(configuration).getStatementLink(statementId);
164
163
  ```
164
+
165
+ ## Getting started (Payment flow)
166
+
167
+ ### 1. Authenticate with Finverse API: Obtain Customer Access Token
168
+ ```typescript
169
+ // Obtain these from https://dashboard.finverse.com
170
+ const apiHost = "https://api.sandbox.finverse.net"
171
+ const clientId = process.env.FINVERSE_CLIENTID
172
+ const clientSecret = process.env.FINVERSE_SECRET
173
+ const redirectUri = process.env.REDIRECT_URI
174
+
175
+ const configuration = new Configuration({ basePath: apiHost });
176
+ // Obtain customer access token
177
+ const customerTokenResp = await new PublicApi(configuration).generateCustomerAccessToken({
178
+ client_id: clientId,
179
+ client_secret: clientSecret,
180
+ grant_type: 'client_credentials',
181
+ });
182
+
183
+ const customerAccessToken = customerTokenResp.access_token
184
+ ```
185
+
186
+ ### 2. Create payment instruction
187
+ ```typescript
188
+ const configuration = new Configuration({ basePath: config.apiHost, accessToken: customerToken.access_token });
189
+ const paymentInstruction: CustomerPaymentInstruction = {
190
+ type: "DEBIT_AUTHORIZATION",
191
+ user_id: "customer_user1",
192
+ frequency: "MONTHLY",
193
+ start_date: "2022-04-01",
194
+ end_date: "2022-12-01",
195
+ amount: 1000,
196
+ currency: "PHP",
197
+ recipient_name: "HOMECREDIT",
198
+ recipient_account_id: "Recipient Account Id",
199
+ sender_name: "Sender Name",
200
+ sender_account_id: "LOAN102345",
201
+ remarks: "HOME CREDIT REPAYMENT"
202
+ };
203
+ const createPaymentInstructionResponse = await new CustomerApi(configuration).createPaymentInstruction(paymentInstruction);
204
+
205
+ // createPaymentInstructionResponse.data.payment_instruction_id can be used to retrieve the status
206
+ ```
207
+
208
+ ### 3. Link with payment instruction: Obtain Link Token and Link URL to launch Finverse Link UI
209
+ ```typescript
210
+ // generate a link token
211
+
212
+ // reference back to your system userId, finverse does not use this
213
+ const userId = "someUserId"
214
+ // this will be sent in the redirectUri callback, can be used to identify the state
215
+ const state = "someUniqueState"
216
+ const configuration = new Configuration({
217
+ basePath: apiHost,
218
+ accessToken: customerToken.access_token
219
+ });
220
+ const linkTokenResp = await new CustomerApi(configuration).generateLinkToken({
221
+ ClientId: clientId,
222
+ UserId: userId,
223
+ RedirectUri: redirectUri,
224
+ State: state,
225
+ ResponseMode: "form_post",
226
+ ResponseType: "code",
227
+ GrantType: "client_credentials",
228
+ PaymentInstructionId: createPaymentInstructionResponse.data.payment_instruction_id,
229
+ ProductsRequested: "PAYMENTS",
230
+ });
231
+
232
+ // The linkUrl can be used to initiate Finverse Link
233
+ console.log("linkUrl: " + linkTokenResp.link_url)
234
+ ```
235
+
236
+ ### 4. Finalize linking: Exchange code for Login Identity Access Token
237
+ ```typescript
238
+ // when Finverse Link UI is successful, obtain the code from Finverse Link
239
+ // exchange it for a Login Identity Access Token
240
+ const code = "obtainAfterLink"
241
+ const configuration = new Configuration({
242
+ basePath: apiHost,
243
+ accessToken: customerToken.access_token
244
+ });
245
+ const loginIdentityTokenResp = await new LinkApi(configuration).token(
246
+ "authorization_code",
247
+ code,
248
+ clientId,
249
+ redirectURI,
250
+ );
251
+
252
+ // The loginIdentityToken can be used to retrieve data
253
+ const loginIdentityToken = loginIdentityTokenResp.access_token
254
+ ```
255
+
256
+ ### 5. Poll loginIdentityStatus until ready
257
+ Alternatively you can use webhook to receive LoginIdentity event.
258
+
259
+ ```typescript
260
+ enum FinalStatus {
261
+ ERROR = 'ERROR',
262
+ DATA_RETRIEVAL_PARTIALLY_SUCCESSFUL = 'DATA_RETRIEVAL_PARTIALLY_SUCCESSFUL',
263
+ DATA_RETRIEVAL_COMPLETE = 'DATA_RETRIEVAL_COMPLETE',
264
+ }
265
+
266
+ const configuration = new Configuration({
267
+ basePath: apiHost,
268
+ accessToken: loginIdentityToken.access_token
269
+ });
270
+ let loginIdentity: AxiosResponse<GetLoginIdentityByIdResponse>;
271
+
272
+ // Poll until loginIdentityStatus is ready
273
+ for (let i = 0; i < 20; i++) {
274
+ loginIdentity = await new LoginIdentityApi(configuration).getLoginIdentity();
275
+ const loginIdentityStatus = loginIdentity.data.login_identity.status;
276
+ if (
277
+ loginIdentityStatus === FinalStatus.ERROR ||
278
+ loginIdentityStatus === FinalStatus.DATA_RETRIEVAL_COMPLETE ||
279
+ loginIdentityStatus === FinalStatus.DATA_RETRIEVAL_PARTIALLY_SUCCESSFUL
280
+ ) { break; }
281
+
282
+ await new Promise((resolve) => setTimeout(resolve, 3000));
283
+ }
284
+
285
+ console.log("login identity: " + loginIdentityResp.login_identity)
286
+ ```
287
+
288
+ ### 6. Get payment instruction status
289
+ ```typescript
290
+ const configuration = new Configuration({ basePath: config.apiHost, accessToken: customerToken.access_token });
291
+ const getPaymentInstructionResponse = await new CustomerApi(configuration).getPaymentInstruction(createPaymentInstructionResponse.data.payment_instruction_id);
292
+
293
+ console.log("paymentInstruction status: " + getPaymentInstructionResponse.data.payment_instruction.status);
294
+ ```
package/dist/api.d.ts CHANGED
@@ -431,6 +431,89 @@ export interface CurrencyAmount {
431
431
  */
432
432
  raw?: string;
433
433
  }
434
+ /**
435
+ *
436
+ * @export
437
+ * @interface CustomerPaymentInstruction
438
+ */
439
+ export interface CustomerPaymentInstruction {
440
+ /**
441
+ * A id of the user of this payment, need to equal to userId when creating link
442
+ * @type {string}
443
+ * @memberof CustomerPaymentInstruction
444
+ */
445
+ user_id: string;
446
+ /**
447
+ * Type of payment is being created, please check Documentation on which payment type is supported in each institution
448
+ * @type {string}
449
+ * @memberof CustomerPaymentInstruction
450
+ */
451
+ type: CustomerPaymentInstructionTypeEnum;
452
+ /**
453
+ * The recipient name
454
+ * @type {string}
455
+ * @memberof CustomerPaymentInstruction
456
+ */
457
+ recipient_name?: string;
458
+ /**
459
+ * The recipient account Id
460
+ * @type {string}
461
+ * @memberof CustomerPaymentInstruction
462
+ */
463
+ recipient_account_id?: string;
464
+ /**
465
+ * The sender name
466
+ * @type {string}
467
+ * @memberof CustomerPaymentInstruction
468
+ */
469
+ sender_name?: string;
470
+ /**
471
+ * The sender account Id
472
+ * @type {string}
473
+ * @memberof CustomerPaymentInstruction
474
+ */
475
+ sender_account_id?: string;
476
+ /**
477
+ * When the payment should start
478
+ * @type {string}
479
+ * @memberof CustomerPaymentInstruction
480
+ */
481
+ start_date?: string | null;
482
+ /**
483
+ * When the payment should stop
484
+ * @type {string}
485
+ * @memberof CustomerPaymentInstruction
486
+ */
487
+ end_date?: string | null;
488
+ /**
489
+ * The currency for the payment
490
+ * @type {string}
491
+ * @memberof CustomerPaymentInstruction
492
+ */
493
+ currency?: string;
494
+ /**
495
+ * The payment amount
496
+ * @type {number}
497
+ * @memberof CustomerPaymentInstruction
498
+ */
499
+ amount?: number;
500
+ /**
501
+ * How often the payment should be executed
502
+ * @type {string}
503
+ * @memberof CustomerPaymentInstruction
504
+ */
505
+ frequency?: string;
506
+ /**
507
+ * Related remarks about this instruction
508
+ * @type {string}
509
+ * @memberof CustomerPaymentInstruction
510
+ */
511
+ remarks?: string;
512
+ }
513
+ export declare const CustomerPaymentInstructionTypeEnum: {
514
+ readonly DebitAuthorization: "DEBIT_AUTHORIZATION";
515
+ };
516
+ export declare type CustomerPaymentInstructionTypeEnum = typeof CustomerPaymentInstructionTypeEnum[keyof typeof CustomerPaymentInstructionTypeEnum];
434
517
  /**
435
518
  *
436
519
  * @export
@@ -687,6 +770,19 @@ export interface GetLoginIdentityHistoryResponse {
687
770
  */
688
771
  status_history?: Array<LoginIdentityStatusDetails>;
689
772
  }
773
+ /**
774
+ *
775
+ * @export
776
+ * @interface GetPaymentInstructionsResponse
777
+ */
778
+ export interface GetPaymentInstructionsResponse {
779
+ /**
780
+ *
781
+ * @type {PaymentInstruction}
782
+ * @memberof GetPaymentInstructionsResponse
783
+ */
784
+ payment_instruction?: PaymentInstruction;
785
+ }
690
786
  /**
691
787
  *
692
788
  * @export
@@ -1141,7 +1237,7 @@ export interface IncomeTotal {
1141
1237
  * @type {IncomeEstimate}
1142
1238
  * @memberof IncomeTotal
1143
1239
  */
1144
- estmated_monthly_income?: IncomeEstimate;
1240
+ estimated_monthly_income?: IncomeEstimate;
1145
1241
  /**
1146
1242
  * Number of transactions counted towards income
1147
1243
  * @type {number}
@@ -1528,31 +1624,6 @@ export interface ListAccountsResponse {
1528
1624
  */
1529
1625
  institution?: InstitutionShort;
1530
1626
  }
1531
- /**
1532
- *
1533
- * @export
1534
- * @interface ListPaymentInstructionsResponse
1535
- */
1536
- export interface ListPaymentInstructionsResponse {
1537
- /**
1538
- *
1539
- * @type {Array<PaymentInstruction>}
1540
- * @memberof ListPaymentInstructionsResponse
1541
- */
1542
- payment_instructions?: Array<PaymentInstruction>;
1543
- /**
1544
- *
1545
- * @type {LoginIdentityShort}
1546
- * @memberof ListPaymentInstructionsResponse
1547
- */
1548
- login_identity?: LoginIdentityShort;
1549
- /**
1550
- *
1551
- * @type {InstitutionShort}
1552
- * @memberof ListPaymentInstructionsResponse
1553
- */
1554
- institution?: InstitutionShort;
1555
- }
1556
1627
  /**
1557
1628
  *
1558
1629
  * @export
@@ -1980,17 +2051,23 @@ export interface PaymentDetails {
1980
2051
  */
1981
2052
  export interface PaymentInstruction {
1982
2053
  /**
1983
- * The user id to which the payment instruction will refer
2054
+ * A id of the user of this payment, need to equal to userId when creating link
1984
2055
  * @type {string}
1985
2056
  * @memberof PaymentInstruction
1986
2057
  */
1987
- user_id: string;
2058
+ user_id?: string;
2059
+ /**
2060
+ * An id that links this payment to a specific Login Identity
2061
+ * @type {string}
2062
+ * @memberof PaymentInstruction
2063
+ */
2064
+ login_identity_id?: string;
1988
2065
  /**
1989
- * What type of payment is being created
2066
+ * Type of payment that was created, please check Documentation on which payment type is supported in each institution
1990
2067
  * @type {string}
1991
2068
  * @memberof PaymentInstruction
1992
2069
  */
1993
- payment_type: PaymentInstructionPaymentTypeEnum;
2070
+ type?: PaymentInstructionTypeEnum;
1994
2071
  /**
1995
2072
  * The recipient name
1996
2073
  * @type {string}
@@ -2040,40 +2117,46 @@ export interface PaymentInstruction {
2040
2117
  */
2041
2118
  amount?: number;
2042
2119
  /**
2043
- * How often the payment is executed
2120
+ * How often the payment should be executed
2044
2121
  * @type {string}
2045
2122
  * @memberof PaymentInstruction
2046
2123
  */
2047
2124
  frequency?: string;
2048
2125
  /**
2049
- * Related remarks
2126
+ * Related remarks about this instruction
2050
2127
  * @type {string}
2051
2128
  * @memberof PaymentInstruction
2052
2129
  */
2053
2130
  remarks?: string;
2054
2131
  /**
2055
- * A customer provided key to ensure ideompotency
2132
+ * Status of the payment
2056
2133
  * @type {string}
2057
2134
  * @memberof PaymentInstruction
2058
2135
  */
2059
- idempotence_key?: string;
2136
+ status?: string;
2060
2137
  /**
2061
- * Status of the payment
2138
+ * Reference identification returned by institution
2062
2139
  * @type {string}
2063
2140
  * @memberof PaymentInstruction
2064
2141
  */
2065
- payment_status?: string;
2142
+ reference_id?: string;
2066
2143
  /**
2067
- * Reference identification returned by institution
2144
+ *
2068
2145
  * @type {string}
2069
2146
  * @memberof PaymentInstruction
2070
2147
  */
2071
- reference_id?: string;
2148
+ last_update?: string;
2149
+ /**
2150
+ * Extra information collected for this payment instruction
2151
+ * @type {object}
2152
+ * @memberof PaymentInstruction
2153
+ */
2154
+ info?: object;
2072
2155
  }
2073
- export declare const PaymentInstructionPaymentTypeEnum: {
2156
+ export declare const PaymentInstructionTypeEnum: {
2074
2157
  readonly DebitAuthorization: "DEBIT_AUTHORIZATION";
2075
2158
  };
2076
- export declare type PaymentInstructionPaymentTypeEnum = typeof PaymentInstructionPaymentTypeEnum[keyof typeof PaymentInstructionPaymentTypeEnum];
2159
+ export declare type PaymentInstructionTypeEnum = typeof PaymentInstructionTypeEnum[keyof typeof PaymentInstructionTypeEnum];
2077
2160
  /**
2078
2161
  *
2079
2162
  * @export
@@ -2457,12 +2540,12 @@ export interface Transaction {
2457
2540
  */
2458
2541
  export declare const CustomerApiAxiosParamCreator: (configuration?: Configuration) => {
2459
2542
  /**
2460
- * Create a new payment instruction to be used when linking to perform debit authorization
2461
- * @param {PaymentInstruction} paymentInstruction Request body for starting a new Link
2543
+ * Create a new payment instruction to be used when linking to perform new payment
2544
+ * @param {CustomerPaymentInstruction} paymentInstruction Request body for starting a new Link
2462
2545
  * @param {*} [options] Override http request option.
2463
2546
  * @throws {RequiredError}
2464
2547
  */
2465
- createPaymentInstruction: (paymentInstruction: PaymentInstruction, options?: AxiosRequestConfig) => Promise<RequestArgs>;
2548
+ createPaymentInstruction: (paymentInstruction: CustomerPaymentInstruction, options?: AxiosRequestConfig) => Promise<RequestArgs>;
2466
2549
  /**
2467
2550
  * generate a link token that can be used to create link
2468
2551
  * @param {LinkTokenRequest} linkTokenRequest token request
@@ -2491,6 +2574,13 @@ export declare const CustomerApiAxiosParamCreator: (configuration?: Configuratio
2491
2574
  * @throws {RequiredError}
2492
2575
  */
2493
2576
  getLoginIdentityHistory: (loginIdentityId: string, options?: AxiosRequestConfig) => Promise<RequestArgs>;
2577
+ /**
2578
+ * Get payment instructions by payment_instruction_id
2579
+ * @param {string} paymentInstructionId The id of a payment instruction
2580
+ * @param {*} [options] Override http request option.
2581
+ * @throws {RequiredError}
2582
+ */
2583
+ getPaymentInstruction: (paymentInstructionId: string, options?: AxiosRequestConfig) => Promise<RequestArgs>;
2494
2584
  /**
2495
2585
  * Get a list of institutions
2496
2586
  * @param {string} [country] The country the institution belongs to
@@ -2515,12 +2605,12 @@ export declare const CustomerApiAxiosParamCreator: (configuration?: Configuratio
2515
2605
  */
2516
2606
  export declare const CustomerApiFp: (configuration?: Configuration) => {
2517
2607
  /**
2518
- * Create a new payment instruction to be used when linking to perform debit authorization
2519
- * @param {PaymentInstruction} paymentInstruction Request body for starting a new Link
2608
+ * Create a new payment instruction to be used when linking to perform new payment
2609
+ * @param {CustomerPaymentInstruction} paymentInstruction Request body for starting a new Link
2520
2610
  * @param {*} [options] Override http request option.
2521
2611
  * @throws {RequiredError}
2522
2612
  */
2523
- createPaymentInstruction(paymentInstruction: PaymentInstruction, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CreatePaymentInstructionResponse>>;
2613
+ createPaymentInstruction(paymentInstruction: CustomerPaymentInstruction, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CreatePaymentInstructionResponse>>;
2524
2614
  /**
2525
2615
  * generate a link token that can be used to create link
2526
2616
  * @param {LinkTokenRequest} linkTokenRequest token request
@@ -2549,6 +2639,13 @@ export declare const CustomerApiFp: (configuration?: Configuration) => {
2549
2639
  * @throws {RequiredError}
2550
2640
  */
2551
2641
  getLoginIdentityHistory(loginIdentityId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GetLoginIdentityHistoryResponse>>;
2642
+ /**
2643
+ * Get payment instructions by payment_instruction_id
2644
+ * @param {string} paymentInstructionId The id of a payment instruction
2645
+ * @param {*} [options] Override http request option.
2646
+ * @throws {RequiredError}
2647
+ */
2648
+ getPaymentInstruction(paymentInstructionId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GetPaymentInstructionsResponse>>;
2552
2649
  /**
2553
2650
  * Get a list of institutions
2554
2651
  * @param {string} [country] The country the institution belongs to
@@ -2573,12 +2670,12 @@ export declare const CustomerApiFp: (configuration?: Configuration) => {
2573
2670
  */
2574
2671
  export declare const CustomerApiFactory: (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) => {
2575
2672
  /**
2576
- * Create a new payment instruction to be used when linking to perform debit authorization
2577
- * @param {PaymentInstruction} paymentInstruction Request body for starting a new Link
2673
+ * Create a new payment instruction to be used when linking to perform new payment
2674
+ * @param {CustomerPaymentInstruction} paymentInstruction Request body for starting a new Link
2578
2675
  * @param {*} [options] Override http request option.
2579
2676
  * @throws {RequiredError}
2580
2677
  */
2581
- createPaymentInstruction(paymentInstruction: PaymentInstruction, options?: any): AxiosPromise<CreatePaymentInstructionResponse>;
2678
+ createPaymentInstruction(paymentInstruction: CustomerPaymentInstruction, options?: any): AxiosPromise<CreatePaymentInstructionResponse>;
2582
2679
  /**
2583
2680
  * generate a link token that can be used to create link
2584
2681
  * @param {LinkTokenRequest} linkTokenRequest token request
@@ -2607,6 +2704,13 @@ export declare const CustomerApiFactory: (configuration?: Configuration, basePat
2607
2704
  * @throws {RequiredError}
2608
2705
  */
2609
2706
  getLoginIdentityHistory(loginIdentityId: string, options?: any): AxiosPromise<GetLoginIdentityHistoryResponse>;
2707
+ /**
2708
+ * Get payment instructions by payment_instruction_id
2709
+ * @param {string} paymentInstructionId The id of a payment instruction
2710
+ * @param {*} [options] Override http request option.
2711
+ * @throws {RequiredError}
2712
+ */
2713
+ getPaymentInstruction(paymentInstructionId: string, options?: any): AxiosPromise<GetPaymentInstructionsResponse>;
2610
2714
  /**
2611
2715
  * Get a list of institutions
2612
2716
  * @param {string} [country] The country the institution belongs to
@@ -2632,13 +2736,13 @@ export declare const CustomerApiFactory: (configuration?: Configuration, basePat
2632
2736
  */
2633
2737
  export interface CustomerApiInterface {
2634
2738
  /**
2635
- * Create a new payment instruction to be used when linking to perform debit authorization
2636
- * @param {PaymentInstruction} paymentInstruction Request body for starting a new Link
2739
+ * Create a new payment instruction to be used when linking to perform new payment
2740
+ * @param {CustomerPaymentInstruction} paymentInstruction Request body for starting a new Link
2637
2741
  * @param {*} [options] Override http request option.
2638
2742
  * @throws {RequiredError}
2639
2743
  * @memberof CustomerApiInterface
2640
2744
  */
2641
- createPaymentInstruction(paymentInstruction: PaymentInstruction, options?: AxiosRequestConfig): AxiosPromise<CreatePaymentInstructionResponse>;
2745
+ createPaymentInstruction(paymentInstruction: CustomerPaymentInstruction, options?: AxiosRequestConfig): AxiosPromise<CreatePaymentInstructionResponse>;
2642
2746
  /**
2643
2747
  * generate a link token that can be used to create link
2644
2748
  * @param {LinkTokenRequest} linkTokenRequest token request
@@ -2671,6 +2775,14 @@ export interface CustomerApiInterface {
2671
2775
  * @memberof CustomerApiInterface
2672
2776
  */
2673
2777
  getLoginIdentityHistory(loginIdentityId: string, options?: AxiosRequestConfig): AxiosPromise<GetLoginIdentityHistoryResponse>;
2778
+ /**
2779
+ * Get payment instructions by payment_instruction_id
2780
+ * @param {string} paymentInstructionId The id of a payment instruction
2781
+ * @param {*} [options] Override http request option.
2782
+ * @throws {RequiredError}
2783
+ * @memberof CustomerApiInterface
2784
+ */
2785
+ getPaymentInstruction(paymentInstructionId: string, options?: AxiosRequestConfig): AxiosPromise<GetPaymentInstructionsResponse>;
2674
2786
  /**
2675
2787
  * Get a list of institutions
2676
2788
  * @param {string} [country] The country the institution belongs to
@@ -2699,13 +2811,13 @@ export interface CustomerApiInterface {
2699
2811
  */
2700
2812
  export declare class CustomerApi extends BaseAPI implements CustomerApiInterface {
2701
2813
  /**
2702
- * Create a new payment instruction to be used when linking to perform debit authorization
2703
- * @param {PaymentInstruction} paymentInstruction Request body for starting a new Link
2814
+ * Create a new payment instruction to be used when linking to perform new payment
2815
+ * @param {CustomerPaymentInstruction} paymentInstruction Request body for starting a new Link
2704
2816
  * @param {*} [options] Override http request option.
2705
2817
  * @throws {RequiredError}
2706
2818
  * @memberof CustomerApi
2707
2819
  */
2708
- createPaymentInstruction(paymentInstruction: PaymentInstruction, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<CreatePaymentInstructionResponse>>;
2820
+ createPaymentInstruction(paymentInstruction: CustomerPaymentInstruction, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<CreatePaymentInstructionResponse>>;
2709
2821
  /**
2710
2822
  * generate a link token that can be used to create link
2711
2823
  * @param {LinkTokenRequest} linkTokenRequest token request
@@ -2738,6 +2850,14 @@ export declare class CustomerApi extends BaseAPI implements CustomerApiInterface
2738
2850
  * @memberof CustomerApi
2739
2851
  */
2740
2852
  getLoginIdentityHistory(loginIdentityId: string, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<GetLoginIdentityHistoryResponse>>;
2853
+ /**
2854
+ * Get payment instructions by payment_instruction_id
2855
+ * @param {string} paymentInstructionId The id of a payment instruction
2856
+ * @param {*} [options] Override http request option.
2857
+ * @throws {RequiredError}
2858
+ * @memberof CustomerApi
2859
+ */
2860
+ getPaymentInstruction(paymentInstructionId: string, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<GetPaymentInstructionsResponse>>;
2741
2861
  /**
2742
2862
  * Get a list of institutions
2743
2863
  * @param {string} [country] The country the institution belongs to
@@ -3084,12 +3204,6 @@ export declare const LoginIdentityApiAxiosParamCreator: (configuration?: Configu
3084
3204
  * @throws {RequiredError}
3085
3205
  */
3086
3206
  listAccounts: (options?: AxiosRequestConfig) => Promise<RequestArgs>;
3087
- /**
3088
- * Get list of payment instructions to be used when linking to perfom debit authorization
3089
- * @param {*} [options] Override http request option.
3090
- * @throws {RequiredError}
3091
- */
3092
- listPaymentInstructions: (options?: AxiosRequestConfig) => Promise<RequestArgs>;
3093
3207
  /**
3094
3208
  * Get a list of transactions for a particular account. The transactions are returned in sorted order, with the most recent one appearing first.
3095
3209
  * @param {string} accountId The account id (ULID, example - 01EP4A1MZDHKETZFRPF0K62S6S)
@@ -3197,12 +3311,6 @@ export declare const LoginIdentityApiFp: (configuration?: Configuration) => {
3197
3311
  * @throws {RequiredError}
3198
3312
  */
3199
3313
  listAccounts(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ListAccountsResponse>>;
3200
- /**
3201
- * Get list of payment instructions to be used when linking to perfom debit authorization
3202
- * @param {*} [options] Override http request option.
3203
- * @throws {RequiredError}
3204
- */
3205
- listPaymentInstructions(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ListPaymentInstructionsResponse>>;
3206
3314
  /**
3207
3315
  * Get a list of transactions for a particular account. The transactions are returned in sorted order, with the most recent one appearing first.
3208
3316
  * @param {string} accountId The account id (ULID, example - 01EP4A1MZDHKETZFRPF0K62S6S)
@@ -3310,12 +3418,6 @@ export declare const LoginIdentityApiFactory: (configuration?: Configuration, ba
3310
3418
  * @throws {RequiredError}
3311
3419
  */
3312
3420
  listAccounts(options?: any): AxiosPromise<ListAccountsResponse>;
3313
- /**
3314
- * Get list of payment instructions to be used when linking to perfom debit authorization
3315
- * @param {*} [options] Override http request option.
3316
- * @throws {RequiredError}
3317
- */
3318
- listPaymentInstructions(options?: any): AxiosPromise<ListPaymentInstructionsResponse>;
3319
3421
  /**
3320
3422
  * Get a list of transactions for a particular account. The transactions are returned in sorted order, with the most recent one appearing first.
3321
3423
  * @param {string} accountId The account id (ULID, example - 01EP4A1MZDHKETZFRPF0K62S6S)
@@ -3436,13 +3538,6 @@ export interface LoginIdentityApiInterface {
3436
3538
  * @memberof LoginIdentityApiInterface
3437
3539
  */
3438
3540
  listAccounts(options?: AxiosRequestConfig): AxiosPromise<ListAccountsResponse>;
3439
- /**
3440
- * Get list of payment instructions to be used when linking to perfom debit authorization
3441
- * @param {*} [options] Override http request option.
3442
- * @throws {RequiredError}
3443
- * @memberof LoginIdentityApiInterface
3444
- */
3445
- listPaymentInstructions(options?: AxiosRequestConfig): AxiosPromise<ListPaymentInstructionsResponse>;
3446
3541
  /**
3447
3542
  * Get a list of transactions for a particular account. The transactions are returned in sorted order, with the most recent one appearing first.
3448
3543
  * @param {string} accountId The account id (ULID, example - 01EP4A1MZDHKETZFRPF0K62S6S)
@@ -3567,13 +3662,6 @@ export declare class LoginIdentityApi extends BaseAPI implements LoginIdentityAp
3567
3662
  * @memberof LoginIdentityApi
3568
3663
  */
3569
3664
  listAccounts(options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<ListAccountsResponse>>;
3570
- /**
3571
- * Get list of payment instructions to be used when linking to perfom debit authorization
3572
- * @param {*} [options] Override http request option.
3573
- * @throws {RequiredError}
3574
- * @memberof LoginIdentityApi
3575
- */
3576
- listPaymentInstructions(options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<ListPaymentInstructionsResponse>>;
3577
3665
  /**
3578
3666
  * Get a list of transactions for a particular account. The transactions are returned in sorted order, with the most recent one appearing first.
3579
3667
  * @param {string} accountId The account id (ULID, example - 01EP4A1MZDHKETZFRPF0K62S6S)
@@ -3601,6 +3689,113 @@ export declare class LoginIdentityApi extends BaseAPI implements LoginIdentityAp
3601
3689
  */
3602
3690
  refreshLoginIdentity(options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<void>>;
3603
3691
  }
3692
+ /**
3693
+ * PaymentApi - axios parameter creator
3694
+ * @export
3695
+ */
3696
+ export declare const PaymentApiAxiosParamCreator: (configuration?: Configuration) => {
3697
+ /**
3698
+ * Create a new payment instruction to be used when linking to perform new payment
3699
+ * @param {CustomerPaymentInstruction} paymentInstruction Request body for starting a new Link
3700
+ * @param {*} [options] Override http request option.
3701
+ * @throws {RequiredError}
3702
+ */
3703
+ createPaymentInstruction: (paymentInstruction: CustomerPaymentInstruction, options?: AxiosRequestConfig) => Promise<RequestArgs>;
3704
+ /**
3705
+ * Get payment instructions by payment_instruction_id
3706
+ * @param {string} paymentInstructionId The id of a payment instruction
3707
+ * @param {*} [options] Override http request option.
3708
+ * @throws {RequiredError}
3709
+ */
3710
+ getPaymentInstruction: (paymentInstructionId: string, options?: AxiosRequestConfig) => Promise<RequestArgs>;
3711
+ };
3712
+ /**
3713
+ * PaymentApi - functional programming interface
3714
+ * @export
3715
+ */
3716
+ export declare const PaymentApiFp: (configuration?: Configuration) => {
3717
+ /**
3718
+ * Create a new payment instruction to be used when linking to perform new payment
3719
+ * @param {CustomerPaymentInstruction} paymentInstruction Request body for starting a new Link
3720
+ * @param {*} [options] Override http request option.
3721
+ * @throws {RequiredError}
3722
+ */
3723
+ createPaymentInstruction(paymentInstruction: CustomerPaymentInstruction, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CreatePaymentInstructionResponse>>;
3724
+ /**
3725
+ * Get payment instructions by payment_instruction_id
3726
+ * @param {string} paymentInstructionId The id of a payment instruction
3727
+ * @param {*} [options] Override http request option.
3728
+ * @throws {RequiredError}
3729
+ */
3730
+ getPaymentInstruction(paymentInstructionId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GetPaymentInstructionsResponse>>;
3731
+ };
3732
+ /**
3733
+ * PaymentApi - factory interface
3734
+ * @export
3735
+ */
3736
+ export declare const PaymentApiFactory: (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) => {
3737
+ /**
3738
+ * Create a new payment instruction to be used when linking to perform new payment
3739
+ * @param {CustomerPaymentInstruction} paymentInstruction Request body for starting a new Link
3740
+ * @param {*} [options] Override http request option.
3741
+ * @throws {RequiredError}
3742
+ */
3743
+ createPaymentInstruction(paymentInstruction: CustomerPaymentInstruction, options?: any): AxiosPromise<CreatePaymentInstructionResponse>;
3744
+ /**
3745
+ * Get payment instructions by payment_instruction_id
3746
+ * @param {string} paymentInstructionId The id of a payment instruction
3747
+ * @param {*} [options] Override http request option.
3748
+ * @throws {RequiredError}
3749
+ */
3750
+ getPaymentInstruction(paymentInstructionId: string, options?: any): AxiosPromise<GetPaymentInstructionsResponse>;
3751
+ };
3752
+ /**
3753
+ * PaymentApi - interface
3754
+ * @export
3755
+ * @interface PaymentApi
3756
+ */
3757
+ export interface PaymentApiInterface {
3758
+ /**
3759
+ * Create a new payment instruction to be used when linking to perform new payment
3760
+ * @param {CustomerPaymentInstruction} paymentInstruction Request body for starting a new Link
3761
+ * @param {*} [options] Override http request option.
3762
+ * @throws {RequiredError}
3763
+ * @memberof PaymentApiInterface
3764
+ */
3765
+ createPaymentInstruction(paymentInstruction: CustomerPaymentInstruction, options?: AxiosRequestConfig): AxiosPromise<CreatePaymentInstructionResponse>;
3766
+ /**
3767
+ * Get payment instructions by payment_instruction_id
3768
+ * @param {string} paymentInstructionId The id of a payment instruction
3769
+ * @param {*} [options] Override http request option.
3770
+ * @throws {RequiredError}
3771
+ * @memberof PaymentApiInterface
3772
+ */
3773
+ getPaymentInstruction(paymentInstructionId: string, options?: AxiosRequestConfig): AxiosPromise<GetPaymentInstructionsResponse>;
3774
+ }
3775
+ /**
3776
+ * PaymentApi - object-oriented interface
3777
+ * @export
3778
+ * @class PaymentApi
3779
+ * @extends {BaseAPI}
3780
+ */
3781
+ export declare class PaymentApi extends BaseAPI implements PaymentApiInterface {
3782
+ /**
3783
+ * Create a new payment instruction to be used when linking to perform new payment
3784
+ * @param {CustomerPaymentInstruction} paymentInstruction Request body for starting a new Link
3785
+ * @param {*} [options] Override http request option.
3786
+ * @throws {RequiredError}
3787
+ * @memberof PaymentApi
3788
+ */
3789
+ createPaymentInstruction(paymentInstruction: CustomerPaymentInstruction, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<CreatePaymentInstructionResponse>>;
3790
+ /**
3791
+ * Get payment instructions by payment_instruction_id
3792
+ * @param {string} paymentInstructionId The id of a payment instruction
3793
+ * @param {*} [options] Override http request option.
3794
+ * @throws {RequiredError}
3795
+ * @memberof PaymentApi
3796
+ */
3797
+ getPaymentInstruction(paymentInstructionId: string, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<GetPaymentInstructionsResponse>>;
3798
+ }
3604
3799
  /**
3605
3800
  * PublicApi - axios parameter creator
3606
3801
  * @export
package/dist/api.js CHANGED
@@ -22,19 +22,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
22
22
  });
23
23
  };
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.PublicApi = exports.PublicApiFactory = exports.PublicApiFp = exports.PublicApiAxiosParamCreator = exports.LoginIdentityApi = exports.LoginIdentityApiFactory = exports.LoginIdentityApiFp = exports.LoginIdentityApiAxiosParamCreator = exports.LinkApi = exports.LinkApiFactory = exports.LinkApiFp = exports.LinkApiAxiosParamCreator = exports.CustomerApi = exports.CustomerApiFactory = exports.CustomerApiFp = exports.CustomerApiAxiosParamCreator = exports.PaymentInstructionPaymentTypeEnum = exports.LinkTokenRequestUiModeEnum = void 0;
25
+ exports.PublicApi = exports.PublicApiFactory = exports.PublicApiFp = exports.PublicApiAxiosParamCreator = exports.PaymentApi = exports.PaymentApiFactory = exports.PaymentApiFp = exports.PaymentApiAxiosParamCreator = exports.LoginIdentityApi = exports.LoginIdentityApiFactory = exports.LoginIdentityApiFp = exports.LoginIdentityApiAxiosParamCreator = exports.LinkApi = exports.LinkApiFactory = exports.LinkApiFp = exports.LinkApiAxiosParamCreator = exports.CustomerApi = exports.CustomerApiFactory = exports.CustomerApiFp = exports.CustomerApiAxiosParamCreator = exports.PaymentInstructionTypeEnum = exports.LinkTokenRequestUiModeEnum = exports.CustomerPaymentInstructionTypeEnum = void 0;
26
26
  const axios_1 = require("axios");
27
27
  // Some imports not used depending on template conditions
28
28
  // @ts-ignore
29
29
  const common_1 = require("./common");
30
30
  // @ts-ignore
31
31
  const base_1 = require("./base");
32
+ exports.CustomerPaymentInstructionTypeEnum = {
33
+ DebitAuthorization: 'DEBIT_AUTHORIZATION',
34
+ };
32
35
  exports.LinkTokenRequestUiModeEnum = {
33
36
  Iframe: 'iframe',
34
37
  Redirect: 'redirect',
35
38
  AutoRedirect: 'auto_redirect',
36
39
  };
37
- exports.PaymentInstructionPaymentTypeEnum = {
40
+ exports.PaymentInstructionTypeEnum = {
38
41
  DebitAuthorization: 'DEBIT_AUTHORIZATION',
39
42
  };
40
43
  /**
@@ -44,8 +47,8 @@ exports.PaymentInstructionPaymentTypeEnum = {
44
47
  exports.CustomerApiAxiosParamCreator = function (configuration) {
45
48
  return {
46
49
  /**
47
- * Create a new payment instruction to be used when linking to perform debit authorization
48
- * @param {PaymentInstruction} paymentInstruction Request body for starting a new Link
50
+ * Create a new payment instruction to be used when linking to perform new payment
51
+ * @param {CustomerPaymentInstruction} paymentInstruction Request body for starting a new Link
49
52
  * @param {*} [options] Override http request option.
50
53
  * @throws {RequiredError}
51
54
  */
@@ -197,6 +200,36 @@ exports.CustomerApiAxiosParamCreator = function (configuration) {
197
200
  options: localVarRequestOptions,
198
201
  };
199
202
  }),
203
+ /**
204
+ * Get payment instructions by payment_instruction_id
205
+ * @param {string} paymentInstructionId The id of a payment instruction
206
+ * @param {*} [options] Override http request option.
207
+ * @throws {RequiredError}
208
+ */
209
+ getPaymentInstruction: (paymentInstructionId, options = {}) => __awaiter(this, void 0, void 0, function* () {
210
+ // verify required parameter 'paymentInstructionId' is not null or undefined
211
+ common_1.assertParamExists('getPaymentInstruction', 'paymentInstructionId', paymentInstructionId);
212
+ const localVarPath = `/payments/instruction/{paymentInstructionId}`.replace(`{${'paymentInstructionId'}}`, encodeURIComponent(String(paymentInstructionId)));
213
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
214
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
215
+ let baseOptions;
216
+ if (configuration) {
217
+ baseOptions = configuration.baseOptions;
218
+ }
219
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
220
+ const localVarHeaderParameter = {};
221
+ const localVarQueryParameter = {};
222
+ // authentication Oauth2 required
223
+ // oauth required
224
+ yield common_1.setOAuthToObject(localVarHeaderParameter, 'Oauth2', [], configuration);
225
+ common_1.setSearchParams(localVarUrlObj, localVarQueryParameter);
226
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
227
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
228
+ return {
229
+ url: common_1.toPathString(localVarUrlObj),
230
+ options: localVarRequestOptions,
231
+ };
232
+ }),
200
233
  /**
201
234
  * Get a list of institutions
202
235
  * @param {string} [country] The country the institution belongs to
@@ -282,8 +315,8 @@ exports.CustomerApiFp = function (configuration) {
282
315
  const localVarAxiosParamCreator = exports.CustomerApiAxiosParamCreator(configuration);
283
316
  return {
284
317
  /**
285
- * Create a new payment instruction to be used when linking to perform debit authorization
286
- * @param {PaymentInstruction} paymentInstruction Request body for starting a new Link
318
+ * Create a new payment instruction to be used when linking to perform new payment
319
+ * @param {CustomerPaymentInstruction} paymentInstruction Request body for starting a new Link
287
320
  * @param {*} [options] Override http request option.
288
321
  * @throws {RequiredError}
289
322
  */
@@ -341,6 +374,18 @@ exports.CustomerApiFp = function (configuration) {
341
374
  return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
342
375
  });
343
376
  },
377
+ /**
378
+ * Get payment instructions by payment_instruction_id
379
+ * @param {string} paymentInstructionId The id of a payment instruction
380
+ * @param {*} [options] Override http request option.
381
+ * @throws {RequiredError}
382
+ */
383
+ getPaymentInstruction(paymentInstructionId, options) {
384
+ return __awaiter(this, void 0, void 0, function* () {
385
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.getPaymentInstruction(paymentInstructionId, options);
386
+ return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
387
+ });
388
+ },
344
389
  /**
345
390
  * Get a list of institutions
346
391
  * @param {string} [country] The country the institution belongs to
@@ -378,8 +423,8 @@ exports.CustomerApiFactory = function (configuration, basePath, axios) {
378
423
  const localVarFp = exports.CustomerApiFp(configuration);
379
424
  return {
380
425
  /**
381
- * Create a new payment instruction to be used when linking to perform debit authorization
382
- * @param {PaymentInstruction} paymentInstruction Request body for starting a new Link
426
+ * Create a new payment instruction to be used when linking to perform new payment
427
+ * @param {CustomerPaymentInstruction} paymentInstruction Request body for starting a new Link
383
428
  * @param {*} [options] Override http request option.
384
429
  * @throws {RequiredError}
385
430
  */
@@ -424,6 +469,17 @@ exports.CustomerApiFactory = function (configuration, basePath, axios) {
424
469
  getLoginIdentityHistory(loginIdentityId, options) {
425
470
  return localVarFp.getLoginIdentityHistory(loginIdentityId, options).then((request) => request(axios, basePath));
426
471
  },
472
+ /**
473
+ * Get payment instructions by payment_instruction_id
474
+ * @param {string} paymentInstructionId The id of a payment instruction
475
+ * @param {*} [options] Override http request option.
476
+ * @throws {RequiredError}
477
+ */
478
+ getPaymentInstruction(paymentInstructionId, options) {
479
+ return localVarFp
480
+ .getPaymentInstruction(paymentInstructionId, options)
481
+ .then((request) => request(axios, basePath));
482
+ },
427
483
  /**
428
484
  * Get a list of institutions
429
485
  * @param {string} [country] The country the institution belongs to
@@ -457,8 +513,8 @@ exports.CustomerApiFactory = function (configuration, basePath, axios) {
457
513
  */
458
514
  class CustomerApi extends base_1.BaseAPI {
459
515
  /**
460
- * Create a new payment instruction to be used when linking to perform debit authorization
461
- * @param {PaymentInstruction} paymentInstruction Request body for starting a new Link
516
+ * Create a new payment instruction to be used when linking to perform new payment
517
+ * @param {CustomerPaymentInstruction} paymentInstruction Request body for starting a new Link
462
518
  * @param {*} [options] Override http request option.
463
519
  * @throws {RequiredError}
464
520
  * @memberof CustomerApi
@@ -516,6 +572,18 @@ class CustomerApi extends base_1.BaseAPI {
516
572
  .getLoginIdentityHistory(loginIdentityId, options)
517
573
  .then((request) => request(this.axios, this.basePath));
518
574
  }
575
+ /**
576
+ * Get payment instructions by payment_instruction_id
577
+ * @param {string} paymentInstructionId The id of a payment instruction
578
+ * @param {*} [options] Override http request option.
579
+ * @throws {RequiredError}
580
+ * @memberof CustomerApi
581
+ */
582
+ getPaymentInstruction(paymentInstructionId, options) {
583
+ return exports.CustomerApiFp(this.configuration)
584
+ .getPaymentInstruction(paymentInstructionId, options)
585
+ .then((request) => request(this.axios, this.basePath));
586
+ }
519
587
  /**
520
588
  * Get a list of institutions
521
589
  * @param {string} [country] The country the institution belongs to
@@ -1302,33 +1370,6 @@ exports.LoginIdentityApiAxiosParamCreator = function (configuration) {
1302
1370
  options: localVarRequestOptions,
1303
1371
  };
1304
1372
  }),
1305
- /**
1306
- * Get list of payment instructions to be used when linking to perfom debit authorization
1307
- * @param {*} [options] Override http request option.
1308
- * @throws {RequiredError}
1309
- */
1310
- listPaymentInstructions: (options = {}) => __awaiter(this, void 0, void 0, function* () {
1311
- const localVarPath = `/payments/instruction`;
1312
- // use dummy base URL string because the URL constructor only accepts absolute URLs.
1313
- const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
1314
- let baseOptions;
1315
- if (configuration) {
1316
- baseOptions = configuration.baseOptions;
1317
- }
1318
- const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
1319
- const localVarHeaderParameter = {};
1320
- const localVarQueryParameter = {};
1321
- // authentication Oauth2 required
1322
- // oauth required
1323
- yield common_1.setOAuthToObject(localVarHeaderParameter, 'Oauth2', [], configuration);
1324
- common_1.setSearchParams(localVarUrlObj, localVarQueryParameter);
1325
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1326
- localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
1327
- return {
1328
- url: common_1.toPathString(localVarUrlObj),
1329
- options: localVarRequestOptions,
1330
- };
1331
- }),
1332
1373
  /**
1333
1374
  * Get a list of transactions for a particular account. The transactions are returned in sorted order, with the most recent one appearing first.
1334
1375
  * @param {string} accountId The account id (ULID, example - 01EP4A1MZDHKETZFRPF0K62S6S)
@@ -1576,17 +1617,6 @@ exports.LoginIdentityApiFp = function (configuration) {
1576
1617
  return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
1577
1618
  });
1578
1619
  },
1579
- /**
1580
- * Get list of payment instructions to be used when linking to perfom debit authorization
1581
- * @param {*} [options] Override http request option.
1582
- * @throws {RequiredError}
1583
- */
1584
- listPaymentInstructions(options) {
1585
- return __awaiter(this, void 0, void 0, function* () {
1586
- const localVarAxiosArgs = yield localVarAxiosParamCreator.listPaymentInstructions(options);
1587
- return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
1588
- });
1589
- },
1590
1620
  /**
1591
1621
  * Get a list of transactions for a particular account. The transactions are returned in sorted order, with the most recent one appearing first.
1592
1622
  * @param {string} accountId The account id (ULID, example - 01EP4A1MZDHKETZFRPF0K62S6S)
@@ -1736,14 +1766,6 @@ exports.LoginIdentityApiFactory = function (configuration, basePath, axios) {
1736
1766
  listAccounts(options) {
1737
1767
  return localVarFp.listAccounts(options).then((request) => request(axios, basePath));
1738
1768
  },
1739
- /**
1740
- * Get list of payment instructions to be used when linking to perfom debit authorization
1741
- * @param {*} [options] Override http request option.
1742
- * @throws {RequiredError}
1743
- */
1744
- listPaymentInstructions(options) {
1745
- return localVarFp.listPaymentInstructions(options).then((request) => request(axios, basePath));
1746
- },
1747
1769
  /**
1748
1770
  * Get a list of transactions for a particular account. The transactions are returned in sorted order, with the most recent one appearing first.
1749
1771
  * @param {string} accountId The account id (ULID, example - 01EP4A1MZDHKETZFRPF0K62S6S)
@@ -1924,17 +1946,6 @@ class LoginIdentityApi extends base_1.BaseAPI {
1924
1946
  .listAccounts(options)
1925
1947
  .then((request) => request(this.axios, this.basePath));
1926
1948
  }
1927
- /**
1928
- * Get list of payment instructions to be used when linking to perfom debit authorization
1929
- * @param {*} [options] Override http request option.
1930
- * @throws {RequiredError}
1931
- * @memberof LoginIdentityApi
1932
- */
1933
- listPaymentInstructions(options) {
1934
- return exports.LoginIdentityApiFp(this.configuration)
1935
- .listPaymentInstructions(options)
1936
- .then((request) => request(this.axios, this.basePath));
1937
- }
1938
1949
  /**
1939
1950
  * Get a list of transactions for a particular account. The transactions are returned in sorted order, with the most recent one appearing first.
1940
1951
  * @param {string} accountId The account id (ULID, example - 01EP4A1MZDHKETZFRPF0K62S6S)
@@ -1975,6 +1986,173 @@ class LoginIdentityApi extends base_1.BaseAPI {
1975
1986
  }
1976
1987
  }
1977
1988
  exports.LoginIdentityApi = LoginIdentityApi;
1989
+ /**
1990
+ * PaymentApi - axios parameter creator
1991
+ * @export
1992
+ */
1993
+ exports.PaymentApiAxiosParamCreator = function (configuration) {
1994
+ return {
1995
+ /**
1996
+ * Create a new payment instruction to be used when linking to perform new payment
1997
+ * @param {CustomerPaymentInstruction} paymentInstruction Request body for starting a new Link
1998
+ * @param {*} [options] Override http request option.
1999
+ * @throws {RequiredError}
2000
+ */
2001
+ createPaymentInstruction: (paymentInstruction, options = {}) => __awaiter(this, void 0, void 0, function* () {
2002
+ // verify required parameter 'paymentInstruction' is not null or undefined
2003
+ common_1.assertParamExists('createPaymentInstruction', 'paymentInstruction', paymentInstruction);
2004
+ const localVarPath = `/payments/instruction`;
2005
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
2006
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
2007
+ let baseOptions;
2008
+ if (configuration) {
2009
+ baseOptions = configuration.baseOptions;
2010
+ }
2011
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
2012
+ const localVarHeaderParameter = {};
2013
+ const localVarQueryParameter = {};
2014
+ // authentication Oauth2 required
2015
+ // oauth required
2016
+ yield common_1.setOAuthToObject(localVarHeaderParameter, 'Oauth2', [], configuration);
2017
+ localVarHeaderParameter['Content-Type'] = 'application/json';
2018
+ common_1.setSearchParams(localVarUrlObj, localVarQueryParameter);
2019
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
2020
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
2021
+ localVarRequestOptions.data = common_1.serializeDataIfNeeded(paymentInstruction, localVarRequestOptions, configuration);
2022
+ return {
2023
+ url: common_1.toPathString(localVarUrlObj),
2024
+ options: localVarRequestOptions,
2025
+ };
2026
+ }),
2027
+ /**
2028
+ * Get payment instructions by payment_instruction_id
2029
+ * @param {string} paymentInstructionId The id of a payment instruction
2030
+ * @param {*} [options] Override http request option.
2031
+ * @throws {RequiredError}
2032
+ */
2033
+ getPaymentInstruction: (paymentInstructionId, options = {}) => __awaiter(this, void 0, void 0, function* () {
2034
+ // verify required parameter 'paymentInstructionId' is not null or undefined
2035
+ common_1.assertParamExists('getPaymentInstruction', 'paymentInstructionId', paymentInstructionId);
2036
+ const localVarPath = `/payments/instruction/{paymentInstructionId}`.replace(`{${'paymentInstructionId'}}`, encodeURIComponent(String(paymentInstructionId)));
2037
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
2038
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
2039
+ let baseOptions;
2040
+ if (configuration) {
2041
+ baseOptions = configuration.baseOptions;
2042
+ }
2043
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
2044
+ const localVarHeaderParameter = {};
2045
+ const localVarQueryParameter = {};
2046
+ // authentication Oauth2 required
2047
+ // oauth required
2048
+ yield common_1.setOAuthToObject(localVarHeaderParameter, 'Oauth2', [], configuration);
2049
+ common_1.setSearchParams(localVarUrlObj, localVarQueryParameter);
2050
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
2051
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
2052
+ return {
2053
+ url: common_1.toPathString(localVarUrlObj),
2054
+ options: localVarRequestOptions,
2055
+ };
2056
+ }),
2057
+ };
2058
+ };
2059
+ /**
2060
+ * PaymentApi - functional programming interface
2061
+ * @export
2062
+ */
2063
+ exports.PaymentApiFp = function (configuration) {
2064
+ const localVarAxiosParamCreator = exports.PaymentApiAxiosParamCreator(configuration);
2065
+ return {
2066
+ /**
2067
+ * Create a new payment instruction to be used when linking to perform new payment
2068
+ * @param {CustomerPaymentInstruction} paymentInstruction Request body for starting a new Link
2069
+ * @param {*} [options] Override http request option.
2070
+ * @throws {RequiredError}
2071
+ */
2072
+ createPaymentInstruction(paymentInstruction, options) {
2073
+ return __awaiter(this, void 0, void 0, function* () {
2074
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.createPaymentInstruction(paymentInstruction, options);
2075
+ return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
2076
+ });
2077
+ },
2078
+ /**
2079
+ * Get payment instructions by payment_instruction_id
2080
+ * @param {string} paymentInstructionId The id of a payment instruction
2081
+ * @param {*} [options] Override http request option.
2082
+ * @throws {RequiredError}
2083
+ */
2084
+ getPaymentInstruction(paymentInstructionId, options) {
2085
+ return __awaiter(this, void 0, void 0, function* () {
2086
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.getPaymentInstruction(paymentInstructionId, options);
2087
+ return common_1.createRequestFunction(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
2088
+ });
2089
+ },
2090
+ };
2091
+ };
2092
+ /**
2093
+ * PaymentApi - factory interface
2094
+ * @export
2095
+ */
2096
+ exports.PaymentApiFactory = function (configuration, basePath, axios) {
2097
+ const localVarFp = exports.PaymentApiFp(configuration);
2098
+ return {
2099
+ /**
2100
+ * Create a new payment instruction to be used when linking to perform new payment
2101
+ * @param {CustomerPaymentInstruction} paymentInstruction Request body for starting a new Link
2102
+ * @param {*} [options] Override http request option.
2103
+ * @throws {RequiredError}
2104
+ */
2105
+ createPaymentInstruction(paymentInstruction, options) {
2106
+ return localVarFp
2107
+ .createPaymentInstruction(paymentInstruction, options)
2108
+ .then((request) => request(axios, basePath));
2109
+ },
2110
+ /**
2111
+ * Get payment instructions by payment_instruction_id
2112
+ * @param {string} paymentInstructionId The id of a payment instruction
2113
+ * @param {*} [options] Override http request option.
2114
+ * @throws {RequiredError}
2115
+ */
2116
+ getPaymentInstruction(paymentInstructionId, options) {
2117
+ return localVarFp
2118
+ .getPaymentInstruction(paymentInstructionId, options)
2119
+ .then((request) => request(axios, basePath));
2120
+ },
2121
+ };
2122
+ };
2123
+ /**
2124
+ * PaymentApi - object-oriented interface
2125
+ * @export
2126
+ * @class PaymentApi
2127
+ * @extends {BaseAPI}
2128
+ */
2129
+ class PaymentApi extends base_1.BaseAPI {
2130
+ /**
2131
+ * Create a new payment instruction to be used when linking to perform new payment
2132
+ * @param {CustomerPaymentInstruction} paymentInstruction Request body for starting a new Link
2133
+ * @param {*} [options] Override http request option.
2134
+ * @throws {RequiredError}
2135
+ * @memberof PaymentApi
2136
+ */
2137
+ createPaymentInstruction(paymentInstruction, options) {
2138
+ return exports.PaymentApiFp(this.configuration)
2139
+ .createPaymentInstruction(paymentInstruction, options)
2140
+ .then((request) => request(this.axios, this.basePath));
2141
+ }
2142
+ /**
2143
+ * Get payment instructions by payment_instruction_id
2144
+ * @param {string} paymentInstructionId The id of a payment instruction
2145
+ * @param {*} [options] Override http request option.
2146
+ * @throws {RequiredError}
2147
+ * @memberof PaymentApi
2148
+ */
2149
+ getPaymentInstruction(paymentInstructionId, options) {
2150
+ return exports.PaymentApiFp(this.configuration)
2151
+ .getPaymentInstruction(paymentInstructionId, options)
2152
+ .then((request) => request(this.axios, this.basePath));
2153
+ }
2154
+ }
2155
+ exports.PaymentApi = PaymentApi;
1978
2156
  /**
1979
2157
  * PublicApi - axios parameter creator
1980
2158
  * @export
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const axios_mock_adapter_1 = require("axios-mock-adapter");
13
+ const axios_1 = require("axios");
14
+ const config_1 = require("./config");
15
+ const __1 = require("..");
16
+ const api_1 = require("../api");
17
+ const customerToken_1 = require("./responses/customerToken");
18
+ const paymentInstruction_1 = require("./responses/paymentInstruction");
19
+ const chai_1 = require("chai");
20
+ describe('PaymentInstruction', function () {
21
+ let mock;
22
+ before(() => {
23
+ mock = new axios_mock_adapter_1.default(axios_1.default);
24
+ });
25
+ it('Create paymentInstruction', function () {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ mock.onPost(`${config_1.config.apiHost}/payments/instruction`).reply(200, paymentInstruction_1.createPaymentInstruction());
28
+ const configuration = new __1.Configuration({ basePath: config_1.config.apiHost, accessToken: customerToken_1.customerToken.access_token });
29
+ const paymentInstruction = {
30
+ type: "DEBIT_AUTHORIZATION",
31
+ user_id: "customer_user1",
32
+ frequency: "MONTHLY",
33
+ start_date: "2022-04-01",
34
+ end_date: "2022-12-01",
35
+ amount: 1000,
36
+ currency: "PHP",
37
+ recipient_name: "HOMECREDIT",
38
+ recipient_account_id: "Recipient Account Id",
39
+ sender_name: "Sender Name",
40
+ sender_account_id: "LOAN102345",
41
+ remarks: "HOME CREDIT REPAYMENT"
42
+ };
43
+ const createPaymentInstructionResponse = yield new api_1.CustomerApi(configuration).createPaymentInstruction(paymentInstruction);
44
+ chai_1.expect(createPaymentInstructionResponse.data.payment_instruction_id).to.be.ok;
45
+ });
46
+ });
47
+ it('Get paymentInstruction', function () {
48
+ return __awaiter(this, void 0, void 0, function* () {
49
+ mock.onGet(`${config_1.config.apiHost}/payments/instruction/stub_payment_instruction_id`).reply(200, paymentInstruction_1.getPaymentInstruction());
50
+ const configuration = new __1.Configuration({ basePath: config_1.config.apiHost, accessToken: customerToken_1.customerToken.access_token });
51
+ const getPaymentInstructionResponse = yield new api_1.CustomerApi(configuration).getPaymentInstruction("stub_payment_instruction_id");
52
+ chai_1.expect(getPaymentInstructionResponse.data.payment_instruction).to.be.ok;
53
+ });
54
+ });
55
+ after(() => {
56
+ mock.restore();
57
+ });
58
+ });
@@ -0,0 +1,3 @@
1
+ import { GetPaymentInstructionsResponse, CreatePaymentInstructionResponse } from '../../api';
2
+ export declare function createPaymentInstruction(): CreatePaymentInstructionResponse;
3
+ export declare function getPaymentInstruction(): GetPaymentInstructionsResponse;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPaymentInstruction = exports.createPaymentInstruction = void 0;
4
+ function createPaymentInstruction() {
5
+ return {
6
+ payment_instruction_id: "01FYRK0Q1DVFTJRG50J5QT424Y",
7
+ };
8
+ }
9
+ exports.createPaymentInstruction = createPaymentInstruction;
10
+ function getPaymentInstruction() {
11
+ return {
12
+ payment_instruction: {
13
+ amount: 1000,
14
+ currency: "PHP",
15
+ end_date: "2022-12-01",
16
+ frequency: "MONTHLY",
17
+ info: {},
18
+ recipient_account_id: "HOMECREDIT",
19
+ recipient_name: "HOMECREDIT",
20
+ reference_id: "01G0KD6Z8P06W4536X4BHEQYAX",
21
+ remarks: "HOME CREDIT REPAYMENT",
22
+ sender_account_id: "LOAN102345",
23
+ sender_name: "Sender Name",
24
+ start_date: "2022-04-01",
25
+ status: "SUBMITTED",
26
+ type: "DEBIT_AUTHORIZATION",
27
+ }
28
+ };
29
+ }
30
+ exports.getPaymentInstruction = getPaymentInstruction;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finverse/sdk-typescript",
3
- "version": "0.0.19",
3
+ "version": "0.0.22",
4
4
  "description": "OpenAPI client for @finverse/sdk-typescript",
5
5
  "author": "OpenAPI-Generator Contributors",
6
6
  "keywords": [
@@ -21,7 +21,7 @@
21
21
  "axios": "^0.21.4"
22
22
  },
23
23
  "devDependencies": {
24
- "@types/chai": "^4.3.0",
24
+ "@types/chai": "^4.3.1",
25
25
  "@types/mocha": "^9.1.0",
26
26
  "@types/node": "^12.11.5",
27
27
  "axios-mock-adapter": "^1.20.0",