UNPKG

pnz-apicentre-sandbox-sdk

Version:

The sandbox, powered by Middleware New Zealand, is a dedicated environment that mimics an API Provider, as defined in the [Payments NZ API Centre standards](https://paymentsnz.atlassian.net/wiki/spaces/PaymentsNZAPIStandards/overview). This SDK is generat

536 lines (524 loc) 16.5 kB
/** * Account information PNZ-API-CentreLib * * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). */ import { ApiResponse, RequestOptions } from '../core'; import { AC1010Retrievebulktransactions, aC1010RetrievebulktransactionsSchema, } from '../models/aC1010Retrievebulktransactions'; import { AC101Retrieveconsentedaccountsinformation, aC101RetrieveconsentedaccountsinformationSchema, } from '../models/aC101Retrieveconsentedaccountsinformation'; import { AC102Retrievebulkbalances, aC102RetrievebulkbalancesSchema, } from '../models/aC102Retrievebulkbalances'; import { AC103Retrievebulkbeneficiaries, aC103RetrievebulkbeneficiariesSchema, } from '../models/aC103Retrievebulkbeneficiaries'; import { AC104Retrievebulkdirectdebits, aC104RetrievebulkdirectdebitsSchema, } from '../models/aC104Retrievebulkdirectdebits'; import { AC105Retrievebulkoffers, aC105RetrievebulkoffersSchema, } from '../models/aC105Retrievebulkoffers'; import { AC106Retrieveauthorisingparty, aC106RetrieveauthorisingpartySchema, } from '../models/aC106Retrieveauthorisingparty'; import { AC107Retrievebulkscheduledpayments, aC107RetrievebulkscheduledpaymentsSchema, } from '../models/aC107Retrievebulkscheduledpayments'; import { AC108Retrievebulkstandingorders, aC108RetrievebulkstandingordersSchema, } from '../models/aC108Retrievebulkstandingorders'; import { AC109Retrievebulkstatements, aC109RetrievebulkstatementsSchema, } from '../models/aC109Retrievebulkstatements'; import { string } from '../schema'; import { BaseController } from './baseController'; export class BulkEndpointsController extends BaseController { /** * This request queries the accounts which the customer consented for you to access in Step HF-AC7 - * Post consented accounts array to complete consent or Step DF-AC4 - Authorise consent. * * Preconditions: * * * This step relies on the presence of a PNZ-T-AC-AuthAccessToken, which is set upon successful * completion of Step HF-AC8 - Exchange authorization-code for access token or Step DF-AC5 - Exchange * auth_req_id for access token. * * * Response: * * * The response should be a collection of account resources. * * The balance of the accounts is dynamic so the balance returned may vary. * * * Postconditions: * * * The AccountId for the first account in the collection is saved in the PNZ-T-AC-AccountId * environment variable in preparation for subsequent account-related steps, such as Step AC11.1 - * Retrieve a specific account * * * Examples: * * * There is one example which shows the request and the expected response. * * * Troubleshooting: * * * The most likely cause of errors is an invalid or expired access token. Try starting from Step * AC1 - Initiate client credentials grant again. * * @param authorization * @return Response from the API call */ async retrieveConsentedAccountsInformation( authorization: string, requestOptions?: RequestOptions ): Promise<ApiResponse<AC101Retrieveconsentedaccountsinformation>> { const req = this.createRequest('GET', '/open-banking-nz/v2.3/accounts'); const mapped = req.prepareArgs({ authorization: [authorization, string()], }); req.header('Authorization', mapped.authorization); return req.callAsJson( aC101RetrieveconsentedaccountsinformationSchema, requestOptions ); } /** * This request queries the accounts which the Customer has consented for you to access. * * Preconditions: * * * This step relies on the presence of a PNZ-T-AC-AuthAccessToken, which is set upon successful * completion of Step HF-AC8 - Exchange authorization-code for access token or Step DF-AC5 - Exchange * auth_req_id for access token. * * * Response: * * * The response should be a collection of balance resources for all accounts which the Customer * consented for you to access. * * The balance of the accounts is dynamic so the balance returned may vary. * * * Postconditions: * * * None * * * Examples: * * * There is one example which shows the request and the expected response. * * * Troubleshooting: * * * The most likely cause of errors is an expired access token. Try starting from Step AC1 - * Initiate client credentials grant again. * * @param authorization * @return Response from the API call */ async retrieveBulkBalances( authorization: string, requestOptions?: RequestOptions ): Promise<ApiResponse<AC102Retrievebulkbalances>> { const req = this.createRequest('GET', '/open-banking-nz/v2.3/balances'); const mapped = req.prepareArgs({ authorization: [authorization, string()], }); req.header('Authorization', mapped.authorization); return req.callAsJson(aC102RetrievebulkbalancesSchema, requestOptions); } /** * This request queries the accounts which the Customer has consented for you to access. * * Preconditions: * * * This step relies on the presence of a PNZ-T-AC-AuthAccessToken, which is set upon successful * completion of Step HF-AC8 - Exchange authorization-code for access token or Step DF-AC5 - Exchange * auth_req_id for access token. * * * Response: * * * The response should be a collection of beneficiary resources for all accounts which the Customer * consented for you to access. * * * Postconditions: * * * None * * * Examples: * * * There is one example which shows the request and the expected response. * * * Troubleshooting: * * * The most likely cause of errors is an expired access token. Try starting from Step AC1 - * Initiate client credentials grant again. * * @param authorization * @return Response from the API call */ async retrieveBulkBeneficiaries( authorization: string, requestOptions?: RequestOptions ): Promise<ApiResponse<AC103Retrievebulkbeneficiaries>> { const req = this.createRequest( 'GET', '/open-banking-nz/v2.3/beneficiaries' ); const mapped = req.prepareArgs({ authorization: [authorization, string()], }); req.header('Authorization', mapped.authorization); return req.callAsJson(aC103RetrievebulkbeneficiariesSchema, requestOptions); } /** * This request queries the accounts which the Customer has consented for you to access. * * Preconditions: * * * This step relies on the presence of a PNZ-T-AC-AuthAccessToken, which is set upon successful * completion of Step HF-AC8 - Exchange authorization-code for access token or Step DF-AC5 - Exchange * auth_req_id for access token. * * * Response: * * * The response should be a collection of direct debit resources for all accounts which the * Customer consented for you to access. * * * Postconditions: * * * None * * * Examples: * * * There is one example which shows the request and the expected response. * * * Troubleshooting: * * * The most likely cause of errors is an expired access token. Try starting from Step AC1 - * Initiate client credentials grant again. * * @param authorization * @return Response from the API call */ async retrieveBulkDirectDebits( authorization: string, requestOptions?: RequestOptions ): Promise<ApiResponse<AC104Retrievebulkdirectdebits>> { const req = this.createRequest( 'GET', '/open-banking-nz/v2.3/direct-debits' ); const mapped = req.prepareArgs({ authorization: [authorization, string()], }); req.header('Authorization', mapped.authorization); return req.callAsJson(aC104RetrievebulkdirectdebitsSchema, requestOptions); } /** * This request queries the accounts which the Customer has consented for you to access. * * Preconditions: * * * This step relies on the presence of a PNZ-T-AC-AuthAccessToken, which is set upon successful * completion of Step HF-AC8 - Exchange authorization-code for access token or Step DF-AC5 - Exchange * auth_req_id for access token. * * * Response: * * * The response should be a collection of offer resources for all accounts which the Customer * consented for you to access. * * * Postconditions: * * * None * * * Examples: * * * There is one example which shows the request and the expected response. * * * Troubleshooting: * * * The most likely cause of errors is an expired access token. Try starting from Step AC1 - * Initiate client credentials grant again. * * @param authorization * @return Response from the API call */ async retrieveBulkOffers( authorization: string, requestOptions?: RequestOptions ): Promise<ApiResponse<AC105Retrievebulkoffers>> { const req = this.createRequest('GET', '/open-banking-nz/v2.3/offers'); const mapped = req.prepareArgs({ authorization: [authorization, string()], }); req.header('Authorization', mapped.authorization); return req.callAsJson(aC105RetrievebulkoffersSchema, requestOptions); } /** * This request queries the accounts which the Customer has consented for you to access. * * Preconditions: * * * This step relies on the presence of a PNZ-T-AC-AuthAccessToken, which is set upon successful * completion of Step HF-AC8 - Exchange authorization-code for access token or Step DF-AC5 - Exchange * auth_req_id for access token. * * * Response: * * * The response should be a party resource for the party who authorised your access. * * * Postconditions: * * * None * * * Examples: * * * There is one example which shows the request and the expected response. * * * Troubleshooting: * * * The most likely cause of errors is an expired access token. Try starting from Step AC1 - * Initiate client credentials grant again. * * @param authorization * @return Response from the API call */ async retrieveAuthorisingParty( authorization: string, requestOptions?: RequestOptions ): Promise<ApiResponse<AC106Retrieveauthorisingparty>> { const req = this.createRequest('GET', '/open-banking-nz/v2.3/party'); const mapped = req.prepareArgs({ authorization: [authorization, string()], }); req.header('Authorization', mapped.authorization); return req.callAsJson(aC106RetrieveauthorisingpartySchema, requestOptions); } /** * This request queries the accounts which the Customer has consented for you to access. * * Preconditions: * * * This step relies on the presence of a PNZ-T-AC-AuthAccessToken, which is set upon successful * completion of Step HF-AC8 - Exchange authorization-code for access token or Step DF-AC5 - Exchange * auth_req_id for access token. * * * Response: * * * The response should be a collection of scheduled payment resources for all accounts which the * Customer consented for you to access. * * * Postconditions: * * * None * * * Examples: * * * There is one example which shows the request and the expected response. * * * Troubleshooting: * * * The most likely cause of errors is an expired access token. Try starting from Step AC1 - * Initiate client credentials grant again. * * @param authorization * @return Response from the API call */ async retrieveBulkScheduledPayments( authorization: string, requestOptions?: RequestOptions ): Promise<ApiResponse<AC107Retrievebulkscheduledpayments>> { const req = this.createRequest( 'GET', '/open-banking-nz/v2.3/scheduled-payments' ); const mapped = req.prepareArgs({ authorization: [authorization, string()], }); req.header('Authorization', mapped.authorization); return req.callAsJson( aC107RetrievebulkscheduledpaymentsSchema, requestOptions ); } /** * This request queries the accounts which the Customer has consented for you to access. * * Preconditions: * * * This step relies on the presence of a PNZ-T-AC-AuthAccessToken, which is set upon successful * completion of Step HF-AC8 - Exchange authorization-code for access token or Step DF-AC5 - Exchange * auth_req_id for access token. * * * Response: * * * The response should be a collection of standing order resources for all accounts which the * Customer consented for you to access. * * * Postconditions: * * * None * * * Examples: * * * There is one example which shows the request and the expected response. * * * Troubleshooting: * * * The most likely cause of errors is an expired access token. Try starting from Step AC1 - * Initiate client credentials grant again. * * @param authorization * @return Response from the API call */ async retrieveBulkStandingOrders( authorization: string, requestOptions?: RequestOptions ): Promise<ApiResponse<AC108Retrievebulkstandingorders>> { const req = this.createRequest( 'GET', '/open-banking-nz/v2.3/standing-orders' ); const mapped = req.prepareArgs({ authorization: [authorization, string()], }); req.header('Authorization', mapped.authorization); return req.callAsJson( aC108RetrievebulkstandingordersSchema, requestOptions ); } /** * This request queries the accounts which the Customer has consented for you to access. * * Preconditions: * * * This step relies on the presence of a PNZ-T-AC-AuthAccessToken, which is set upon successful * completion of Step HF-AC8 - Exchange authorization-code for access token or Step DF-AC5 - Exchange * auth_req_id for access token. * * * Response: * * * The response should be a collection of statement resources for all accounts which the Customer * consented for you to access. * * * Postconditions: * * * None * * * Examples: * * * There is one example which shows the request and the expected response. * * * Troubleshooting: * * * The most likely cause of errors is an expired access token. Try starting from Step AC1 - * Initiate client credentials grant again. * * @param authorization * @return Response from the API call */ async retrieveBulkStatements( authorization: string, requestOptions?: RequestOptions ): Promise<ApiResponse<AC109Retrievebulkstatements>> { const req = this.createRequest('GET', '/open-banking-nz/v2.3/statements'); const mapped = req.prepareArgs({ authorization: [authorization, string()], }); req.header('Authorization', mapped.authorization); return req.callAsJson(aC109RetrievebulkstatementsSchema, requestOptions); } /** * This request queries the accounts which the Customer has consented for you to access. * * Preconditions: * * * This step relies on the presence of a PNZ-T-AC-AuthAccessToken, which is set upon successful * completion of Step HF-AC8 - Exchange authorization-code for access token or Step DF-AC5 - Exchange * auth_req_id for access token. * * * Response: * * * The response should be a collection of transaction resources for all accounts which the Customer * consented for you to access. * * * Postconditions: * * * None * * * Examples: * * * There is one example which shows the request and the expected response. * * * Troubleshooting: * * * The most likely cause of errors is an expired access token. Try starting from Step AC1 - * Initiate client credentials grant again. * * @param authorization * @return Response from the API call */ async retrieveBulkTransactions( authorization: string, requestOptions?: RequestOptions ): Promise<ApiResponse<AC1010Retrievebulktransactions>> { const req = this.createRequest('GET', '/open-banking-nz/v2.3/transactions'); const mapped = req.prepareArgs({ authorization: [authorization, string()], }); req.header('Authorization', mapped.authorization); return req.callAsJson(aC1010RetrievebulktransactionsSchema, requestOptions); } }