UNPKG

pnz-payments-sdk

Version:

PNZ Payments Account and Transaction API

331 lines 26.7 kB
"use strict"; /** * Account and Transaction API SpecificationLib * * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). */ exports.__esModule = true; exports.StatementsController = void 0; var tslib_1 = require("tslib"); var getAccountStatementResponse_1 = require("../models/getAccountStatementResponse"); var getAccountStatementsResponse_1 = require("../models/getAccountStatementsResponse"); var getAccountStatementTransactionsResponse_1 = require("../models/getAccountStatementTransactionsResponse"); var getStatementsResponse_1 = require("../models/getStatementsResponse"); var schema_1 = require("../schema"); var baseController_1 = require("./baseController"); var core_1 = require("@apimatic/core"); var accountsStatements400Error_1 = require("../errors/accountsStatements400Error"); var accountsStatements403Error_1 = require("../errors/accountsStatements403Error"); var accountsStatements500Error_1 = require("../errors/accountsStatements500Error"); var accountsStatements503Error_1 = require("../errors/accountsStatements503Error"); var accountsStatementsTransactions400Error_1 = require("../errors/accountsStatementsTransactions400Error"); var accountsStatementsTransactions403Error_1 = require("../errors/accountsStatementsTransactions403Error"); var accountsStatementsTransactions500Error_1 = require("../errors/accountsStatementsTransactions500Error"); var accountsStatementsTransactions503Error_1 = require("../errors/accountsStatementsTransactions503Error"); var statements400Error_1 = require("../errors/statements400Error"); var statements403Error_1 = require("../errors/statements403Error"); var statements500Error_1 = require("../errors/statements500Error"); var statements503Error_1 = require("../errors/statements503Error"); var StatementsController = /** @class */ (function (_super) { tslib_1.__extends(StatementsController, _super); function StatementsController() { return _super !== null && _super.apply(this, arguments) || this; } /** * Get Statement related to an account * * @param accountId A unique identifier used to identify the account resource. * @param statementId A unique identifier used to identify the statement resource. * @param fromStatementDateTime The UTC ISO 8601 Date Time to filter statements FROM NB Time * component is optional - set to 00:00:00 for just Date. If the Date * Time contains a timezone, the API Provider must ignore the timezone * component. * @param toStatementDateTime The UTC ISO 8601 Date Time to filter statements TO NB Time component * is optional - set to 00:00:00 for just Date. If the Date Time contains * a timezone, the API Provider must ignore the timezone component. * @param xFapiAuthDate The time when the Customer last logged in with the Third Party. All * dates in the HTTP headers are represented as RFC 7231 Full Dates. An * example is below: Sun, 10 Sep 2017 19:43:31 UTC * @param xFapiCustomerIpAddress The Customer's IP address if the Customer is currently logged in with * the Third Party. * @param xFapiInteractionId An RFC4122 UID used as a correlation id. * @param xMerchantIpAddress The IP address of the merchant when making account information * requests through a Third Party. * @param xCustomerUserAgent The User-Agent of the application on the customer device that is used * to make the account information request * @return Response from the API call */ StatementsController.prototype.getAccountStatement = function (accountId, statementId, fromStatementDateTime, toStatementDateTime, xFapiAuthDate, xFapiCustomerIpAddress, xFapiInteractionId, xMerchantIpAddress, xCustomerUserAgent, requestOptions) { return tslib_1.__awaiter(this, void 0, void 0, function () { var req, mapped; return tslib_1.__generator(this, function (_a) { req = this.createRequest('GET'); mapped = req.prepareArgs({ accountId: [accountId, (0, schema_1.string)()], statementId: [statementId, (0, schema_1.string)()], fromStatementDateTime: [fromStatementDateTime, (0, schema_1.optional)((0, schema_1.string)())], toStatementDateTime: [toStatementDateTime, (0, schema_1.optional)((0, schema_1.string)())], xFapiAuthDate: [xFapiAuthDate, (0, schema_1.optional)((0, schema_1.string)())], xFapiCustomerIpAddress: [xFapiCustomerIpAddress, (0, schema_1.optional)((0, schema_1.string)())], xFapiInteractionId: [xFapiInteractionId, (0, schema_1.optional)((0, schema_1.string)())], xMerchantIpAddress: [xMerchantIpAddress, (0, schema_1.optional)((0, schema_1.string)())], xCustomerUserAgent: [xCustomerUserAgent, (0, schema_1.optional)((0, schema_1.string)())] }); req.header('x-fapi-auth-date', mapped.xFapiAuthDate); req.header('x-fapi-customer-ip-address', mapped.xFapiCustomerIpAddress); req.header('x-fapi-interaction-id', mapped.xFapiInteractionId); req.header('x-merchant-ip-address', mapped.xMerchantIpAddress); req.header('x-customer-user-agent', mapped.xCustomerUserAgent); req.query('fromStatementDateTime', mapped.fromStatementDateTime); req.query('toStatementDateTime', mapped.toStatementDateTime); req.appendTemplatePath(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["/accounts/", "/statements/", ""], ["/accounts/", "/statements/", ""])), mapped.accountId, mapped.statementId); req.throwOn(400, accountsStatements400Error_1.AccountsStatements400Error, 'Bad Request'); req.throwOn(401, core_1.ApiError, 'Unauthorized'); req.throwOn(403, accountsStatements403Error_1.AccountsStatements403Error, 'Forbidden'); req.throwOn(405, core_1.ApiError, 'Method Not Allowed'); req.throwOn(406, core_1.ApiError, 'Not Acceptable'); req.throwOn(429, core_1.ApiError, 'Too Many Requests'); req.throwOn(500, accountsStatements500Error_1.AccountsStatements500Error, 'Internal Server Error'); req.throwOn(501, core_1.ApiError, 'Not Implemented'); req.throwOn(503, accountsStatements503Error_1.AccountsStatements503Error, 'Service Unavailable'); req.authenticate([{ hTTPBearerAuthentication: true }]); return [2 /*return*/, req.callAsJson(getAccountStatementResponse_1.getAccountStatementResponseSchema, requestOptions)]; }); }); }; /** * Get Statement related to an account * * @param accountId A unique identifier used to identify the account resource. * @param statementId A unique identifier used to identify the statement resource. * @param xFapiAuthDate The time when the Customer last logged in with the Third Party. All * dates in the HTTP headers are represented as RFC 7231 Full Dates. An * example is below: Sun, 10 Sep 2017 19:43:31 UTC * @param xFapiCustomerIpAddress The Customer's IP address if the Customer is currently logged in with * the Third Party. * @param xFapiInteractionId An RFC4122 UID used as a correlation id. * @param xMerchantIpAddress The IP address of the merchant when making account information * requests through a Third Party. * @param xCustomerUserAgent The User-Agent of the application on the customer device that is used * to make the account information request * @return Response from the API call */ StatementsController.prototype.getAccountStatementFile = function (accountId, statementId, xFapiAuthDate, xFapiCustomerIpAddress, xFapiInteractionId, xMerchantIpAddress, xCustomerUserAgent, requestOptions) { return tslib_1.__awaiter(this, void 0, void 0, function () { var req, mapped; return tslib_1.__generator(this, function (_a) { req = this.createRequest('GET'); mapped = req.prepareArgs({ accountId: [accountId, (0, schema_1.string)()], statementId: [statementId, (0, schema_1.string)()], xFapiAuthDate: [xFapiAuthDate, (0, schema_1.optional)((0, schema_1.string)())], xFapiCustomerIpAddress: [xFapiCustomerIpAddress, (0, schema_1.optional)((0, schema_1.string)())], xFapiInteractionId: [xFapiInteractionId, (0, schema_1.optional)((0, schema_1.string)())], xMerchantIpAddress: [xMerchantIpAddress, (0, schema_1.optional)((0, schema_1.string)())], xCustomerUserAgent: [xCustomerUserAgent, (0, schema_1.optional)((0, schema_1.string)())] }); req.header('x-fapi-auth-date', mapped.xFapiAuthDate); req.header('x-fapi-customer-ip-address', mapped.xFapiCustomerIpAddress); req.header('x-fapi-interaction-id', mapped.xFapiInteractionId); req.header('x-merchant-ip-address', mapped.xMerchantIpAddress); req.header('x-customer-user-agent', mapped.xCustomerUserAgent); req.appendTemplatePath(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["/accounts/", "/statements/", "/file"], ["/accounts/", "/statements/", "/file"])), mapped.accountId, mapped.statementId); req.throwOn(400, core_1.ApiError, 'Bad Request'); req.throwOn(401, core_1.ApiError, 'Unauthorized'); req.throwOn(403, core_1.ApiError, 'Forbidden'); req.throwOn(405, core_1.ApiError, 'Method Not Allowed'); req.throwOn(406, core_1.ApiError, 'Not Acceptable'); req.throwOn(429, core_1.ApiError, 'Too Many Requests'); req.throwOn(500, core_1.ApiError, 'Internal Server Error'); req.throwOn(501, core_1.ApiError, 'Not Implemented'); req.throwOn(503, core_1.ApiError, 'Service Unavailable'); req.authenticate([{ hTTPBearerAuthentication: true }]); return [2 /*return*/, req.callAsJson((0, schema_1.optional)((0, schema_1.unknown)()), requestOptions)]; }); }); }; /** * Get Statement Transactions related to an account * * @param accountId A unique identifier used to identify the account resource. * @param statementId A unique identifier used to identify the statement resource. * @param fromBookingDateTime The UTC ISO 8601 Date Time to filter transactions FROM NB Time * component is optional - set to 00:00:00 for just Date. If the Date * Time contains a timezone, the API Provider must ignore the timezone * component. * @param toBookingDateTime The UTC ISO 8601 Date Time to filter transactions TO NB Time * component is optional - set to 00:00:00 for just Date. If the Date * Time contains a timezone, the API Provider must ignore the timezone * component. * @param xFapiAuthDate The time when the Customer last logged in with the Third Party. All * dates in the HTTP headers are represented as RFC 7231 Full Dates. An * example is below: Sun, 10 Sep 2017 19:43:31 UTC * @param xFapiCustomerIpAddress The Customer's IP address if the Customer is currently logged in with * the Third Party. * @param xFapiInteractionId An RFC4122 UID used as a correlation id. * @param xMerchantIpAddress The IP address of the merchant when making account information * requests through a Third Party. * @param xCustomerUserAgent The User-Agent of the application on the customer device that is used * to make the account information request * @return Response from the API call */ StatementsController.prototype.getAccountStatementTransactions = function (accountId, statementId, fromBookingDateTime, toBookingDateTime, xFapiAuthDate, xFapiCustomerIpAddress, xFapiInteractionId, xMerchantIpAddress, xCustomerUserAgent, requestOptions) { return tslib_1.__awaiter(this, void 0, void 0, function () { var req, mapped; return tslib_1.__generator(this, function (_a) { req = this.createRequest('GET'); mapped = req.prepareArgs({ accountId: [accountId, (0, schema_1.string)()], statementId: [statementId, (0, schema_1.string)()], fromBookingDateTime: [fromBookingDateTime, (0, schema_1.optional)((0, schema_1.string)())], toBookingDateTime: [toBookingDateTime, (0, schema_1.optional)((0, schema_1.string)())], xFapiAuthDate: [xFapiAuthDate, (0, schema_1.optional)((0, schema_1.string)())], xFapiCustomerIpAddress: [xFapiCustomerIpAddress, (0, schema_1.optional)((0, schema_1.string)())], xFapiInteractionId: [xFapiInteractionId, (0, schema_1.optional)((0, schema_1.string)())], xMerchantIpAddress: [xMerchantIpAddress, (0, schema_1.optional)((0, schema_1.string)())], xCustomerUserAgent: [xCustomerUserAgent, (0, schema_1.optional)((0, schema_1.string)())] }); req.header('x-fapi-auth-date', mapped.xFapiAuthDate); req.header('x-fapi-customer-ip-address', mapped.xFapiCustomerIpAddress); req.header('x-fapi-interaction-id', mapped.xFapiInteractionId); req.header('x-merchant-ip-address', mapped.xMerchantIpAddress); req.header('x-customer-user-agent', mapped.xCustomerUserAgent); req.query('fromBookingDateTime', mapped.fromBookingDateTime); req.query('toBookingDateTime', mapped.toBookingDateTime); req.appendTemplatePath(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["/accounts/", "/statements/", "/transactions"], ["/accounts/", "/statements/", "/transactions"])), mapped.accountId, mapped.statementId); req.throwOn(400, accountsStatementsTransactions400Error_1.AccountsStatementsTransactions400Error, 'Bad Request'); req.throwOn(401, core_1.ApiError, 'Unauthorized'); req.throwOn(403, accountsStatementsTransactions403Error_1.AccountsStatementsTransactions403Error, 'Forbidden'); req.throwOn(405, core_1.ApiError, 'Method Not Allowed'); req.throwOn(406, core_1.ApiError, 'Not Acceptable'); req.throwOn(429, core_1.ApiError, 'Too Many Requests'); req.throwOn(500, accountsStatementsTransactions500Error_1.AccountsStatementsTransactions500Error, 'Internal Server Error'); req.throwOn(501, core_1.ApiError, 'Not Implemented'); req.throwOn(503, accountsStatementsTransactions503Error_1.AccountsStatementsTransactions503Error, 'Service Unavailable'); req.authenticate([{ hTTPBearerAuthentication: true }]); return [2 /*return*/, req.callAsJson(getAccountStatementTransactionsResponse_1.getAccountStatementTransactionsResponseSchema, requestOptions)]; }); }); }; /** * Get Statements related to an account * * @param accountId A unique identifier used to identify the account resource. * @param fromStatementDateTime The UTC ISO 8601 Date Time to filter statements FROM NB Time * component is optional - set to 00:00:00 for just Date. If the Date * Time contains a timezone, the API Provider must ignore the timezone * component. * @param toStatementDateTime The UTC ISO 8601 Date Time to filter statements TO NB Time component * is optional - set to 00:00:00 for just Date. If the Date Time contains * a timezone, the API Provider must ignore the timezone component. * @param xFapiAuthDate The time when the Customer last logged in with the Third Party. All * dates in the HTTP headers are represented as RFC 7231 Full Dates. An * example is below: Sun, 10 Sep 2017 19:43:31 UTC * @param xFapiCustomerIpAddress The Customer's IP address if the Customer is currently logged in with * the Third Party. * @param xFapiInteractionId An RFC4122 UID used as a correlation id. * @param xMerchantIpAddress The IP address of the merchant when making account information * requests through a Third Party. * @param xCustomerUserAgent The User-Agent of the application on the customer device that is used * to make the account information request * @return Response from the API call */ StatementsController.prototype.getAccountStatements = function (accountId, fromStatementDateTime, toStatementDateTime, xFapiAuthDate, xFapiCustomerIpAddress, xFapiInteractionId, xMerchantIpAddress, xCustomerUserAgent, requestOptions) { return tslib_1.__awaiter(this, void 0, void 0, function () { var req, mapped; return tslib_1.__generator(this, function (_a) { req = this.createRequest('GET'); mapped = req.prepareArgs({ accountId: [accountId, (0, schema_1.string)()], fromStatementDateTime: [fromStatementDateTime, (0, schema_1.optional)((0, schema_1.string)())], toStatementDateTime: [toStatementDateTime, (0, schema_1.optional)((0, schema_1.string)())], xFapiAuthDate: [xFapiAuthDate, (0, schema_1.optional)((0, schema_1.string)())], xFapiCustomerIpAddress: [xFapiCustomerIpAddress, (0, schema_1.optional)((0, schema_1.string)())], xFapiInteractionId: [xFapiInteractionId, (0, schema_1.optional)((0, schema_1.string)())], xMerchantIpAddress: [xMerchantIpAddress, (0, schema_1.optional)((0, schema_1.string)())], xCustomerUserAgent: [xCustomerUserAgent, (0, schema_1.optional)((0, schema_1.string)())] }); req.header('x-fapi-auth-date', mapped.xFapiAuthDate); req.header('x-fapi-customer-ip-address', mapped.xFapiCustomerIpAddress); req.header('x-fapi-interaction-id', mapped.xFapiInteractionId); req.header('x-merchant-ip-address', mapped.xMerchantIpAddress); req.header('x-customer-user-agent', mapped.xCustomerUserAgent); req.query('fromStatementDateTime', mapped.fromStatementDateTime); req.query('toStatementDateTime', mapped.toStatementDateTime); req.appendTemplatePath(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["/accounts/", "/statements"], ["/accounts/", "/statements"])), mapped.accountId); req.throwOn(400, accountsStatements400Error_1.AccountsStatements400Error, 'Bad Request'); req.throwOn(401, core_1.ApiError, 'Unauthorized'); req.throwOn(403, accountsStatements403Error_1.AccountsStatements403Error, 'Forbidden'); req.throwOn(405, core_1.ApiError, 'Method Not Allowed'); req.throwOn(406, core_1.ApiError, 'Not Acceptable'); req.throwOn(429, core_1.ApiError, 'Too Many Requests'); req.throwOn(500, accountsStatements500Error_1.AccountsStatements500Error, 'Internal Server Error'); req.throwOn(501, core_1.ApiError, 'Not Implemented'); req.throwOn(503, accountsStatements503Error_1.AccountsStatements503Error, 'Service Unavailable'); req.authenticate([{ hTTPBearerAuthentication: true }]); return [2 /*return*/, req.callAsJson(getAccountStatementsResponse_1.getAccountStatementsResponseSchema, requestOptions)]; }); }); }; /** * Get Statements * * @param fromStatementDateTime The UTC ISO 8601 Date Time to filter statements FROM NB Time * component is optional - set to 00:00:00 for just Date. If the Date * Time contains a timezone, the API Provider must ignore the timezone * component. * @param toStatementDateTime The UTC ISO 8601 Date Time to filter statements TO NB Time component * is optional - set to 00:00:00 for just Date. If the Date Time contains * a timezone, the API Provider must ignore the timezone component. * @param xFapiAuthDate The time when the Customer last logged in with the Third Party. All * dates in the HTTP headers are represented as RFC 7231 Full Dates. An * example is below: Sun, 10 Sep 2017 19:43:31 UTC * @param xFapiCustomerIpAddress The Customer's IP address if the Customer is currently logged in with * the Third Party. * @param xFapiInteractionId An RFC4122 UID used as a correlation id. * @param xMerchantIpAddress The IP address of the merchant when making account information * requests through a Third Party. * @param xCustomerUserAgent The User-Agent of the application on the customer device that is used * to make the account information request * @return Response from the API call */ StatementsController.prototype.getStatements = function (fromStatementDateTime, toStatementDateTime, xFapiAuthDate, xFapiCustomerIpAddress, xFapiInteractionId, xMerchantIpAddress, xCustomerUserAgent, requestOptions) { return tslib_1.__awaiter(this, void 0, void 0, function () { var req, mapped; return tslib_1.__generator(this, function (_a) { req = this.createRequest('GET', '/statements'); mapped = req.prepareArgs({ fromStatementDateTime: [fromStatementDateTime, (0, schema_1.optional)((0, schema_1.string)())], toStatementDateTime: [toStatementDateTime, (0, schema_1.optional)((0, schema_1.string)())], xFapiAuthDate: [xFapiAuthDate, (0, schema_1.optional)((0, schema_1.string)())], xFapiCustomerIpAddress: [xFapiCustomerIpAddress, (0, schema_1.optional)((0, schema_1.string)())], xFapiInteractionId: [xFapiInteractionId, (0, schema_1.optional)((0, schema_1.string)())], xMerchantIpAddress: [xMerchantIpAddress, (0, schema_1.optional)((0, schema_1.string)())], xCustomerUserAgent: [xCustomerUserAgent, (0, schema_1.optional)((0, schema_1.string)())] }); req.header('x-fapi-auth-date', mapped.xFapiAuthDate); req.header('x-fapi-customer-ip-address', mapped.xFapiCustomerIpAddress); req.header('x-fapi-interaction-id', mapped.xFapiInteractionId); req.header('x-merchant-ip-address', mapped.xMerchantIpAddress); req.header('x-customer-user-agent', mapped.xCustomerUserAgent); req.query('fromStatementDateTime', mapped.fromStatementDateTime); req.query('toStatementDateTime', mapped.toStatementDateTime); req.throwOn(400, statements400Error_1.Statements400Error, 'Bad Request'); req.throwOn(401, core_1.ApiError, 'Unauthorized'); req.throwOn(403, statements403Error_1.Statements403Error, 'Forbidden'); req.throwOn(405, core_1.ApiError, 'Method Not Allowed'); req.throwOn(406, core_1.ApiError, 'Not Acceptable'); req.throwOn(429, core_1.ApiError, 'Too Many Requests'); req.throwOn(500, statements500Error_1.Statements500Error, 'Internal Server Error'); req.throwOn(501, core_1.ApiError, 'Not Implemented'); req.throwOn(503, statements503Error_1.Statements503Error, 'Service Unavailable'); req.authenticate([{ hTTPBearerAuthentication: true }]); return [2 /*return*/, req.callAsJson(getStatementsResponse_1.getStatementsResponseSchema, requestOptions)]; }); }); }; return StatementsController; }(baseController_1.BaseController)); exports.StatementsController = StatementsController; var templateObject_1, templateObject_2, templateObject_3, templateObject_4; //# sourceMappingURL=statementsController.js.map