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

4,000 lines 153 kB
'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }

var core = require('@apimatic/core');
var schema = require('@apimatic/schema');
var jwt = _interopDefault(require('jsonwebtoken'));
var uuid = require('uuid');
var request = _interopDefault(require('request'));

function _regeneratorRuntime() {
  _regeneratorRuntime = function () {
    return exports;
  };
  var exports = {},
    Op = Object.prototype,
    hasOwn = Op.hasOwnProperty,
    defineProperty = Object.defineProperty || function (obj, key, desc) {
      obj[key] = desc.value;
    },
    $Symbol = "function" == typeof Symbol ? Symbol : {},
    iteratorSymbol = $Symbol.iterator || "@@iterator",
    asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
    toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
  function define(obj, key, value) {
    return Object.defineProperty(obj, key, {
      value: value,
      enumerable: !0,
      configurable: !0,
      writable: !0
    }), obj[key];
  }
  try {
    define({}, "");
  } catch (err) {
    define = function (obj, key, value) {
      return obj[key] = value;
    };
  }
  function wrap(innerFn, outerFn, self, tryLocsList) {
    var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
      generator = Object.create(protoGenerator.prototype),
      context = new Context(tryLocsList || []);
    return defineProperty(generator, "_invoke", {
      value: makeInvokeMethod(innerFn, self, context)
    }), generator;
  }
  function tryCatch(fn, obj, arg) {
    try {
      return {
        type: "normal",
        arg: fn.call(obj, arg)
      };
    } catch (err) {
      return {
        type: "throw",
        arg: err
      };
    }
  }
  exports.wrap = wrap;
  var ContinueSentinel = {};
  function Generator() {}
  function GeneratorFunction() {}
  function GeneratorFunctionPrototype() {}
  var IteratorPrototype = {};
  define(IteratorPrototype, iteratorSymbol, function () {
    return this;
  });
  var getProto = Object.getPrototypeOf,
    NativeIteratorPrototype = getProto && getProto(getProto(values([])));
  NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
  var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
  function defineIteratorMethods(prototype) {
    ["next", "throw", "return"].forEach(function (method) {
      define(prototype, method, function (arg) {
        return this._invoke(method, arg);
      });
    });
  }
  function AsyncIterator(generator, PromiseImpl) {
    function invoke(method, arg, resolve, reject) {
      var record = tryCatch(generator[method], generator, arg);
      if ("throw" !== record.type) {
        var result = record.arg,
          value = result.value;
        return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
          invoke("next", value, resolve, reject);
        }, function (err) {
          invoke("throw", err, resolve, reject);
        }) : PromiseImpl.resolve(value).then(function (unwrapped) {
          result.value = unwrapped, resolve(result);
        }, function (error) {
          return invoke("throw", error, resolve, reject);
        });
      }
      reject(record.arg);
    }
    var previousPromise;
    defineProperty(this, "_invoke", {
      value: function (method, arg) {
        function callInvokeWithMethodAndArg() {
          return new PromiseImpl(function (resolve, reject) {
            invoke(method, arg, resolve, reject);
          });
        }
        return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
      }
    });
  }
  function makeInvokeMethod(innerFn, self, context) {
    var state = "suspendedStart";
    return function (method, arg) {
      if ("executing" === state) throw new Error("Generator is already running");
      if ("completed" === state) {
        if ("throw" === method) throw arg;
        return doneResult();
      }
      for (context.method = method, context.arg = arg;;) {
        var delegate = context.delegate;
        if (delegate) {
          var delegateResult = maybeInvokeDelegate(delegate, context);
          if (delegateResult) {
            if (delegateResult === ContinueSentinel) continue;
            return delegateResult;
          }
        }
        if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
          if ("suspendedStart" === state) throw state = "completed", context.arg;
          context.dispatchException(context.arg);
        } else "return" === context.method && context.abrupt("return", context.arg);
        state = "executing";
        var record = tryCatch(innerFn, self, context);
        if ("normal" === record.type) {
          if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
          return {
            value: record.arg,
            done: context.done
          };
        }
        "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
      }
    };
  }
  function maybeInvokeDelegate(delegate, context) {
    var methodName = context.method,
      method = delegate.iterator[methodName];
    if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
    var record = tryCatch(method, delegate.iterator, context.arg);
    if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
    var info = record.arg;
    return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
  }
  function pushTryEntry(locs) {
    var entry = {
      tryLoc: locs[0]
    };
    1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
  }
  function resetTryEntry(entry) {
    var record = entry.completion || {};
    record.type = "normal", delete record.arg, entry.completion = record;
  }
  function Context(tryLocsList) {
    this.tryEntries = [{
      tryLoc: "root"
    }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
  }
  function values(iterable) {
    if (iterable) {
      var iteratorMethod = iterable[iteratorSymbol];
      if (iteratorMethod) return iteratorMethod.call(iterable);
      if ("function" == typeof iterable.next) return iterable;
      if (!isNaN(iterable.length)) {
        var i = -1,
          next = function next() {
            for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
            return next.value = undefined, next.done = !0, next;
          };
        return next.next = next;
      }
    }
    return {
      next: doneResult
    };
  }
  function doneResult() {
    return {
      value: undefined,
      done: !0
    };
  }
  return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
    value: GeneratorFunctionPrototype,
    configurable: !0
  }), defineProperty(GeneratorFunctionPrototype, "constructor", {
    value: GeneratorFunction,
    configurable: !0
  }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
    var ctor = "function" == typeof genFun && genFun.constructor;
    return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
  }, exports.mark = function (genFun) {
    return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
  }, exports.awrap = function (arg) {
    return {
      __await: arg
    };
  }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
    return this;
  }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
    void 0 === PromiseImpl && (PromiseImpl = Promise);
    var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
    return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
      return result.done ? result.value : iter.next();
    });
  }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
    return this;
  }), define(Gp, "toString", function () {
    return "[object Generator]";
  }), exports.keys = function (val) {
    var object = Object(val),
      keys = [];
    for (var key in object) keys.push(key);
    return keys.reverse(), function next() {
      for (; keys.length;) {
        var key = keys.pop();
        if (key in object) return next.value = key, next.done = !1, next;
      }
      return next.done = !0, next;
    };
  }, exports.values = values, Context.prototype = {
    constructor: Context,
    reset: function (skipTempReset) {
      if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
    },
    stop: function () {
      this.done = !0;
      var rootRecord = this.tryEntries[0].completion;
      if ("throw" === rootRecord.type) throw rootRecord.arg;
      return this.rval;
    },
    dispatchException: function (exception) {
      if (this.done) throw exception;
      var context = this;
      function handle(loc, caught) {
        return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
      }
      for (var i = this.tryEntries.length - 1; i >= 0; --i) {
        var entry = this.tryEntries[i],
          record = entry.completion;
        if ("root" === entry.tryLoc) return handle("end");
        if (entry.tryLoc <= this.prev) {
          var hasCatch = hasOwn.call(entry, "catchLoc"),
            hasFinally = hasOwn.call(entry, "finallyLoc");
          if (hasCatch && hasFinally) {
            if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
            if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
          } else if (hasCatch) {
            if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
          } else {
            if (!hasFinally) throw new Error("try statement without catch or finally");
            if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
          }
        }
      }
    },
    abrupt: function (type, arg) {
      for (var i = this.tryEntries.length - 1; i >= 0; --i) {
        var entry = this.tryEntries[i];
        if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
          var finallyEntry = entry;
          break;
        }
      }
      finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
      var record = finallyEntry ? finallyEntry.completion : {};
      return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
    },
    complete: function (record, afterLoc) {
      if ("throw" === record.type) throw record.arg;
      return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
    },
    finish: function (finallyLoc) {
      for (var i = this.tryEntries.length - 1; i >= 0; --i) {
        var entry = this.tryEntries[i];
        if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
      }
    },
    catch: function (tryLoc) {
      for (var i = this.tryEntries.length - 1; i >= 0; --i) {
        var entry = this.tryEntries[i];
        if (entry.tryLoc === tryLoc) {
          var record = entry.completion;
          if ("throw" === record.type) {
            var thrown = record.arg;
            resetTryEntry(entry);
          }
          return thrown;
        }
      }
      throw new Error("illegal catch attempt");
    },
    delegateYield: function (iterable, resultName, nextLoc) {
      return this.delegate = {
        iterator: values(iterable),
        resultName: resultName,
        nextLoc: nextLoc
      }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
    }
  }, exports;
}
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
  try {
    var info = gen[key](arg);
    var value = info.value;
  } catch (error) {
    reject(error);
    return;
  }
  if (info.done) {
    resolve(value);
  } else {
    Promise.resolve(value).then(_next, _throw);
  }
}
function _asyncToGenerator(fn) {
  return function () {
    var self = this,
      args = arguments;
    return new Promise(function (resolve, reject) {
      var gen = fn.apply(self, args);
      function _next(value) {
        asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
      }
      function _throw(err) {
        asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
      }
      _next(undefined);
    });
  };
}
function _extends() {
  _extends = Object.assign ? Object.assign.bind() : function (target) {
    for (var i = 1; i < arguments.length; i++) {
      var source = arguments[i];
      for (var key in source) {
        if (Object.prototype.hasOwnProperty.call(source, key)) {
          target[key] = source[key];
        }
      }
    }
    return target;
  };
  return _extends.apply(this, arguments);
}
function _inheritsLoose(subClass, superClass) {
  subClass.prototype = Object.create(superClass.prototype);
  subClass.prototype.constructor = subClass;
  _setPrototypeOf(subClass, superClass);
}
function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };
  return _setPrototypeOf(o, p);
}
function _taggedTemplateLiteralLoose(strings, raw) {
  if (!raw) {
    raw = strings.slice(0);
  }
  strings.raw = raw;
  return strings;
}

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
/** None authentication provider */
var noneAuthenticationProvider = function noneAuthenticationProvider() {
  return core.passThroughInterceptor;
};

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
(function (Environment) {
  Environment["Production"] = "production";
})(exports.Environment || (exports.Environment = {}));

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
/** Default values for the configuration parameters of the client. */
var DEFAULT_CONFIGURATION = {
  timeout: 0,
  environment: exports.Environment.Production
};
/** Default values for retry configuration parameters. */
var DEFAULT_RETRY_CONFIG = {
  maxNumberOfRetries: 0,
  retryOnTimeout: true,
  retryInterval: 1,
  maximumRetryWaitTime: 0,
  backoffFactor: 2,
  httpStatusCodesToRetry: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
  httpMethodsToRetry: ['GET', 'PUT']
};

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var XmlSerialization = /*#__PURE__*/function () {
  function XmlSerialization() {}
  var _proto = XmlSerialization.prototype;
  _proto.xmlSerialize = function xmlSerialize(_rootName, _value) {
    throw new Error('XML serialization is not available.');
  };
  _proto.xmlDeserialize = function xmlDeserialize(_rootName, _xmlString) {
    throw new Error('XML deserialization is not available.');
  };
  return XmlSerialization;
}();

var USER_AGENT = 'APIMATIC 3.0';
var Client = /*#__PURE__*/function () {
  function Client(config) {
    var _this$_config$httpCli,
      _this$_config$httpCli2,
      _this = this,
      _this$_config$httpCli3,
      _this$_config$httpCli4;
    this._config = _extends({}, DEFAULT_CONFIGURATION, config);
    this._retryConfig = _extends({}, DEFAULT_RETRY_CONFIG, (_this$_config$httpCli = this._config.httpClientOptions) == null ? void 0 : _this$_config$httpCli.retryConfig);
    this._timeout = typeof ((_this$_config$httpCli2 = this._config.httpClientOptions) == null ? void 0 : _this$_config$httpCli2.timeout) != 'undefined' ? this._config.httpClientOptions.timeout : this._config.timeout;
    this._requestBuilderFactory = createRequestHandlerFactory(function (server) {
      return getBaseUri(server, _this._config);
    }, noneAuthenticationProvider, new core.HttpClient({
      timeout: this._timeout,
      clientConfigOverrides: this._config.unstable_httpClientOptions,
      httpAgent: (_this$_config$httpCli3 = this._config.httpClientOptions) == null ? void 0 : _this$_config$httpCli3.httpAgent,
      httpsAgent: (_this$_config$httpCli4 = this._config.httpClientOptions) == null ? void 0 : _this$_config$httpCli4.httpsAgent
    }), [withErrorHandlers, withUserAgent], new XmlSerialization(), this._retryConfig);
  }
  var _proto = Client.prototype;
  _proto.getRequestBuilderFactory = function getRequestBuilderFactory() {
    return this._requestBuilderFactory;
  }
  /**
   * Clone this client and override given configuration options
   */;
  _proto.withConfiguration = function withConfiguration(config) {
    return new Client(_extends({}, this._config, config));
  };
  return Client;
}();
function createHttpClientAdapter(client) {
  return /*#__PURE__*/function () {
    var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request, requestOptions) {
      return _regeneratorRuntime().wrap(function _callee$(_context) {
        while (1) switch (_context.prev = _context.next) {
          case 0:
            _context.next = 2;
            return client.executeRequest(request, requestOptions);
          case 2:
            return _context.abrupt("return", _context.sent);
          case 3:
          case "end":
            return _context.stop();
        }
      }, _callee);
    }));
    return function (_x, _x2) {
      return _ref.apply(this, arguments);
    };
  }();
}
function getBaseUri(server, config) {
  if (server === void 0) {
    server = 'server 1';
  }
  if (config.environment === exports.Environment.Production) {
    if (server === 'server 1') {
      return 'https://api-nomatls.apicentre.middleware.co.nz';
    }
    if (server === 'server 2') {
      return 'https://obabank.glueware.dev';
    }
  }
  throw new Error('Could not get Base URL. Invalid environment or server.');
}
function createRequestHandlerFactory(baseUrlProvider, authProvider, httpClient, addons, xmlSerializer, retryConfig) {
  var requestBuilderFactory = core.createRequestBuilderFactory(createHttpClientAdapter(httpClient), baseUrlProvider, core.ApiError, authProvider, xmlSerializer, retryConfig);
  return tap.apply(void 0, [requestBuilderFactory].concat(addons));
}
function tap(requestBuilderFactory) {
  for (var _len = arguments.length, callback = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
    callback[_key - 1] = arguments[_key];
  }
  return function () {
    var requestBuilder = requestBuilderFactory.apply(void 0, arguments);
    callback.forEach(function (c) {
      return c(requestBuilder);
    });
    return requestBuilder;
  };
}
function withErrorHandlers(rb) {
  rb.defaultToError(core.ApiError);
}
function withUserAgent(rb) {
  rb.header('user-agent', USER_AGENT);
}

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
(function (ContentType2Enum) {
  ContentType2Enum["EnumApplicationjson"] = "application/json";
})(exports.ContentType2Enum || (exports.ContentType2Enum = {}));
/**
 * Schema for ContentType2Enum
 */
var contentType2EnumSchema = /*#__PURE__*/schema.stringEnum(exports.ContentType2Enum);

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
(function (ContentTypeEnum) {
  ContentTypeEnum["EnumApplicationxwwwformurlencoded"] = "application/x-www-form-urlencoded";
})(exports.ContentTypeEnum || (exports.ContentTypeEnum = {}));
/**
 * Schema for ContentTypeEnum
 */
var contentTypeEnumSchema = /*#__PURE__*/schema.stringEnum(exports.ContentTypeEnum);

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var hFAC8ExchangeauthorizationcodeforaccesstokenSchema = /*#__PURE__*/schema.object({
  tokenType: ['token_type', /*#__PURE__*/schema.string()],
  expiresIn: ['expires_in', /*#__PURE__*/schema.number()],
  refreshToken: ['refresh_token', /*#__PURE__*/schema.string()],
  accessToken: ['access_token', /*#__PURE__*/schema.string()]
});

function ClientAssertionJWT(privateKey, kid, payloadData) {
  var header = {
    alg: 'PS512',
    kid: kid,
    typ: 'JWT'
  };
  var payload = payloadData;
  var signOptions = {
    algorithm: 'PS512',
    keyid: header.kid
  };
  var token = jwt.sign(payload, privateKey, signOptions);
  return token;
}

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
/** Base class for all controllers */
var BaseController = function BaseController(client) {
  this.createRequest = client.getRequestBuilderFactory();
};

var AuthorizeConsentController = /*#__PURE__*/function (_BaseController) {
  _inheritsLoose(AuthorizeConsentController, _BaseController);
  function AuthorizeConsentController() {
    return _BaseController.apply(this, arguments) || this;
  }
  var _proto = AuthorizeConsentController.prototype;
  /**
   * Initiate Authorization Code Grant for an Account Access Consent
   *
   * @param clientID
   * @param redirectUri
   * @param privateKey
   * @param KID
   * @param consentID
   * @return Response from the API call
   */
  _proto.initiateAuthorizationCodeGrant = function initiateAuthorizationCodeGrant(clientID, redirectUri, privateKey, KID, consentID) {
    var scope = 'openid accounts';
    var responseType = 'code id_token';
    var state = uuid.v4();
    var nonce = uuid.v4();
    var payload = {
      iss: clientID,
      client_id: clientID,
      response_type: 'code id_token',
      scope: 'openid accounts',
      redirect_uri: redirectUri,
      aud: 'https://api-nomatls.apicentre.middleware.co.nz/oauth/v2.0',
      state: state,
      nonce: nonce,
      iat: Math.floor(Date.now() / 1000) - 120,
      exp: Math.floor(Date.now() / 1000) + 3599,
      claims: {
        id_token: {
          ConsentId: {
            value: consentID,
            essential: true
          },
          acr: {
            value: 'urn:openbanking:nz:ca',
            essential: true
          }
        }
      }
    };
    var clientAssertion = ClientAssertionJWT(privateKey, KID, payload);
    var options = {
      method: 'GET',
      url: "https://api-nomatls.apicentre.middleware.co.nz/oauth/v2.0/authorize?scope=" + scope + "&response_type=" + responseType + "&client_id=" + clientID + "&redirect_uri=" + redirectUri + "&state=" + state + "&nonce=" + nonce + "&request=" + clientAssertion,
      followRedirect: false
    };
    return new Promise(function (resolve, reject) {
      request(options, function (error, response) {
        if (error) {
          reject(error);
          return error;
        }
        resolve(response.headers.location);
      });
    });
  }
  /**
   * This request is following the redirect which was returned in the previous step. The redirect is to
   * the Bank's login page. In the browser, this redirect happens automatically, and your application
   * won't need to worry about this. However, we must explicitly follow the redirect because we need to
   * mimic the user logging in and consenting.
   *
   * Preconditions:
   *
   * *   This step relies on the presence of a PNZ-T-AC-LoginAppLocation environment variable, which is
   * set upon successful completion of Step HF-AC3 - Initiate authorization code grant for an account
   * access consent.
   *
   *
   * Response:
   *
   * *   The response should be a Middleware Bank login screen.
   * *   This response also returns the OB_AUTHSESSION cookie that is used throughout the login and
   * consent flows in Steps HF-AC5 through HF-AC7.
   *
   *
   * Postconditions:
   *
   * *   The returned request JWT and redirect location are put in the PNZ-T-AC-ObaRequest and PNZ-T-AC-
   * LoginApp environment variables, respectively, in preparation for Step HF-AC5 - Authenticate customer
   * to Middleware Bank.
   *
   *
   * Examples:
   *
   * *   There is one example which shows the request and the expected response.
   *
   *
   * Troubleshooting:
   *
   * *   The most likely cause of errors is that the step is being attempted out of sequence. Be sure to
   * follow the steps in sequence.
   * *   Another likely cause of errors are out of date variable values. Try starting from Step AC1 -
   * Initiate client credentials grant again.
   *
   * @param contentType
   * @param obaRequest
   * @return Response from the API call
   */;
  _proto.followRedirectToMiddlewareBankSLoginPage =
  /*#__PURE__*/
  function () {
    var _followRedirectToMiddlewareBankSLoginPage = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(contentType, obaRequest, requestOptions) {
      var req, mapped;
      return _regeneratorRuntime().wrap(function _callee$(_context) {
        while (1) switch (_context.prev = _context.next) {
          case 0:
            req = this.createRequest('GET', '/auth/login');
            req.baseUrl('server 2');
            mapped = req.prepareArgs({
              contentType: [contentType, contentType2EnumSchema],
              obaRequest: [obaRequest, schema.string()]
            });
            req.header('Content-Type', mapped.contentType);
            req.query('oba_request', mapped.obaRequest);
            req.authenticate(false);
            return _context.abrupt("return", req.callAsText(requestOptions));
          case 7:
          case "end":
            return _context.stop();
        }
      }, _callee, this);
    }));
    function followRedirectToMiddlewareBankSLoginPage(_x, _x2, _x3) {
      return _followRedirectToMiddlewareBankSLoginPage.apply(this, arguments);
    }
    return followRedirectToMiddlewareBankSLoginPage;
  }()
  /**
   * This step mimics the user authenticating at Middleware Bank. Your application doesn't need to worry
   * about this UI because it is provided by the API Provider.
   *
   * Preconditions:
   *
   * *   The user who authenticates is defined by the environment variable PNZ-E-Username. The default
   * user is 'user01'. If you want to authenticate 'user02', then you'll need to change the PNZ-E-
   * Username environment variable to 'user02'.
   * *   This step relies on the presence of the PNZ-T-AC-ObaRequest environment variable, which is set
   * upon successful completion of Step HF-AC4 - Follow redirect to Middleware Bank's login page.
   * *   This step also relies on the OB_AUTHSESSION cookie that is created in step HF-AC4 - Follow
   * redirect to Middleware Bank's login page.
   *
   *
   * Response:
   *
   * *   The response should be a redirect to the Middleware Bank consent page.
   *
   *
   * Postconditions:
   *
   * *   The returned redirect URI is saved in the PNZ-T-AC-ConsentLocation environment variable in
   * preparation for Step HF-AC6 - Follow redirect to Middleware Bank's consent page.
   *
   *
   * Examples:
   *
   * *   There is one example which shows the request and the expected response.
   *
   *
   * Troubleshooting:
   *
   * *   The most likely cause of errors is that the step is being attempted out of sequence. Be sure to
   * follow the steps in sequence.
   * *   Another likely cause of errors are out of date variable values. Try starting from Step AC1 -
   * Initiate client credentials grant again.
   * *   Another cause may be an incorrect username. The only valid usernames are 'user01' and 'user02'.
   * These user names are associated to the two test customers we create in the Sandbox test data set for
   * you.
   *
   * @param contentType
   * @param username
   * @param password
   * @param obaRequest
   * @return Response from the API call
   */
  ;
  _proto.authenticateCustomerToMiddlewareBank =
  /*#__PURE__*/
  function () {
    var _authenticateCustomerToMiddlewareBank = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(contentType, username, password, obaRequest, requestOptions) {
      var req, mapped;
      return _regeneratorRuntime().wrap(function _callee2$(_context2) {
        while (1) switch (_context2.prev = _context2.next) {
          case 0:
            req = this.createRequest('POST', '/mwnz-bank/v2.0/login');
            req.baseUrl('server 2');
            mapped = req.prepareArgs({
              contentType: [contentType, contentTypeEnumSchema],
              username: [username, schema.string()],
              password: [password, schema.string()],
              obaRequest: [obaRequest, schema.string()]
            });
            req.header('Content-Type', mapped.contentType);
            req.form({
              username: mapped.username,
              password: mapped.password,
              oba_request: mapped.obaRequest
            });
            req.authenticate(false);
            return _context2.abrupt("return", req.call(requestOptions));
          case 7:
          case "end":
            return _context2.stop();
        }
      }, _callee2, this);
    }));
    function authenticateCustomerToMiddlewareBank(_x4, _x5, _x6, _x7, _x8) {
      return _authenticateCustomerToMiddlewareBank.apply(this, arguments);
    }
    return authenticateCustomerToMiddlewareBank;
  }()
  /**
   * This step is following the redirect which was returned in the previous step. In the browser, this
   * redirect happens automatically, but we must explicitly follow the redirect.
   *
   * Preconditions:
   *
   * *   This step relies on the presence of a PNZ-T-AC-ConsentLocation environment variable, which is
   * set upon successful completion of Step HF-AC5 - Authenticate customer to Middleware Bank.
   * *   This step also relies on the OB_AUTHSESSION cookie that is created in step HF-AC4 - Follow
   * redirect to Middleware Bank's login page.
   *
   *
   * Response:
   *
   * *   The response should be a Middleware Bank consent screen.
   *
   *
   * Postconditions:
   *
   * *   The list of accounts for which access will be consented is put in the PNZ-T-AC-ConsentedAccounts
   * environment variable, and the Consent App URL from the action of the form is put into the PNZ-T-AC-
   * Consent environment variable in preparation for Step HF-AC7 - Post consented accounts array to
   * complete consent.
   *
   *
   * Examples:
   *
   * *   There is one example which shows the request and the expected response.
   *
   *
   * Troublshooting:
   *
   * *   The most likely cause of errors is that the step is being attempted out of sequence. Be sure to
   * follow the steps in sequence.
   * *   Another likely cause of errors are out of date variable values. Try starting from Step AC1 -
   * Initiate client credentials grant again.
   *
   * @param contentType
   * @param obaRequest
   * @param cookie
   * @return Response from the API call
   */
  ;
  _proto.followRedirectToMiddlewareBankSConsentPage =
  /*#__PURE__*/
  function () {
    var _followRedirectToMiddlewareBankSConsentPage = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(contentType, obaRequest, cookie, requestOptions) {
      var req, mapped;
      return _regeneratorRuntime().wrap(function _callee3$(_context3) {
        while (1) switch (_context3.prev = _context3.next) {
          case 0:
            req = this.createRequest('GET', '/auth/consent');
            req.baseUrl('server 2');
            mapped = req.prepareArgs({
              contentType: [contentType, contentTypeEnumSchema],
              obaRequest: [obaRequest, schema.string()],
              cookie: [cookie, schema.string()]
            });
            req.header('Content-Type', mapped.contentType);
            req.header('Cookie', mapped.cookie);
            req.query('oba_request', mapped.obaRequest);
            req.authenticate(false);
            return _context3.abrupt("return", req.callAsText(requestOptions));
          case 8:
          case "end":
            return _context3.stop();
        }
      }, _callee3, this);
    }));
    function followRedirectToMiddlewareBankSConsentPage(_x9, _x10, _x11, _x12) {
      return _followRedirectToMiddlewareBankSConsentPage.apply(this, arguments);
    }
    return followRedirectToMiddlewareBankSConsentPage;
  }()
  /**
   * HF AC 7 new
   *
   * @param cookie
   * @param body
   * @return Response from the API call
   */
  ;
  _proto.postConsentedAccountsArray =
  /*#__PURE__*/
  function () {
    var _postConsentedAccountsArray = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(cookie, body, requestOptions) {
      var req, mapped;
      return _regeneratorRuntime().wrap(function _callee4$(_context4) {
        while (1) switch (_context4.prev = _context4.next) {
          case 0:
            req = this.createRequest('POST', '/mwnz-bank/v2.0/consent');
            req.baseUrl('server 2');
            mapped = req.prepareArgs({
              cookie: [cookie, schema.string()],
              body: [body, schema.string()]
            });
            req.header('Cookie', mapped.cookie);
            req.header('Content-Type', 'application/x-www-form-urlencoded');
            req.text(mapped.body);
            req.authenticate(false);
            return _context4.abrupt("return", req.call(requestOptions));
          case 8:
          case "end":
            return _context4.stop();
        }
      }, _callee4, this);
    }));
    function postConsentedAccountsArray(_x13, _x14, _x15) {
      return _postConsentedAccountsArray.apply(this, arguments);
    }
    return postConsentedAccountsArray;
  }()
  /**
   * @param clientID
   * @param privateKey
   * @param KID
   * @param redirectUri
   * @param code
   * @return Response from the API call
   */
  ;
  _proto.exchangeAuthorizationCode =
  /*#__PURE__*/
  function () {
    var _exchangeAuthorizationCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(clientID, privateKey, KID, redirectUri, code, requestOptions) {
      var req, grantType, clientAssertionType, jti, payload, clientAssertion, mapped;
      return _regeneratorRuntime().wrap(function _callee5$(_context5) {
        while (1) switch (_context5.prev = _context5.next) {
          case 0:
            req = this.createRequest('POST', '/oauth/v2.0/token');
            req.baseUrl('server 1');
            grantType = 'authorization_code';
            clientAssertionType = 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer';
            jti = '9OyL2boCICsjI4wM4CKTlw';
            payload = {
              sub: clientID,
              aud: 'https://api-nomatls.apicentre.middleware.co.nz/oauth/v2.0/token',
              iss: clientID,
              exp: Math.floor(Date.now() / 1000) + 3599,
              iat: Math.floor(Date.now() / 1000) - 120,
              jti: jti
            };
            clientAssertion = ClientAssertionJWT(privateKey, KID, payload);
            mapped = req.prepareArgs({
              grantType: [grantType, schema.string()],
              code: [code, schema.string()],
              redirectUri: [redirectUri, schema.string()],
              clientAssertion: [clientAssertion, schema.string()],
              clientAssertionType: [clientAssertionType, schema.string()]
            });
            req.header('Content-Type', 'application/x-www-form-urlencoded');
            req.form({
              grant_type: mapped.grantType,
              code: mapped.code,
              redirect_uri: mapped.redirectUri,
              client_assertion: mapped.clientAssertion,
              client_assertion_type: mapped.clientAssertionType
            });
            req.authenticate(false);
            return _context5.abrupt("return", req.callAsJson(hFAC8ExchangeauthorizationcodeforaccesstokenSchema, requestOptions));
          case 12:
          case "end":
            return _context5.stop();
        }
      }, _callee5, this);
    }));
    function exchangeAuthorizationCode(_x16, _x17, _x18, _x19, _x20, _x21) {
      return _exchangeAuthorizationCode.apply(this, arguments);
    }
    return exchangeAuthorizationCode;
  }();
  return AuthorizeConsentController;
}(BaseController);

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var amountSchema = /*#__PURE__*/schema.object({
  amount: ['Amount', /*#__PURE__*/schema.string()],
  currency: ['Currency', /*#__PURE__*/schema.string()]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var balance1Schema = /*#__PURE__*/schema.object({
  amount: ['Amount', /*#__PURE__*/schema.lazy(function () {
    return amountSchema;
  })],
  creditDebitIndicator: ['CreditDebitIndicator', /*#__PURE__*/schema.string()],
  type: ['Type', /*#__PURE__*/schema.string()]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var bankTransactionCodeSchema = /*#__PURE__*/schema.object({
  code: ['Code', /*#__PURE__*/schema.string()],
  subCode: ['SubCode', /*#__PURE__*/schema.string()]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var cardInstrumentSchema = /*#__PURE__*/schema.object({
  cardSchemeName: ['CardSchemeName', /*#__PURE__*/schema.string()],
  name: ['Name', /*#__PURE__*/schema.string()],
  authorisationType: ['AuthorisationType', /*#__PURE__*/schema.string()],
  identification: ['Identification', /*#__PURE__*/schema.string()]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var creditorAccount1Schema = /*#__PURE__*/schema.object({
  schemeName: ['SchemeName', /*#__PURE__*/schema.string()],
  identification: ['Identification', /*#__PURE__*/schema.string()],
  name: ['Name', /*#__PURE__*/schema.string()]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var creditorAgent1Schema = /*#__PURE__*/schema.object({
  schemeName: ['SchemeName', /*#__PURE__*/schema.string()],
  identification: ['Identification', /*#__PURE__*/schema.string()]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var debtorAccountSchema = /*#__PURE__*/schema.object({
  schemeName: ['SchemeName', /*#__PURE__*/schema.string()],
  identification: ['Identification', /*#__PURE__*/schema.string()],
  name: ['Name', /*#__PURE__*/schema.string()]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var debtorAgentSchema = /*#__PURE__*/schema.object({
  schemeName: ['SchemeName', /*#__PURE__*/schema.string()],
  identification: ['Identification', /*#__PURE__*/schema.string()]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var merchantDetailsSchema = /*#__PURE__*/schema.object({
  merchantName: ['MerchantName', /*#__PURE__*/schema.string()],
  merchantCategoryCode: ['MerchantCategoryCode', /*#__PURE__*/schema.string()]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var proprietaryBankTransactionCodeSchema = /*#__PURE__*/schema.object({
  code: ['Code', /*#__PURE__*/schema.string()],
  issuer: ['Issuer', /*#__PURE__*/schema.string()]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var creditorReferenceSchema = /*#__PURE__*/schema.object({
  particulars: ['Particulars', /*#__PURE__*/schema.string()],
  code: ['Code', /*#__PURE__*/schema.string()],
  reference: ['Reference', /*#__PURE__*/schema.string()]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var debtorReferenceSchema = /*#__PURE__*/schema.object({
  particulars: ['Particulars', /*#__PURE__*/schema.string()],
  code: ['Code', /*#__PURE__*/schema.string()],
  reference: ['Reference', /*#__PURE__*/schema.string()]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var transactionReferenceSchema = /*#__PURE__*/schema.object({
  creditorName: ['CreditorName', /*#__PURE__*/schema.string()],
  debtorName: ['DebtorName', /*#__PURE__*/schema.string()],
  creditorReference: ['CreditorReference', /*#__PURE__*/schema.lazy(function () {
    return creditorReferenceSchema;
  })],
  debtorReference: ['DebtorReference', /*#__PURE__*/schema.lazy(function () {
    return debtorReferenceSchema;
  })]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var transactionSchema = /*#__PURE__*/schema.object({
  accountId: ['AccountId', /*#__PURE__*/schema.string()],
  amount: ['Amount', /*#__PURE__*/schema.lazy(function () {
    return amountSchema;
  })],
  creditDebitIndicator: ['CreditDebitIndicator', /*#__PURE__*/schema.string()],
  bookingDateTime: ['BookingDateTime', /*#__PURE__*/schema.string()],
  status: ['Status', /*#__PURE__*/schema.string()],
  statementReference: ['StatementReference', /*#__PURE__*/schema.array( /*#__PURE__*/schema.string())],
  transactionReference: ['TransactionReference', /*#__PURE__*/schema.lazy(function () {
    return transactionReferenceSchema;
  })],
  transactionId: ['TransactionId', /*#__PURE__*/schema.string()],
  bankTransactionCode: ['BankTransactionCode', /*#__PURE__*/schema.lazy(function () {
    return bankTransactionCodeSchema;
  })],
  proprietaryBankTransactionCode: ['ProprietaryBankTransactionCode', /*#__PURE__*/schema.lazy(function () {
    return proprietaryBankTransactionCodeSchema;
  })],
  valueDateTime: ['ValueDateTime', /*#__PURE__*/schema.string()],
  transactionInformation: ['TransactionInformation', /*#__PURE__*/schema.string()],
  balance: ['Balance', /*#__PURE__*/schema.lazy(function () {
    return balance1Schema;
  })],
  merchantDetails: ['MerchantDetails', /*#__PURE__*/schema.lazy(function () {
    return merchantDetailsSchema;
  })],
  creditorAgent: ['CreditorAgent', /*#__PURE__*/schema.lazy(function () {
    return creditorAgent1Schema;
  })],
  creditorAccount: ['CreditorAccount', /*#__PURE__*/schema.lazy(function () {
    return creditorAccount1Schema;
  })],
  debtorAgent: ['DebtorAgent', /*#__PURE__*/schema.lazy(function () {
    return debtorAgentSchema;
  })],
  debtorAccount: ['DebtorAccount', /*#__PURE__*/schema.lazy(function () {
    return debtorAccountSchema;
  })],
  cardInstrument: ['CardInstrument', /*#__PURE__*/schema.optional( /*#__PURE__*/schema.lazy(function () {
    return cardInstrumentSchema;
  }))]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var data11Schema = /*#__PURE__*/schema.object({
  transaction: ['Transaction', /*#__PURE__*/schema.array( /*#__PURE__*/schema.lazy(function () {
    return transactionSchema;
  }))]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var linksSchema = /*#__PURE__*/schema.object({
  self: ['Self', /*#__PURE__*/schema.string()]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var metaSchema = /*#__PURE__*/schema.object({
  totalPages: ['TotalPages', /*#__PURE__*/schema.number()]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var aC1010RetrievebulktransactionsSchema = /*#__PURE__*/schema.object({
  data: ['Data', /*#__PURE__*/schema.lazy(function () {
    return data11Schema;
  })],
  links: ['Links', /*#__PURE__*/schema.lazy(function () {
    return linksSchema;
  })],
  meta: ['Meta', /*#__PURE__*/schema.lazy(function () {
    return metaSchema;
  })]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var account1Schema = /*#__PURE__*/schema.object({
  schemeName: ['SchemeName', /*#__PURE__*/schema.string()],
  identification: ['Identification', /*#__PURE__*/schema.string()],
  name: ['Name', /*#__PURE__*/schema.string()],
  secondaryIdentification: ['SecondaryIdentification', /*#__PURE__*/schema.string()]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var accountSchema = /*#__PURE__*/schema.object({
  accountId: ['AccountId', /*#__PURE__*/schema.string()],
  currency: ['Currency', /*#__PURE__*/schema.string()],
  nickname: ['Nickname', /*#__PURE__*/schema.string()],
  description: ['Description', /*#__PURE__*/schema.string()],
  accountType: ['AccountType', /*#__PURE__*/schema.string()],
  accountSubType: ['AccountSubType', /*#__PURE__*/schema.string()],
  account: ['Account', /*#__PURE__*/schema.lazy(function () {
    return account1Schema;
  })]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var data2Schema = /*#__PURE__*/schema.object({
  account: ['Account', /*#__PURE__*/schema.array( /*#__PURE__*/schema.lazy(function () {
    return accountSchema;
  }))]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var aC101RetrieveconsentedaccountsinformationSchema = /*#__PURE__*/schema.object({
  data: ['Data', /*#__PURE__*/schema.lazy(function () {
    return data2Schema;
  })],
  links: ['Links', /*#__PURE__*/schema.lazy(function () {
    return linksSchema;
  })],
  meta: ['Meta', /*#__PURE__*/schema.lazy(function () {
    return metaSchema;
  })]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var balanceSchema = /*#__PURE__*/schema.object({
  accountId: ['AccountId', /*#__PURE__*/schema.string()],
  type: ['Type', /*#__PURE__*/schema.string()],
  amount: ['Amount', /*#__PURE__*/schema.lazy(function () {
    return amountSchema;
  })],
  creditLine: ['CreditLine', /*#__PURE__*/schema.array( /*#__PURE__*/schema.string())],
  dateTime: ['DateTime', /*#__PURE__*/schema.string()],
  creditDebitIndicator: ['CreditDebitIndicator', /*#__PURE__*/schema.string()]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var data3Schema = /*#__PURE__*/schema.object({
  balance: ['Balance', /*#__PURE__*/schema.array( /*#__PURE__*/schema.lazy(function () {
    return balanceSchema;
  }))]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var aC102RetrievebulkbalancesSchema = /*#__PURE__*/schema.object({
  data: ['Data', /*#__PURE__*/schema.lazy(function () {
    return data3Schema;
  })],
  links: ['Links', /*#__PURE__*/schema.lazy(function () {
    return linksSchema;
  })],
  meta: ['Meta', /*#__PURE__*/schema.lazy(function () {
    return metaSchema;
  })]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var creditorAccountSchema = /*#__PURE__*/schema.object({
  schemeName: ['SchemeName', /*#__PURE__*/schema.string()],
  identification: ['Identification', /*#__PURE__*/schema.string()],
  name: ['Name', /*#__PURE__*/schema.string()],
  secondaryIdentification: ['SecondaryIdentification', /*#__PURE__*/schema.string()]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var postalAddressSchema = /*#__PURE__*/schema.object({
  country: ['Country', /*#__PURE__*/schema.string()],
  addressLine: ['AddressLine', /*#__PURE__*/schema.array( /*#__PURE__*/schema.string())],
  addressType: ['AddressType', /*#__PURE__*/schema.string()],
  streetName: ['StreetName', /*#__PURE__*/schema.string()],
  buildingNumber: ['BuildingNumber', /*#__PURE__*/schema.string()],
  postCode: ['PostCode', /*#__PURE__*/schema.string()],
  townName: ['TownName', /*#__PURE__*/schema.string()],
  countrySubDivision: ['CountrySubDivision', /*#__PURE__*/schema.string()]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var creditorAgentSchema = /*#__PURE__*/schema.object({
  schemeName: ['SchemeName', /*#__PURE__*/schema.string()],
  identification: ['Identification', /*#__PURE__*/schema.string()],
  name: ['Name', /*#__PURE__*/schema.string()],
  postalAddress: ['PostalAddress', /*#__PURE__*/schema.lazy(function () {
    return postalAddressSchema;
  })]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var referenceSchema = /*#__PURE__*/schema.object({
  creditorName: ['CreditorName', /*#__PURE__*/schema.string()],
  debtorName: ['DebtorName', /*#__PURE__*/schema.string()],
  creditorReference: ['CreditorReference', /*#__PURE__*/schema.lazy(function () {
    return creditorReferenceSchema;
  })],
  debtorReference: ['DebtorReference', /*#__PURE__*/schema.lazy(function () {
    return debtorReferenceSchema;
  })]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var beneficiarySchema = /*#__PURE__*/schema.object({
  accountId: ['AccountId', /*#__PURE__*/schema.string()],
  beneficiaryId: ['BeneficiaryId', /*#__PURE__*/schema.string()],
  reference: ['Reference', /*#__PURE__*/schema.lazy(function () {
    return referenceSchema;
  })],
  creditorAgent: ['CreditorAgent', /*#__PURE__*/schema.lazy(function () {
    return creditorAgentSchema;
  })],
  creditorAccount: ['CreditorAccount', /*#__PURE__*/schema.lazy(function () {
    return creditorAccountSchema;
  })]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var data4Schema = /*#__PURE__*/schema.object({
  beneficiary: ['Beneficiary', /*#__PURE__*/schema.array( /*#__PURE__*/schema.lazy(function () {
    return beneficiarySchema;
  }))]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var aC103RetrievebulkbeneficiariesSchema = /*#__PURE__*/schema.object({
  data: ['Data', /*#__PURE__*/schema.lazy(function () {
    return data4Schema;
  })],
  links: ['Links', /*#__PURE__*/schema.lazy(function () {
    return linksSchema;
  })],
  meta: ['Meta', /*#__PURE__*/schema.lazy(function () {
    return metaSchema;
  })]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var previousPaymentAmountSchema = /*#__PURE__*/schema.object({
  amount: ['Amount', /*#__PURE__*/schema.string()],
  currency: ['Currency', /*#__PURE__*/schema.string()]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var directDebitSchema = /*#__PURE__*/schema.object({
  accountId: ['AccountId', /*#__PURE__*/schema.string()],
  mandateIdentification: ['MandateIdentification', /*#__PURE__*/schema.string()],
  name: ['Name', /*#__PURE__*/schema.string()],
  directDebitId: ['DirectDebitId', /*#__PURE__*/schema.string()],
  directDebitStatusCode: ['DirectDebitStatusCode', /*#__PURE__*/schema.string()],
  previousPaymentAmount: ['PreviousPaymentAmount', /*#__PURE__*/schema.lazy(function () {
    return previousPaymentAmountSchema;
  })],
  previousPaymentDateTime: ['PreviousPaymentDateTime', /*#__PURE__*/schema.string()]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var data5Schema = /*#__PURE__*/schema.object({
  directDebit: ['DirectDebit', /*#__PURE__*/schema.array( /*#__PURE__*/schema.lazy(function () {
    return directDebitSchema;
  }))]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var aC104RetrievebulkdirectdebitsSchema = /*#__PURE__*/schema.object({
  data: ['Data', /*#__PURE__*/schema.lazy(function () {
    return data5Schema;
  })],
  links: ['Links', /*#__PURE__*/schema.lazy(function () {
    return linksSchema;
  })],
  meta: ['Meta', /*#__PURE__*/schema.lazy(function () {
    return metaSchema;
  })]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var feeSchema = /*#__PURE__*/schema.object({
  amount: ['Amount', /*#__PURE__*/schema.string()],
  currency: ['Currency', /*#__PURE__*/schema.string()]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var offerSchema = /*#__PURE__*/schema.object({
  accountId: ['AccountId', /*#__PURE__*/schema.string()],
  offerId: ['OfferId', /*#__PURE__*/schema.string()],
  offerType: ['OfferType', /*#__PURE__*/schema.string()],
  description: ['Description', /*#__PURE__*/schema.string()],
  startDateTime: ['StartDateTime', /*#__PURE__*/schema.string()],
  endDateTime: ['EndDateTime', /*#__PURE__*/schema.string()],
  amount: ['Amount', /*#__PURE__*/schema.optional( /*#__PURE__*/schema.lazy(function () {
    return amountSchema;
  }))],
  fee: ['Fee', /*#__PURE__*/schema.optional( /*#__PURE__*/schema.lazy(function () {
    return feeSchema;
  }))],
  value: ['Value', /*#__PURE__*/schema.optional( /*#__PURE__*/schema.number())],
  term: ['Term', /*#__PURE__*/schema.optional( /*#__PURE__*/schema.string())],
  rate: ['Rate', /*#__PURE__*/schema.optional( /*#__PURE__*/schema.string())]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var data6Schema = /*#__PURE__*/schema.object({
  offer: ['Offer', /*#__PURE__*/schema.array( /*#__PURE__*/schema.lazy(function () {
    return offerSchema;
  }))]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var aC105RetrievebulkoffersSchema = /*#__PURE__*/schema.object({
  data: ['Data', /*#__PURE__*/schema.lazy(function () {
    return data6Schema;
  })],
  links: ['Links', /*#__PURE__*/schema.lazy(function () {
    return linksSchema;
  })],
  meta: ['Meta', /*#__PURE__*/schema.lazy(function () {
    return metaSchema;
  })]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var addressSchema = /*#__PURE__*/schema.object({
  country: ['Country', /*#__PURE__*/schema.string()],
  addressLine: ['AddressLine', /*#__PURE__*/schema.array( /*#__PURE__*/schema.string())],
  addressType: ['AddressType', /*#__PURE__*/schema.string()],
  streetName: ['StreetName', /*#__PURE__*/schema.optional( /*#__PURE__*/schema.string())],
  buildingNumber: ['BuildingNumber', /*#__PURE__*/schema.optional( /*#__PURE__*/schema.string())],
  postCode: ['PostCode', /*#__PURE__*/schema.string()],
  townName: ['TownName', /*#__PURE__*/schema.string()],
  countrySubDivision: ['CountrySubDivision', /*#__PURE__*/schema.optional( /*#__PURE__*/schema.string())]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var partySchema = /*#__PURE__*/schema.object({
  partyId: ['PartyId', /*#__PURE__*/schema.string()],
  partyNumber: ['PartyNumber', /*#__PURE__*/schema.string()],
  partyType: ['PartyType', /*#__PURE__*/schema.string()],
  name: ['Name', /*#__PURE__*/schema.string()],
  emailAddress: ['EmailAddress', /*#__PURE__*/schema.string()],
  phone: ['Phone', /*#__PURE__*/schema.string()],
  mobile: ['Mobile', /*#__PURE__*/schema.string()],
  address: ['Address', /*#__PURE__*/schema.array( /*#__PURE__*/schema.lazy(function () {
    return addressSchema;
  }))]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var data7Schema = /*#__PURE__*/schema.object({
  party: ['Party', /*#__PURE__*/schema.lazy(function () {
    return partySchema;
  })]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var aC106RetrieveauthorisingpartySchema = /*#__PURE__*/schema.object({
  data: ['Data', /*#__PURE__*/schema.lazy(function () {
    return data7Schema;
  })],
  meta: ['Meta', /*#__PURE__*/schema.unknown()],
  links: ['Links', /*#__PURE__*/schema.lazy(function () {
    return linksSchema;
  })]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var instructedAmountSchema = /*#__PURE__*/schema.object({
  amount: ['Amount', /*#__PURE__*/schema.string()],
  currency: ['Currency', /*#__PURE__*/schema.string()]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var scheduledPaymentSchema = /*#__PURE__*/schema.object({
  accountId: ['AccountId', /*#__PURE__*/schema.string()],
  scheduledType: ['ScheduledType', /*#__PURE__*/schema.string()],
  instructedAmount: ['InstructedAmount', /*#__PURE__*/schema.lazy(function () {
    return instructedAmountSchema;
  })],
  scheduledPaymentDateTime: ['ScheduledPaymentDateTime', /*#__PURE__*/schema.string()],
  scheduledPaymentId: ['ScheduledPaymentId', /*#__PURE__*/schema.string()],
  reference: ['Reference', /*#__PURE__*/schema.lazy(function () {
    return referenceSchema;
  })],
  creditorAccount: ['CreditorAccount', /*#__PURE__*/schema.lazy(function () {
    return creditorAccount1Schema;
  })],
  creditorAgent: ['CreditorAgent', /*#__PURE__*/schema.lazy(function () {
    return creditorAgent1Schema;
  })]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var data8Schema = /*#__PURE__*/schema.object({
  scheduledPayment: ['ScheduledPayment', /*#__PURE__*/schema.array( /*#__PURE__*/schema.lazy(function () {
    return scheduledPaymentSchema;
  }))]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var aC107RetrievebulkscheduledpaymentsSchema = /*#__PURE__*/schema.object({
  data: ['Data', /*#__PURE__*/schema.lazy(function () {
    return data8Schema;
  })],
  links: ['Links', /*#__PURE__*/schema.lazy(function () {
    return linksSchema;
  })],
  meta: ['Meta', /*#__PURE__*/schema.lazy(function () {
    return metaSchema;
  })]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var finalPaymentAmountSchema = /*#__PURE__*/schema.object({
  amount: ['Amount', /*#__PURE__*/schema.string()],
  currency: ['Currency', /*#__PURE__*/schema.string()]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var firstPaymentAmountSchema = /*#__PURE__*/schema.object({
  amount: ['Amount', /*#__PURE__*/schema.string()],
  currency: ['Currency', /*#__PURE__*/schema.string()]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var nextPaymentAmountSchema = /*#__PURE__*/schema.object({
  amount: ['Amount', /*#__PURE__*/schema.string()],
  currency: ['Currency', /*#__PURE__*/schema.string()]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var standingOrderSchema = /*#__PURE__*/schema.object({
  accountId: ['AccountId', /*#__PURE__*/schema.string()],
  frequency: ['Frequency', /*#__PURE__*/schema.string()],
  nextPaymentDateTime: ['NextPaymentDateTime', /*#__PURE__*/schema.string()],
  nextPaymentAmount: ['NextPaymentAmount', /*#__PURE__*/schema.lazy(function () {
    return nextPaymentAmountSchema;
  })],
  standingOrderId: ['StandingOrderId', /*#__PURE__*/schema.string()],
  reference: ['Reference', /*#__PURE__*/schema.lazy(function () {
    return referenceSchema;
  })],
  firstPaymentAmount: ['FirstPaymentAmount', /*#__PURE__*/schema.lazy(function () {
    return firstPaymentAmountSchema;
  })],
  finalPaymentAmount: ['FinalPaymentAmount', /*#__PURE__*/schema.lazy(function () {
    return finalPaymentAmountSchema;
  })],
  firstPaymentDateTime: ['FirstPaymentDateTime', /*#__PURE__*/schema.string()],
  finalPaymentDateTime: ['FinalPaymentDateTime', /*#__PURE__*/schema.string()],
  creditorAccount: ['CreditorAccount', /*#__PURE__*/schema.lazy(function () {
    return creditorAccount1Schema;
  })],
  creditorAgent: ['CreditorAgent', /*#__PURE__*/schema.lazy(function () {
    return creditorAgent1Schema;
  })]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var data9Schema = /*#__PURE__*/schema.object({
  standingOrder: ['StandingOrder', /*#__PURE__*/schema.array( /*#__PURE__*/schema.lazy(function () {
    return standingOrderSchema;
  }))]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var aC108RetrievebulkstandingordersSchema = /*#__PURE__*/schema.object({
  data: ['Data', /*#__PURE__*/schema.lazy(function () {
    return data9Schema;
  })],
  links: ['Links', /*#__PURE__*/schema.lazy(function () {
    return linksSchema;
  })],
  meta: ['Meta', /*#__PURE__*/schema.lazy(function () {
    return metaSchema;
  })]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var statementAmountSchema = /*#__PURE__*/schema.object({
  creditDebitIndicator: ['CreditDebitIndicator', /*#__PURE__*/schema.string()],
  type: ['Type', /*#__PURE__*/schema.string()],
  amount: ['Amount', /*#__PURE__*/schema.lazy(function () {
    return amountSchema;
  })]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var statementSchema = /*#__PURE__*/schema.object({
  accountId: ['AccountId', /*#__PURE__*/schema.string()],
  startDateTime: ['StartDateTime', /*#__PURE__*/schema.string()],
  endDateTime: ['EndDateTime', /*#__PURE__*/schema.string()],
  creationDateTime: ['CreationDateTime', /*#__PURE__*/schema.string()],
  type: ['Type', /*#__PURE__*/schema.string()],
  statementId: ['StatementId', /*#__PURE__*/schema.string()],
  statementDescription: ['StatementDescription', /*#__PURE__*/schema.array( /*#__PURE__*/schema.string())],
  statementBenefit: ['StatementBenefit', /*#__PURE__*/schema.array( /*#__PURE__*/schema.string())],
  statementFee: ['StatementFee', /*#__PURE__*/schema.array( /*#__PURE__*/schema.string())],
  statementInterest: ['StatementInterest', /*#__PURE__*/schema.array( /*#__PURE__*/schema.string())],
  statementDateTime: ['StatementDateTime', /*#__PURE__*/schema.array( /*#__PURE__*/schema.string())],
  statementRate: ['StatementRate', /*#__PURE__*/schema.array( /*#__PURE__*/schema.string())],
  statementValue: ['StatementValue', /*#__PURE__*/schema.array( /*#__PURE__*/schema.string())],
  statementAmount: ['StatementAmount', /*#__PURE__*/schema.array( /*#__PURE__*/schema.lazy(function () {
    return statementAmountSchema;
  }))]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var data10Schema = /*#__PURE__*/schema.object({
  statement: ['Statement', /*#__PURE__*/schema.array( /*#__PURE__*/schema.lazy(function () {
    return statementSchema;
  }))]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var aC109RetrievebulkstatementsSchema = /*#__PURE__*/schema.object({
  data: ['Data', /*#__PURE__*/schema.lazy(function () {
    return data10Schema;
  })],
  links: ['Links', /*#__PURE__*/schema.lazy(function () {
    return linksSchema;
  })],
  meta: ['Meta', /*#__PURE__*/schema.lazy(function () {
    return metaSchema;
  })]
});

var BulkEndpointsController = /*#__PURE__*/function (_BaseController) {
  _inheritsLoose(BulkEndpointsController, _BaseController);
  function BulkEndpointsController() {
    return _BaseController.apply(this, arguments) || this;
  }
  var _proto = BulkEndpointsController.prototype;
  /**
   * 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
   */
  _proto.retrieveConsentedAccountsInformation =
  /*#__PURE__*/
  function () {
    var _retrieveConsentedAccountsInformation = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(authorization, requestOptions) {
      var req, mapped;
      return _regeneratorRuntime().wrap(function _callee$(_context) {
        while (1) switch (_context.prev = _context.next) {
          case 0:
            req = this.createRequest('GET', '/open-banking-nz/v2.3/accounts');
            mapped = req.prepareArgs({
              authorization: [authorization, schema.string()]
            });
            req.header('Authorization', mapped.authorization);
            return _context.abrupt("return", req.callAsJson(aC101RetrieveconsentedaccountsinformationSchema, requestOptions));
          case 4:
          case "end":
            return _context.stop();
        }
      }, _callee, this);
    }));
    function retrieveConsentedAccountsInformation(_x, _x2) {
      return _retrieveConsentedAccountsInformation.apply(this, arguments);
    }
    return retrieveConsentedAccountsInformation;
  }()
  /**
   * 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
   */
  ;
  _proto.retrieveBulkBalances =
  /*#__PURE__*/
  function () {
    var _retrieveBulkBalances = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(authorization, requestOptions) {
      var req, mapped;
      return _regeneratorRuntime().wrap(function _callee2$(_context2) {
        while (1) switch (_context2.prev = _context2.next) {
          case 0:
            req = this.createRequest('GET', '/open-banking-nz/v2.3/balances');
            mapped = req.prepareArgs({
              authorization: [authorization, schema.string()]
            });
            req.header('Authorization', mapped.authorization);
            return _context2.abrupt("return", req.callAsJson(aC102RetrievebulkbalancesSchema, requestOptions));
          case 4:
          case "end":
            return _context2.stop();
        }
      }, _callee2, this);
    }));
    function retrieveBulkBalances(_x3, _x4) {
      return _retrieveBulkBalances.apply(this, arguments);
    }
    return retrieveBulkBalances;
  }()
  /**
   * 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
   */
  ;
  _proto.retrieveBulkBeneficiaries =
  /*#__PURE__*/
  function () {
    var _retrieveBulkBeneficiaries = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(authorization, requestOptions) {
      var req, mapped;
      return _regeneratorRuntime().wrap(function _callee3$(_context3) {
        while (1) switch (_context3.prev = _context3.next) {
          case 0:
            req = this.createRequest('GET', '/open-banking-nz/v2.3/beneficiaries');
            mapped = req.prepareArgs({
              authorization: [authorization, schema.string()]
            });
            req.header('Authorization', mapped.authorization);
            return _context3.abrupt("return", req.callAsJson(aC103RetrievebulkbeneficiariesSchema, requestOptions));
          case 4:
          case "end":
            return _context3.stop();
        }
      }, _callee3, this);
    }));
    function retrieveBulkBeneficiaries(_x5, _x6) {
      return _retrieveBulkBeneficiaries.apply(this, arguments);
    }
    return retrieveBulkBeneficiaries;
  }()
  /**
   * 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
   */
  ;
  _proto.retrieveBulkDirectDebits =
  /*#__PURE__*/
  function () {
    var _retrieveBulkDirectDebits = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(authorization, requestOptions) {
      var req, mapped;
      return _regeneratorRuntime().wrap(function _callee4$(_context4) {
        while (1) switch (_context4.prev = _context4.next) {
          case 0:
            req = this.createRequest('GET', '/open-banking-nz/v2.3/direct-debits');
            mapped = req.prepareArgs({
              authorization: [authorization, schema.string()]
            });
            req.header('Authorization', mapped.authorization);
            return _context4.abrupt("return", req.callAsJson(aC104RetrievebulkdirectdebitsSchema, requestOptions));
          case 4:
          case "end":
            return _context4.stop();
        }
      }, _callee4, this);
    }));
    function retrieveBulkDirectDebits(_x7, _x8) {
      return _retrieveBulkDirectDebits.apply(this, arguments);
    }
    return retrieveBulkDirectDebits;
  }()
  /**
   * 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
   */
  ;
  _proto.retrieveBulkOffers =
  /*#__PURE__*/
  function () {
    var _retrieveBulkOffers = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(authorization, requestOptions) {
      var req, mapped;
      return _regeneratorRuntime().wrap(function _callee5$(_context5) {
        while (1) switch (_context5.prev = _context5.next) {
          case 0:
            req = this.createRequest('GET', '/open-banking-nz/v2.3/offers');
            mapped = req.prepareArgs({
              authorization: [authorization, schema.string()]
            });
            req.header('Authorization', mapped.authorization);
            return _context5.abrupt("return", req.callAsJson(aC105RetrievebulkoffersSchema, requestOptions));
          case 4:
          case "end":
            return _context5.stop();
        }
      }, _callee5, this);
    }));
    function retrieveBulkOffers(_x9, _x10) {
      return _retrieveBulkOffers.apply(this, arguments);
    }
    return retrieveBulkOffers;
  }()
  /**
   * 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
   */
  ;
  _proto.retrieveAuthorisingParty =
  /*#__PURE__*/
  function () {
    var _retrieveAuthorisingParty = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(authorization, requestOptions) {
      var req, mapped;
      return _regeneratorRuntime().wrap(function _callee6$(_context6) {
        while (1) switch (_context6.prev = _context6.next) {
          case 0:
            req = this.createRequest('GET', '/open-banking-nz/v2.3/party');
            mapped = req.prepareArgs({
              authorization: [authorization, schema.string()]
            });
            req.header('Authorization', mapped.authorization);
            return _context6.abrupt("return", req.callAsJson(aC106RetrieveauthorisingpartySchema, requestOptions));
          case 4:
          case "end":
            return _context6.stop();
        }
      }, _callee6, this);
    }));
    function retrieveAuthorisingParty(_x11, _x12) {
      return _retrieveAuthorisingParty.apply(this, arguments);
    }
    return retrieveAuthorisingParty;
  }()
  /**
   * 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
   */
  ;
  _proto.retrieveBulkScheduledPayments =
  /*#__PURE__*/
  function () {
    var _retrieveBulkScheduledPayments = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(authorization, requestOptions) {
      var req, mapped;
      return _regeneratorRuntime().wrap(function _callee7$(_context7) {
        while (1) switch (_context7.prev = _context7.next) {
          case 0:
            req = this.createRequest('GET', '/open-banking-nz/v2.3/scheduled-payments');
            mapped = req.prepareArgs({
              authorization: [authorization, schema.string()]
            });
            req.header('Authorization', mapped.authorization);
            return _context7.abrupt("return", req.callAsJson(aC107RetrievebulkscheduledpaymentsSchema, requestOptions));
          case 4:
          case "end":
            return _context7.stop();
        }
      }, _callee7, this);
    }));
    function retrieveBulkScheduledPayments(_x13, _x14) {
      return _retrieveBulkScheduledPayments.apply(this, arguments);
    }
    return retrieveBulkScheduledPayments;
  }()
  /**
   * 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
   */
  ;
  _proto.retrieveBulkStandingOrders =
  /*#__PURE__*/
  function () {
    var _retrieveBulkStandingOrders = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(authorization, requestOptions) {
      var req, mapped;
      return _regeneratorRuntime().wrap(function _callee8$(_context8) {
        while (1) switch (_context8.prev = _context8.next) {
          case 0:
            req = this.createRequest('GET', '/open-banking-nz/v2.3/standing-orders');
            mapped = req.prepareArgs({
              authorization: [authorization, schema.string()]
            });
            req.header('Authorization', mapped.authorization);
            return _context8.abrupt("return", req.callAsJson(aC108RetrievebulkstandingordersSchema, requestOptions));
          case 4:
          case "end":
            return _context8.stop();
        }
      }, _callee8, this);
    }));
    function retrieveBulkStandingOrders(_x15, _x16) {
      return _retrieveBulkStandingOrders.apply(this, arguments);
    }
    return retrieveBulkStandingOrders;
  }()
  /**
   * 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
   */
  ;
  _proto.retrieveBulkStatements =
  /*#__PURE__*/
  function () {
    var _retrieveBulkStatements = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(authorization, requestOptions) {
      var req, mapped;
      return _regeneratorRuntime().wrap(function _callee9$(_context9) {
        while (1) switch (_context9.prev = _context9.next) {
          case 0:
            req = this.createRequest('GET', '/open-banking-nz/v2.3/statements');
            mapped = req.prepareArgs({
              authorization: [authorization, schema.string()]
            });
            req.header('Authorization', mapped.authorization);
            return _context9.abrupt("return", req.callAsJson(aC109RetrievebulkstatementsSchema, requestOptions));
          case 4:
          case "end":
            return _context9.stop();
        }
      }, _callee9, this);
    }));
    function retrieveBulkStatements(_x17, _x18) {
      return _retrieveBulkStatements.apply(this, arguments);
    }
    return retrieveBulkStatements;
  }()
  /**
   * 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
   */
  ;
  _proto.retrieveBulkTransactions =
  /*#__PURE__*/
  function () {
    var _retrieveBulkTransactions = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(authorization, requestOptions) {
      var req, mapped;
      return _regeneratorRuntime().wrap(function _callee10$(_context10) {
        while (1) switch (_context10.prev = _context10.next) {
          case 0:
            req = this.createRequest('GET', '/open-banking-nz/v2.3/transactions');
            mapped = req.prepareArgs({
              authorization: [authorization, schema.string()]
            });
            req.header('Authorization', mapped.authorization);
            return _context10.abrupt("return", req.callAsJson(aC1010RetrievebulktransactionsSchema, requestOptions));
          case 4:
          case "end":
            return _context10.stop();
        }
      }, _callee10, this);
    }));
    function retrieveBulkTransactions(_x19, _x20) {
      return _retrieveBulkTransactions.apply(this, arguments);
    }
    return retrieveBulkTransactions;
  }();
  return BulkEndpointsController;
}(BaseController);

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var consentSchema = /*#__PURE__*/schema.object({
  transactionToDateTime: ['TransactionToDateTime', /*#__PURE__*/schema.string()],
  expirationDateTime: ['ExpirationDateTime', /*#__PURE__*/schema.string()],
  permissions: ['Permissions', /*#__PURE__*/schema.array( /*#__PURE__*/schema.string())],
  transactionFromDateTime: ['TransactionFromDateTime', /*#__PURE__*/schema.string()]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var dataSchema = /*#__PURE__*/schema.object({
  consent: ['Consent', /*#__PURE__*/schema.lazy(function () {
    return consentSchema;
  })],
  status: ['Status', /*#__PURE__*/schema.string()],
  statusUpdateDateTime: ['StatusUpdateDateTime', /*#__PURE__*/schema.string()],
  creationDateTime: ['CreationDateTime', /*#__PURE__*/schema.string()],
  consentId: ['ConsentId', /*#__PURE__*/schema.string()]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var deliveryAddressSchema = /*#__PURE__*/schema.object({
  addressLine: ['AddressLine', /*#__PURE__*/schema.array( /*#__PURE__*/schema.string())],
  streetName: ['StreetName', /*#__PURE__*/schema.string()],
  buildingNumber: ['BuildingNumber', /*#__PURE__*/schema.string()],
  postCode: ['PostCode', /*#__PURE__*/schema.string()],
  townName: ['TownName', /*#__PURE__*/schema.string()],
  countrySubDivision: ['CountrySubDivision', /*#__PURE__*/schema.string()],
  country: ['Country', /*#__PURE__*/schema.string()]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var geoLocationSchema = /*#__PURE__*/schema.object({
  latitude: ['Latitude', /*#__PURE__*/schema.string()],
  longitude: ['Longitude', /*#__PURE__*/schema.string()]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var riskSchema = /*#__PURE__*/schema.object({
  endUserAppName: ['EndUserAppName', /*#__PURE__*/schema.string()],
  endUserAppVersion: ['EndUserAppVersion', /*#__PURE__*/schema.string()],
  paymentContextCode: ['PaymentContextCode', /*#__PURE__*/schema.string()],
  merchantName: ['MerchantName', /*#__PURE__*/schema.string()],
  merchantNZBN: ['MerchantNZBN', /*#__PURE__*/schema.string()],
  merchantCategoryCode: ['MerchantCategoryCode', /*#__PURE__*/schema.string()],
  merchantCustomerIdentification: ['MerchantCustomerIdentification', /*#__PURE__*/schema.string()],
  geoLocation: ['GeoLocation', /*#__PURE__*/schema.lazy(function () {
    return geoLocationSchema;
  })],
  deliveryAddress: ['DeliveryAddress', /*#__PURE__*/schema.lazy(function () {
    return deliveryAddressSchema;
  })]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var aC9CheckaccountaccessconsentstatusSchema = /*#__PURE__*/schema.object({
  data: ['Data', /*#__PURE__*/schema.lazy(function () {
    return dataSchema;
  })],
  risk: ['Risk', /*#__PURE__*/schema.lazy(function () {
    return riskSchema;
  })],
  links: ['Links', /*#__PURE__*/schema.lazy(function () {
    return linksSchema;
  })],
  meta: ['Meta', /*#__PURE__*/schema.unknown()]
});

var _templateObject;
var ConsentStatusController = /*#__PURE__*/function (_BaseController) {
  _inheritsLoose(ConsentStatusController, _BaseController);
  function ConsentStatusController() {
    return _BaseController.apply(this, arguments) || this;
  }
  var _proto = ConsentStatusController.prototype;
  /**
   * This request queries the most recently created account access consent whose id is specified in the
   * PNZ-T-AC-AccountAccessConsentId environment variable.
   * This step is placed here in the sequence because the status of the account-access-consents resource
   * will have changed from its original status at this point.
   *
   * Preconditions:
   *
   * *   This step relies on the presence of a PNZ-T-AC-AccountAccessToken environment variable, which is
   * set upon successful completion of Step AC1 - Initiate client credentials grant.
   * *   It also relies on the presence of a PNZ-T-AC-AccountAccessConsentId environment variable, which
   * is set upon successful completion of Step AC2 - Create account access consent.
   *
   *
   * Response:
   *
   * *   The response should be a single account-access-consent resource with the requested ConsentId.
   * *   The status of the account-access-consent is dynamic so the status 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. Complete Step AC1 - Initiate client
   * credentials grant before trying this request again.
   * *   Another likely cause is there is no PNZ-T-AC-AccountAccessConsentId environment variable.
   * Complete Step AC2 - Create account access consent before trying this request again.
   *
   * @param pNZTACAccountAccessConsentId
   * @return Response from the API call
   */
  _proto.checkAccountAccessConsentStatus =
  /*#__PURE__*/
  function () {
    var _checkAccountAccessConsentStatus = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(pNZTACAccountAccessConsentId, requestOptions) {
      var req, mapped;
      return _regeneratorRuntime().wrap(function _callee$(_context) {
        while (1) switch (_context.prev = _context.next) {
          case 0:
            req = this.createRequest('GET');
            mapped = req.prepareArgs({
              pNZTACAccountAccessConsentId: [pNZTACAccountAccessConsentId, schema.string()]
            });
            req.appendTemplatePath(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["/open-banking-nz/v2.3/account-access-consents/", ""])), mapped.pNZTACAccountAccessConsentId);
            return _context.abrupt("return", req.callAsJson(aC9CheckaccountaccessconsentstatusSchema, requestOptions));
          case 4:
          case "end":
            return _context.stop();
        }
      }, _callee, this);
    }));
    function checkAccountAccessConsentStatus(_x, _x2) {
      return _checkAccountAccessConsentStatus.apply(this, arguments);
    }
    return checkAccountAccessConsentStatus;
  }();
  return ConsentStatusController;
}(BaseController);

var RefreshTokenController = /*#__PURE__*/function (_BaseController) {
  _inheritsLoose(RefreshTokenController, _BaseController);
  function RefreshTokenController() {
    return _BaseController.apply(this, arguments) || this;
  }
  var _proto = RefreshTokenController.prototype;
  /**
   * @param clientID
   * @param privateKey
   * @param KID
   * @param refreshToken
   * @return Response from the API call
   */
  _proto.refreshAccessToken =
  /*#__PURE__*/
  function () {
    var _refreshAccessToken = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(clientID, privateKey, KID, refreshToken, requestOptions) {
      var req, grantType, scope, clientAssertionType, payload, clientAssertion, mapped;
      return _regeneratorRuntime().wrap(function _callee$(_context) {
        while (1) switch (_context.prev = _context.next) {
          case 0:
            req = this.createRequest('POST', '/oauth/v2.0/token');
            grantType = 'refresh_token';
            scope = 'openid accounts';
            clientAssertionType = 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer';
            payload = {
              sub: clientID,
              aud: "https://api-nomatls.apicentre.middleware.co.nz/oauth/v2.0/token",
              iss: clientID,
              exp: Math.floor(Date.now() / 1000) + 2000,
              iat: Math.floor(Date.now() / 1000) - 120,
              jti: uuid.v4()
            };
            clientAssertion = ClientAssertionJWT(privateKey, KID, payload);
            mapped = req.prepareArgs({
              grantType: [grantType, schema.string()],
              refreshToken: [refreshToken, schema.string()],
              scope: [scope, schema.string()],
              clientAssertionType: [clientAssertionType, schema.string()],
              clientAssertion: [clientAssertion, schema.string()]
            });
            req.header('content-type', 'application/x-www-form-urlencoded');
            req.form({
              grant_type: mapped.grantType,
              refresh_token: mapped.refreshToken,
              scope: mapped.scope,
              client_assertion_type: mapped.clientAssertionType,
              client_assertion: mapped.clientAssertion
            });
            return _context.abrupt("return", req.callAsJson(hFAC8ExchangeauthorizationcodeforaccesstokenSchema, requestOptions));
          case 10:
          case "end":
            return _context.stop();
        }
      }, _callee, this);
    }));
    function refreshAccessToken(_x, _x2, _x3, _x4, _x5) {
      return _refreshAccessToken.apply(this, arguments);
    }
    return refreshAccessToken;
  }();
  return RefreshTokenController;
}(BaseController);

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var aC1InitiateclientcredentialsgrantSchema = /*#__PURE__*/schema.object({
  tokenType: ['token_type', /*#__PURE__*/schema.string()],
  expiresIn: ['expires_in', /*#__PURE__*/schema.number()],
  accessToken: ['access_token', /*#__PURE__*/schema.string()]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var aC2CreateaccountaccessconsentSchema = /*#__PURE__*/schema.object({
  data: ['Data', /*#__PURE__*/schema.lazy(function () {
    return dataSchema;
  })],
  risk: ['Risk', /*#__PURE__*/schema.lazy(function () {
    return riskSchema;
  })],
  links: ['Links', /*#__PURE__*/schema.lazy(function () {
    return linksSchema;
  })],
  meta: ['Meta', /*#__PURE__*/schema.unknown()]
});

var SetupAccountAccessConsentsResourceController = /*#__PURE__*/function (_BaseController) {
  _inheritsLoose(SetupAccountAccessConsentsResourceController, _BaseController);
  function SetupAccountAccessConsentsResourceController() {
    return _BaseController.apply(this, arguments) || this;
  }
  var _proto = SetupAccountAccessConsentsResourceController.prototype;
  /**
   *
   * This step initiates a client credentials grant request for accounts-related activity.
   * It requires a properly registered application with valid credentials in order to access its resources.
   * Once you've registered your own Application, you will receive the ClientId, ClientSecret by setting up KeyId, PublicKey, RedirectURI
   * to reflect details for your own Application.
   * To call the method, you will need to provide the corresponding PrivateKey of the PublicKey that was entered in the application.
   *
   * @param clientID
   * @param privateKey
   * @param KID
   * @return Response from the API call
   */
  _proto.initiateClientCredentialsGrant =
  /*#__PURE__*/
  function () {
    var _initiateClientCredentialsGrant = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(clientID, privateKey, KID, requestOptions) {
      var req, contentType, grantType, clientAssertionType, scope, payload, clientAssertion, mapped;
      return _regeneratorRuntime().wrap(function _callee$(_context) {
        while (1) switch (_context.prev = _context.next) {
          case 0:
            req = this.createRequest('POST', '/oauth/v2.0/token');
            req.baseUrl('server 1');
            contentType = 'application/x-www-form-urlencoded';
            grantType = 'client_credentials';
            clientAssertionType = 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer';
            scope = 'openid accounts';
            payload = {
              sub: clientID,
              aud: 'https://api-nomatls.apicentre.middleware.co.nz/oauth/v2.0/token',
              iss: clientID,
              exp: Math.floor(Date.now() / 1000) + 3599,
              iat: Math.floor(Date.now() / 1000) - 120,
              jti: uuid.v4()
            };
            clientAssertion = ClientAssertionJWT(privateKey, KID, payload);
            mapped = req.prepareArgs({
              contentType: [contentType, contentTypeEnumSchema],
              grantType: [grantType, schema.string()],
              scope: [scope, schema.string()],
              clientAssertion: [clientAssertion, schema.string()],
              clientAssertionType: [clientAssertionType, schema.string()]
            });
            req.header('Content-Type', mapped.contentType);
            req.form({
              grant_type: mapped.grantType,
              scope: mapped.scope,
              client_assertion: mapped.clientAssertion,
              client_assertion_type: mapped.clientAssertionType
            });
            return _context.abrupt("return", req.callAsJson(aC1InitiateclientcredentialsgrantSchema, requestOptions));
          case 12:
          case "end":
            return _context.stop();
        }
      }, _callee, this);
    }));
    function initiateClientCredentialsGrant(_x, _x2, _x3, _x4) {
      return _initiateClientCredentialsGrant.apply(this, arguments);
    }
    return initiateClientCredentialsGrant;
  }()
  /**
   * This step creates an account-access-consents resource.
   *
   * Preconditions:
   * + This step relies on the presence of an AccountAccessToken variable, which is
   * set upon successful completion of Step AC1 - Initiate client credentials grant.
   *
   * Response:
   * + The response should be an account-access-consents object, with a status 'AwaitingAuthorisation'.
   *
   * Troubleshooting:
   * + The most likely cause of errors is that the step is being attempted out of sequence. Be sure to
   * follow the steps in sequence
   * + Another likely cause of errors are out of date variable values. Try starting from Step AC1 -
   * Initiate client credentials grant again.
   *
   * @param authorization
   * @return Response from the API call
   */
  ;
  _proto.createAccountAccessConsent =
  /*#__PURE__*/
  function () {
    var _createAccountAccessConsent = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(authorization, requestOptions) {
      var req, accept, date, datestring, body, mapped;
      return _regeneratorRuntime().wrap(function _callee2$(_context2) {
        while (1) switch (_context2.prev = _context2.next) {
          case 0:
            req = this.createRequest('POST', '/open-banking-nz/v2.3/account-access-consents');
            req.baseUrl('server 1');
            accept = 'application/json';
            date = new Date();
            date.setDate(date.getDate() + 2);
            datestring = '"' + date.toISOString() + '"';
            body = "{\n      \"Data\": {\n          \"Consent\": {\n              \"TransactionToDateTime\": \"2025-05-08T00:00:00-00:00\",\n              \"ExpirationDateTime\": " + datestring + ",\n              \"Permissions\": [\n                  \"ReadAccountsDetail\",\n                  \"ReadBalances\",\n                  \"ReadBeneficiariesDetail\",\n                  \"ReadDirectDebits\",\n                  \"ReadParty\",\n                  \"ReadPartyAuthUser\",\n                  \"ReadOffers\",\n                  \"ReadScheduledPaymentsDetail\",\n                  \"ReadStandingOrdersDetail\",\n                  \"ReadStatementsBasic\",\n                  \"ReadStatementsDetail\",\n                  \"ReadTransactionsDetail\",\n                  \"ReadTransactionsCredits\",\n                  \"ReadTransactionsDebits\"\n              ],\n              \"TransactionFromDateTime\": \"2012-05-03T00:00:00-00:00\"\n          }\n      },\n      \"Risk\": {\n          \"EndUserAppName\": \"This is an app name that is long\",\n          \"EndUserAppVersion\": \"App Version3.0\",\n          \"PaymentContextCode\": \"EcommerceServices\",\n          \"MerchantName\": \"This is a merchant name that is long\",\n          \"MerchantNZBN\": \"This is an NZBN number\",\n          \"MerchantCategoryCode\": \"5967\",\n          \"MerchantCustomerIdentification\": \"This is a special customer identifier\",\n          \"GeoLocation\": {\n              \"Latitude\": \"45.516136\",\n              \"Longitude\": \"-73.656830\"\n          },\n          \"DeliveryAddress\": {\n              \"AddressLine\": [\n                  \"This is address line 1\"\n              ],\n              \"StreetName\": \"Main Street\",\n              \"BuildingNumber\": \"12345\",\n              \"PostCode\": \"12345\",\n              \"TownName\": \"Some Town\",\n              \"CountrySubDivision\": \"Some Subdivision\",\n              \"Country\": \"CA\"\n          }\n      }\n  }";
            mapped = req.prepareArgs({
              accept: [accept, schema.string()],
              body: [body, schema.string()],
              authorization: [authorization, schema.string()]
            });
            req.header('Accept', mapped.accept);
            req.header('Content-Type', 'application/json');
            req.header('authorization', mapped.authorization);
            req.text(mapped.body);
            return _context2.abrupt("return", req.callAsJson(aC2CreateaccountaccessconsentSchema, requestOptions));
          case 13:
          case "end":
            return _context2.stop();
        }
      }, _callee2, this);
    }));
    function createAccountAccessConsent(_x5, _x6) {
      return _createAccountAccessConsent.apply(this, arguments);
    }
    return createAccountAccessConsent;
  }();
  return SetupAccountAccessConsentsResourceController;
}(BaseController);

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var aC1110RetrieveaccountstatementsSchema = /*#__PURE__*/schema.object({
  data: ['Data', /*#__PURE__*/schema.lazy(function () {
    return data10Schema;
  })],
  links: ['Links', /*#__PURE__*/schema.lazy(function () {
    return linksSchema;
  })],
  meta: ['Meta', /*#__PURE__*/schema.lazy(function () {
    return metaSchema;
  })]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var data12Schema = /*#__PURE__*/schema.object({
  account: ['Account', /*#__PURE__*/schema.lazy(function () {
    return accountSchema;
  })]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var aC111RetrieveanaccountSchema = /*#__PURE__*/schema.object({
  data: ['Data', /*#__PURE__*/schema.lazy(function () {
    return data12Schema;
  })],
  links: ['Links', /*#__PURE__*/schema.lazy(function () {
    return linksSchema;
  })],
  meta: ['Meta', /*#__PURE__*/schema.unknown()]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var aC112RetrieveaccountbalanceSchema = /*#__PURE__*/schema.object({
  data: ['Data', /*#__PURE__*/schema.lazy(function () {
    return data3Schema;
  })],
  links: ['Links', /*#__PURE__*/schema.lazy(function () {
    return linksSchema;
  })],
  meta: ['Meta', /*#__PURE__*/schema.lazy(function () {
    return metaSchema;
  })]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var aC113RetrieveaccountbeneficiariesSchema = /*#__PURE__*/schema.object({
  data: ['Data', /*#__PURE__*/schema.lazy(function () {
    return data4Schema;
  })],
  links: ['Links', /*#__PURE__*/schema.lazy(function () {
    return linksSchema;
  })],
  meta: ['Meta', /*#__PURE__*/schema.lazy(function () {
    return metaSchema;
  })]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var aC114RetrieveaccountdirectdebitsSchema = /*#__PURE__*/schema.object({
  data: ['Data', /*#__PURE__*/schema.lazy(function () {
    return data5Schema;
  })],
  links: ['Links', /*#__PURE__*/schema.lazy(function () {
    return linksSchema;
  })],
  meta: ['Meta', /*#__PURE__*/schema.lazy(function () {
    return metaSchema;
  })]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var aC115RetrieveaccountoffersSchema = /*#__PURE__*/schema.object({
  data: ['Data', /*#__PURE__*/schema.lazy(function () {
    return data6Schema;
  })],
  links: ['Links', /*#__PURE__*/schema.lazy(function () {
    return linksSchema;
  })],
  meta: ['Meta', /*#__PURE__*/schema.lazy(function () {
    return metaSchema;
  })]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var aC116RetrieveaccountpartySchema = /*#__PURE__*/schema.object({
  data: ['Data', /*#__PURE__*/schema.lazy(function () {
    return data7Schema;
  })],
  meta: ['Meta', /*#__PURE__*/schema.unknown()],
  links: ['Links', /*#__PURE__*/schema.lazy(function () {
    return linksSchema;
  })]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var aC117RetrieveaccountscheduledpaymentsSchema = /*#__PURE__*/schema.object({
  data: ['Data', /*#__PURE__*/schema.lazy(function () {
    return data8Schema;
  })],
  links: ['Links', /*#__PURE__*/schema.lazy(function () {
    return linksSchema;
  })],
  meta: ['Meta', /*#__PURE__*/schema.lazy(function () {
    return metaSchema;
  })]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var aC118RetrieveaccountstandingordersSchema = /*#__PURE__*/schema.object({
  data: ['Data', /*#__PURE__*/schema.lazy(function () {
    return data9Schema;
  })],
  links: ['Links', /*#__PURE__*/schema.lazy(function () {
    return linksSchema;
  })],
  meta: ['Meta', /*#__PURE__*/schema.lazy(function () {
    return metaSchema;
  })]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var aC119RetrieveaccounttransactionsSchema = /*#__PURE__*/schema.object({
  data: ['Data', /*#__PURE__*/schema.lazy(function () {
    return data11Schema;
  })],
  links: ['Links', /*#__PURE__*/schema.lazy(function () {
    return linksSchema;
  })],
  meta: ['Meta', /*#__PURE__*/schema.lazy(function () {
    return metaSchema;
  })]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var data22Schema = /*#__PURE__*/schema.object({
  statement: ['Statement', /*#__PURE__*/schema.lazy(function () {
    return statementSchema;
  })]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var aC121RetrieveastatementSchema = /*#__PURE__*/schema.object({
  data: ['Data', /*#__PURE__*/schema.lazy(function () {
    return data22Schema;
  })],
  links: ['Links', /*#__PURE__*/schema.lazy(function () {
    return linksSchema;
  })],
  meta: ['Meta', /*#__PURE__*/schema.unknown()]
});

/**
 * Account information PNZ-API-CentreLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
var aC123RetrievetransactionsforaspecificstatementSchema = /*#__PURE__*/schema.object({
  data: ['Data', /*#__PURE__*/schema.lazy(function () {
    return data11Schema;
  })],
  links: ['Links', /*#__PURE__*/schema.lazy(function () {
    return linksSchema;
  })],
  meta: ['Meta', /*#__PURE__*/schema.lazy(function () {
    return metaSchema;
  })]
});

var _templateObject$1, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13;
var SpecificAccountEndpointsController = /*#__PURE__*/function (_BaseController) {
  _inheritsLoose(SpecificAccountEndpointsController, _BaseController);
  function SpecificAccountEndpointsController() {
    return _BaseController.apply(this, arguments) || this;
  }
  var _proto = SpecificAccountEndpointsController.prototype;
  /**
   * This request queries the account whose id is specified in the PNZ-T-AC-AccountId environment
   * variable.
   *
   * 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.
   * *   This step also relies on the PNZ-T-AC-AccountId environment variable, which is set from Step
   * AC10.1 - Retrieve consented account information.
   *
   *
   * Response:
   *
   * *   The response should be a single account resource, whose id is PNZ-T-AC-AccountId.
   * *   The balance of the accounts resource 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 that Step AC10.1 has not been completed prior to making this
   * request. Complete Step AC10.1 - Retrieve consented account information before trying again.
   * *   Another likely cause of errors is an expired access token. Try starting from Step AC1 - Initiate
   * client credentials grant again.
   *
   * @param pNZTACAccountId
   * @param authorization
   * @return Response from the API call
   */
  _proto.retrieveAnAccount =
  /*#__PURE__*/
  function () {
    var _retrieveAnAccount = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(pNZTACAccountId, authorization, requestOptions) {
      var req, mapped;
      return _regeneratorRuntime().wrap(function _callee$(_context) {
        while (1) switch (_context.prev = _context.next) {
          case 0:
            req = this.createRequest('GET');
            mapped = req.prepareArgs({
              pNZTACAccountId: [pNZTACAccountId, schema.string()],
              authorization: [authorization, schema.string()]
            });
            req.header('Authorization', mapped.authorization);
            req.appendTemplatePath(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteralLoose(["/open-banking-nz/v2.3/accounts/", ""])), mapped.pNZTACAccountId);
            return _context.abrupt("return", req.callAsJson(aC111RetrieveanaccountSchema, requestOptions));
          case 5:
          case "end":
            return _context.stop();
        }
      }, _callee, this);
    }));
    function retrieveAnAccount(_x, _x2, _x3) {
      return _retrieveAnAccount.apply(this, arguments);
    }
    return retrieveAnAccount;
  }()
  /**
   * This request queries the account whose id is specified in the PNZ-T-AC-AccountId environment
   * variable.
   *
   * 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.
   * *   This step also relies on the PNZ-T-AC-AccountId environment variable, which is set from Step
   * AC10.1 - Retrieve consented account information
   *
   *
   * Response:
   *
   * *   The response should be a single balance resource for the account whose id is PNZ-T-AC-AccountId.
   * *   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 that Step AC10.1 has not been completed prior to making this
   * request. Complete Step AC10.1 - Retrieve consented account information before trying again.
   * *   Another likely cause of errors is an expired access token. Try starting from Step AC1 - Initiate
   * client credentials grant again.
   *
   * @param pNZTACAccountId
   * @param authorization
   * @return Response from the API call
   */
  ;
  _proto.retrieveAccountBalance =
  /*#__PURE__*/
  function () {
    var _retrieveAccountBalance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(pNZTACAccountId, authorization, requestOptions) {
      var req, mapped;
      return _regeneratorRuntime().wrap(function _callee2$(_context2) {
        while (1) switch (_context2.prev = _context2.next) {
          case 0:
            req = this.createRequest('GET');
            mapped = req.prepareArgs({
              pNZTACAccountId: [pNZTACAccountId, schema.string()],
              authorization: [authorization, schema.string()]
            });
            req.header('Authorization', mapped.authorization);
            req.appendTemplatePath(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["/open-banking-nz/v2.3/accounts/", "/balances"])), mapped.pNZTACAccountId);
            return _context2.abrupt("return", req.callAsJson(aC112RetrieveaccountbalanceSchema, requestOptions));
          case 5:
          case "end":
            return _context2.stop();
        }
      }, _callee2, this);
    }));
    function retrieveAccountBalance(_x4, _x5, _x6) {
      return _retrieveAccountBalance.apply(this, arguments);
    }
    return retrieveAccountBalance;
  }()
  /**
   * This request queries the account whose id is specified in the PNZ-T-AC-AccountId environment
   * variable.
   *
   * 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.
   * *   This step also relies on the PNZ-T-AC-AccountId environment variable, which is set from Step
   * AC10.1 - Retrieve consented account information
   *
   *
   * Response:
   *
   * *   The response should be a collection of beneficiary resources for the account whose id is PNZ-T-
   * AC-AccountId.
   *
   *
   * Postconditions:
   *
   * *   None
   *
   *
   * Examples:
   *
   * *   There is one example which shows the request and the expected response.
   *
   *
   * Troubleshooting:
   *
   * *   The most likely cause of errors is that Step AC10.1 has not been completed prior to making this
   * request. Complete Step AC10.1 - Retrieve consented account information before trying again.
   * *   Another likely cause of errors is an expired access token. Try starting from Step AC1 - Initiate
   * client credentials grant again.
   *
   * @param pNZTACAccountId
   * @param authorization
   * @return Response from the API call
   */
  ;
  _proto.retrieveAccountBeneficiaries =
  /*#__PURE__*/
  function () {
    var _retrieveAccountBeneficiaries = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(pNZTACAccountId, authorization, requestOptions) {
      var req, mapped;
      return _regeneratorRuntime().wrap(function _callee3$(_context3) {
        while (1) switch (_context3.prev = _context3.next) {
          case 0:
            req = this.createRequest('GET');
            mapped = req.prepareArgs({
              pNZTACAccountId: [pNZTACAccountId, schema.string()],
              authorization: [authorization, schema.string()]
            });
            req.header('Authorization', mapped.authorization);
            req.appendTemplatePath(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["/open-banking-nz/v2.3/accounts/", "/beneficiaries"])), mapped.pNZTACAccountId);
            return _context3.abrupt("return", req.callAsJson(aC113RetrieveaccountbeneficiariesSchema, requestOptions));
          case 5:
          case "end":
            return _context3.stop();
        }
      }, _callee3, this);
    }));
    function retrieveAccountBeneficiaries(_x7, _x8, _x9) {
      return _retrieveAccountBeneficiaries.apply(this, arguments);
    }
    return retrieveAccountBeneficiaries;
  }()
  /**
   * This request queries the account whose id is specified in the PNZ-T-AC-AccountId environment
   * variable.
   *
   * 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.
   * *   This step also relies on the PNZ-T-AC-AccountId environment variable, which is set from Step
   * AC10.1 - Retrieve consented account information
   *
   *
   * Response:
   *
   * *   The response should be a collection of direct-debit resources for the account whose id is PNZ-T-
   * AC-AccountId.
   *
   *
   * Postconditions:
   *
   * *   None
   *
   *
   * Examples:
   *
   * *   There is one example which shows the request and the expected response.
   *
   *
   * Troubleshooting:
   *
   * *   The most likely cause of errors is that Step AC10.1 has not been completed prior to making this
   * request. Complete Step AC10.1 - Retrieve consented account information before trying again.
   * *   Another likely cause of errors is an expired access token. Try starting from Step AC1 - Initiate
   * client credentials grant again.
   *
   * @param pNZTACAccountId
   * @param authorization
   * @return Response from the API call
   */
  ;
  _proto.retrieveAccountDirectDebits =
  /*#__PURE__*/
  function () {
    var _retrieveAccountDirectDebits = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(pNZTACAccountId, authorization, requestOptions) {
      var req, mapped;
      return _regeneratorRuntime().wrap(function _callee4$(_context4) {
        while (1) switch (_context4.prev = _context4.next) {
          case 0:
            req = this.createRequest('GET');
            mapped = req.prepareArgs({
              pNZTACAccountId: [pNZTACAccountId, schema.string()],
              authorization: [authorization, schema.string()]
            });
            req.header('Authorization', mapped.authorization);
            req.appendTemplatePath(_templateObject4 || (_templateObject4 = _taggedTemplateLiteralLoose(["/open-banking-nz/v2.3/accounts/", "/direct-debits"])), mapped.pNZTACAccountId);
            return _context4.abrupt("return", req.callAsJson(aC114RetrieveaccountdirectdebitsSchema, requestOptions));
          case 5:
          case "end":
            return _context4.stop();
        }
      }, _callee4, this);
    }));
    function retrieveAccountDirectDebits(_x10, _x11, _x12) {
      return _retrieveAccountDirectDebits.apply(this, arguments);
    }
    return retrieveAccountDirectDebits;
  }()
  /**
   * This request queries the account whose id is specified in the PNZ-T-AC-AccountId environment
   * variable.
   *
   * 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.
   * *   This step also relies on the PNZ-T-AC-AccountId environment variable, which is set from Step
   * AC10.1 - Retrieve consented account information
   *
   *
   * Response:
   *
   * *   The response should be a collection of offer resources for the account whose id is PNZ-T-AC-
   * AccountId.
   *
   *
   * Postconditions:
   *
   * *   None
   *
   *
   * Examples:
   *
   * *   There is one example which shows the request and the expected response.
   *
   *
   * Troubleshooting:
   *
   * *   The most likely cause of errors is that Step AC10.1 has not been completed prior to making this
   * request. Complete Step AC10.1 - Retrieve consented account information before trying again.
   * *   Another likely cause of errors is an expired access token. Try starting from Step AC1 - Initiate
   * client credentials grant again.
   *
   * @param pNZTACAccountId
   * @param authorization
   * @return Response from the API call
   */
  ;
  _proto.retrieveAccountOffers =
  /*#__PURE__*/
  function () {
    var _retrieveAccountOffers = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(pNZTACAccountId, authorization, requestOptions) {
      var req, mapped;
      return _regeneratorRuntime().wrap(function _callee5$(_context5) {
        while (1) switch (_context5.prev = _context5.next) {
          case 0:
            req = this.createRequest('GET');
            mapped = req.prepareArgs({
              pNZTACAccountId: [pNZTACAccountId, schema.string()],
              authorization: [authorization, schema.string()]
            });
            req.header('Authorization', mapped.authorization);
            req.appendTemplatePath(_templateObject5 || (_templateObject5 = _taggedTemplateLiteralLoose(["/open-banking-nz/v2.3/accounts/", "/offers"])), mapped.pNZTACAccountId);
            return _context5.abrupt("return", req.callAsJson(aC115RetrieveaccountoffersSchema, requestOptions));
          case 5:
          case "end":
            return _context5.stop();
        }
      }, _callee5, this);
    }));
    function retrieveAccountOffers(_x13, _x14, _x15) {
      return _retrieveAccountOffers.apply(this, arguments);
    }
    return retrieveAccountOffers;
  }()
  /**
   * This request queries the account whose id is specified in the PNZ-T-AC-AccountId environment
   * variable.
   *
   * 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.
   * *   This step also relies on the PNZ-T-AC-AccountId environment variable, which is set from Step
   * AC10.1 - Retrieve consented account information
   *
   *
   * Response:
   *
   * *   The response should be a single party resource for the owner of the account whose id is PNZ-T-AC-
   * AccountId.
   *
   *
   * Postconditions:
   *
   * *   None
   *
   *
   * Examples:
   *
   * *   There is one example which shows the request and the expected response.
   *
   *
   * Troubleshooting:
   *
   * *   The most likely cause of errors is that Step AC10.1 has not been completed prior to making this
   * request. Complete Step AC10.1 - Retrieve consented account information before trying again.
   * *   Another likely cause of errors is an expired access token. Try starting from Step AC1 - Initiate
   * client credentials grant again.
   *
   * @param pNZTACAccountId
   * @param authorization
   * @return Response from the API call
   */
  ;
  _proto.retrieveAccountParty =
  /*#__PURE__*/
  function () {
    var _retrieveAccountParty = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(pNZTACAccountId, authorization, requestOptions) {
      var req, mapped;
      return _regeneratorRuntime().wrap(function _callee6$(_context6) {
        while (1) switch (_context6.prev = _context6.next) {
          case 0:
            req = this.createRequest('GET');
            mapped = req.prepareArgs({
              pNZTACAccountId: [pNZTACAccountId, schema.string()],
              authorization: [authorization, schema.string()]
            });
            req.header('Authorization', mapped.authorization);
            req.appendTemplatePath(_templateObject6 || (_templateObject6 = _taggedTemplateLiteralLoose(["/open-banking-nz/v2.3/accounts/", "/party"])), mapped.pNZTACAccountId);
            return _context6.abrupt("return", req.callAsJson(aC116RetrieveaccountpartySchema, requestOptions));
          case 5:
          case "end":
            return _context6.stop();
        }
      }, _callee6, this);
    }));
    function retrieveAccountParty(_x16, _x17, _x18) {
      return _retrieveAccountParty.apply(this, arguments);
    }
    return retrieveAccountParty;
  }()
  /**
   * This request queries the account whose id is specified in the PNZ-T-AC-AccountId environment
   * variable.
   *
   * 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.
   * *   This step also relies on the PNZ-T-AC-AccountId environment variable, which is set from Step
   * AC10.1 - Retrieve consented account information
   *
   *
   * Response:
   *
   * *   The response should be a collection of scheduled-payment resources for the account whose id is
   * PNZ-T-AC-AccountId.
   *
   *
   * Postconditions:
   *
   * *   None
   *
   *
   * Examples:
   *
   * *   There is one example which shows the request and the expected response.
   *
   *
   * Troubleshooting:
   *
   * *   The most likely cause of errors is that Step AC10.1 has not been completed prior to making this
   * request. Complete Step AC10.1 - Retrieve consented account information before trying again.
   * *   Another likely cause of errors is an expired access token. Try starting from Step AC1 - Initiate
   * client credentials grant again.
   *
   * @param pNZTACAccountId
   * @param authorization
   * @return Response from the API call
   */
  ;
  _proto.retrieveAccountScheduledPayments =
  /*#__PURE__*/
  function () {
    var _retrieveAccountScheduledPayments = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(pNZTACAccountId, authorization, requestOptions) {
      var req, mapped;
      return _regeneratorRuntime().wrap(function _callee7$(_context7) {
        while (1) switch (_context7.prev = _context7.next) {
          case 0:
            req = this.createRequest('GET');
            mapped = req.prepareArgs({
              pNZTACAccountId: [pNZTACAccountId, schema.string()],
              authorization: [authorization, schema.string()]
            });
            req.header('Authorization', mapped.authorization);
            req.appendTemplatePath(_templateObject7 || (_templateObject7 = _taggedTemplateLiteralLoose(["/open-banking-nz/v2.3/accounts/", "/scheduled-payments"])), mapped.pNZTACAccountId);
            return _context7.abrupt("return", req.callAsJson(aC117RetrieveaccountscheduledpaymentsSchema, requestOptions));
          case 5:
          case "end":
            return _context7.stop();
        }
      }, _callee7, this);
    }));
    function retrieveAccountScheduledPayments(_x19, _x20, _x21) {
      return _retrieveAccountScheduledPayments.apply(this, arguments);
    }
    return retrieveAccountScheduledPayments;
  }()
  /**
   * This request queries the account whose id is specified in the PNZ-T-AC-AccountId environment
   * variable.
   *
   * 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.
   * *   This step also relies on the PNZ-T-AC-AccountId environment variable, which is set from Step
   * AC10.1 - Retrieve consented account information
   *
   *
   * Response:
   *
   * *   The response should be a collection of standing-order resources for the account whose id is PNZ-
   * T-AC-AccountId.
   *
   *
   * Postconditions:
   *
   * *   None
   *
   *
   * Examples:
   *
   * *   There is one example which shows the request and the expected response.
   *
   *
   * Troubleshooting:
   *
   * *   The most likely cause of errors is that Step AC10.1 has not been completed prior to making this
   * request. Complete Step AC10.1 - Retrieve consented account information before trying again.
   * *   Another likely cause of errors is an expired access token. Try starting from Step AC1 - Initiate
   * client credentials grant again.
   *
   * @param pNZTACAccountId
   * @param authorization
   * @return Response from the API call
   */
  ;
  _proto.retrieveAccountStandingOrders =
  /*#__PURE__*/
  function () {
    var _retrieveAccountStandingOrders = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(pNZTACAccountId, authorization, requestOptions) {
      var req, mapped;
      return _regeneratorRuntime().wrap(function _callee8$(_context8) {
        while (1) switch (_context8.prev = _context8.next) {
          case 0:
            req = this.createRequest('GET');
            mapped = req.prepareArgs({
              pNZTACAccountId: [pNZTACAccountId, schema.string()],
              authorization: [authorization, schema.string()]
            });
            req.header('Authorization', mapped.authorization);
            req.appendTemplatePath(_templateObject8 || (_templateObject8 = _taggedTemplateLiteralLoose(["/open-banking-nz/v2.3/accounts/", "/standing-orders"])), mapped.pNZTACAccountId);
            return _context8.abrupt("return", req.callAsJson(aC118RetrieveaccountstandingordersSchema, requestOptions));
          case 5:
          case "end":
            return _context8.stop();
        }
      }, _callee8, this);
    }));
    function retrieveAccountStandingOrders(_x22, _x23, _x24) {
      return _retrieveAccountStandingOrders.apply(this, arguments);
    }
    return retrieveAccountStandingOrders;
  }()
  /**
   * This request queries the account whose id is specified in the PNZ-T-AC-AccountId environment
   * variable.
   *
   * 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.
   * *   This step also relies on the PNZ-T-AC-AccountId environment variable, which is set from Step
   * AC10.1 - Retrieve consented account information
   *
   *
   * Response:
   *
   * *   The response should be a collection of transaction resources for the account whose id is PNZ-T-
   * AC-AccountId.
   *
   *
   * Postconditions:
   *
   * *   None
   *
   *
   * Examples:
   *
   * *   There is one example which shows the request and the expected response.
   *
   *
   * Troubleshooting:
   *
   * *   The most likely cause of errors is that Step AC10.1 has not been completed prior to making this
   * request. Complete Step AC10.1 - Retrieve consented account information before trying again.
   * *   Another likely cause of errors is an expired access token. Try starting from Step AC1 - Initiate
   * client credentials grant again.
   *
   * @param pNZTACAccountId
   * @param authorization
   * @return Response from the API call
   */
  ;
  _proto.retrieveAccountTransactions =
  /*#__PURE__*/
  function () {
    var _retrieveAccountTransactions = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(pNZTACAccountId, authorization, requestOptions) {
      var req, mapped;
      return _regeneratorRuntime().wrap(function _callee9$(_context9) {
        while (1) switch (_context9.prev = _context9.next) {
          case 0:
            req = this.createRequest('GET');
            mapped = req.prepareArgs({
              pNZTACAccountId: [pNZTACAccountId, schema.string()],
              authorization: [authorization, schema.string()]
            });
            req.header('Authorization', mapped.authorization);
            req.appendTemplatePath(_templateObject9 || (_templateObject9 = _taggedTemplateLiteralLoose(["/open-banking-nz/v2.3/accounts/", "/transactions"])), mapped.pNZTACAccountId);
            return _context9.abrupt("return", req.callAsJson(aC119RetrieveaccounttransactionsSchema, requestOptions));
          case 5:
          case "end":
            return _context9.stop();
        }
      }, _callee9, this);
    }));
    function retrieveAccountTransactions(_x25, _x26, _x27) {
      return _retrieveAccountTransactions.apply(this, arguments);
    }
    return retrieveAccountTransactions;
  }()
  /**
   * This request queries the account whose id is specified in the PNZ-T-AC-AccountId environment
   * variable.
   *
   * 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.
   * *   This step also relies on the PNZ-T-AC-AccountId environment variable, which is set from Step
   * AC10.1 - Retrieve consented account information
   *
   *
   * Response:
   *
   * *   The response should be a collection of statement resources for the account whose id is PNZ-T-AC-
   * AccountId.
   *
   *
   * Postconditions:
   *
   * *   The StatementId for the first statement in the collection is saved in the PNZ-T-AC-StatementId
   * environment variable in preparation for subsequent statement-related steps, such as Step AC12.1 -
   * Retrieve a statement
   *
   *
   * Examples:
   *
   * *   There is one example which shows the request and the expected response.
   *
   *
   * Troubleshooting:
   *
   * *   The most likely cause of errors is that Step AC10.1 has not been completed prior to making this
   * request. Complete Step AC10.1 - Retrieve consented account information before trying again.
   * *   Another likely cause of errors is an expired access token. Try starting from Step AC1 - Initiate
   * client credentials grant again.
   *
   * @param pNZTACAccountId
   * @param authorization
   * @return Response from the API call
   */
  ;
  _proto.retrieveAccountStatements =
  /*#__PURE__*/
  function () {
    var _retrieveAccountStatements = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(pNZTACAccountId, authorization, requestOptions) {
      var req, mapped;
      return _regeneratorRuntime().wrap(function _callee10$(_context10) {
        while (1) switch (_context10.prev = _context10.next) {
          case 0:
            req = this.createRequest('GET');
            mapped = req.prepareArgs({
              pNZTACAccountId: [pNZTACAccountId, schema.string()],
              authorization: [authorization, schema.string()]
            });
            req.header('Authorization', mapped.authorization);
            req.appendTemplatePath(_templateObject10 || (_templateObject10 = _taggedTemplateLiteralLoose(["/open-banking-nz/v2.3/accounts/", "/statements"])), mapped.pNZTACAccountId);
            return _context10.abrupt("return", req.callAsJson(aC1110RetrieveaccountstatementsSchema, requestOptions));
          case 5:
          case "end":
            return _context10.stop();
        }
      }, _callee10, this);
    }));
    function retrieveAccountStatements(_x28, _x29, _x30) {
      return _retrieveAccountStatements.apply(this, arguments);
    }
    return retrieveAccountStatements;
  }()
  /**
   * This request queries the statement whose id is specified in the PNZ-T-AC-StatementId environment
   * variable.
   *
   * 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.
   * *   This step also relies on the PNZ-T-AC-AccountId environment variable, which is set from Step
   * AC10.1 - Retrieve consented account information
   * *   This step also relies on the PNZ-T-AC-StatementId environment variable, which is set from Step
   * AC11.10 - Retrieve account statements
   *
   *
   * Response:
   *
   * *   The response should be a single statement resource whose id is PNZ-T-AC-StatementId for the
   * account whose id is PNZ-T-AC-AccountId.
   *
   *
   * Postconditions:
   *
   * *   None
   *
   *
   * Examples:
   *
   * *   There is one example which shows the request and the expected response.
   *
   *
   * Troubleshooting:
   *
   * *   The most likely cause of errors is that Step AC11.10 - Retrieve account statements has not been
   * completed prior to making this request. Complete Step AC11.10 - Retrieve account statements before
   * trying again.
   * *   Another likely cause of errors is an expired access token. Try starting from Step AC1 - Initiate
   * client credentials grant again.
   *
   * @param pNZTACAccountId
   * @param pNZTACStatementId
   * @param authorization
   * @return Response from the API call
   */
  ;
  _proto.retrieveStatement =
  /*#__PURE__*/
  function () {
    var _retrieveStatement = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(pNZTACAccountId, pNZTACStatementId, authorization, requestOptions) {
      var req, mapped;
      return _regeneratorRuntime().wrap(function _callee11$(_context11) {
        while (1) switch (_context11.prev = _context11.next) {
          case 0:
            req = this.createRequest('GET');
            mapped = req.prepareArgs({
              pNZTACAccountId: [pNZTACAccountId, schema.string()],
              pNZTACStatementId: [pNZTACStatementId, schema.string()],
              authorization: [authorization, schema.string()]
            });
            req.header('Authorization', mapped.authorization);
            req.appendTemplatePath(_templateObject11 || (_templateObject11 = _taggedTemplateLiteralLoose(["/open-banking-nz/v2.3/accounts/", "/statements/", ""])), mapped.pNZTACAccountId, mapped.pNZTACStatementId);
            return _context11.abrupt("return", req.callAsJson(aC121RetrieveastatementSchema, requestOptions));
          case 5:
          case "end":
            return _context11.stop();
        }
      }, _callee11, this);
    }));
    function retrieveStatement(_x31, _x32, _x33, _x34) {
      return _retrieveStatement.apply(this, arguments);
    }
    return retrieveStatement;
  }()
  /**
   * This request queries the statement whose id is specified in the PNZ-T-AC-StatementId environment
   * variable.
   *
   * 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.
   * *   This step also relies on the PNZ-T-AC-AccountId environment variable, which is set from Step
   * AC10.1 - Retrieve consented account information
   * *   This step also relies on the PNZ-T-AC-StatementId environment variable, which is set from Step
   * AC11.10 - Retrieve account statements
   *
   *
   * Response:
   *
   * *   The response should be a single statement resource whose id is PNZ-T-AC-StatementId for the
   * account whose id is PNZ-T-AC-AccountId.
   *
   *
   * Postconditions:
   *
   * *   None
   *
   *
   * Examples:
   *
   * *   There is one example which shows the request and the expected response.
   *
   *
   * Troubleshooting:
   *
   * *   The most likely cause of errors is that Step AC11.10 - Retrieve account statements has not been
   * completed prior to making this request. Complete Step AC11.10 - Retrieve account statements before
   * trying again.
   * *   Another likely cause of errors is an expired access token. Try starting from Step AC1 - Initiate
   * client credentials grant again.
   *
   * @param accept
   * @param pNZTACAccountId
   * @param pNZTACStatementId
   * @param authorization
   * @return Response from the API call
   */
  ;
  _proto.retrieveStatementFile =
  /*#__PURE__*/
  function () {
    var _retrieveStatementFile = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(accept, pNZTACAccountId, pNZTACStatementId, authorization, requestOptions) {
      var req, mapped;
      return _regeneratorRuntime().wrap(function _callee12$(_context12) {
        while (1) switch (_context12.prev = _context12.next) {
          case 0:
            req = this.createRequest('GET');
            mapped = req.prepareArgs({
              accept: [accept, schema.string()],
              pNZTACAccountId: [pNZTACAccountId, schema.string()],
              pNZTACStatementId: [pNZTACStatementId, schema.string()],
              authorization: [authorization, schema.string()]
            });
            req.header('Accept', mapped.accept);
            req.header('Authorization', mapped.authorization);
            req.appendTemplatePath(_templateObject12 || (_templateObject12 = _taggedTemplateLiteralLoose(["/open-banking-nz/v2.3/accounts/", "/statements/", "/file"])), mapped.pNZTACAccountId, mapped.pNZTACStatementId);
            return _context12.abrupt("return", req.callAsText(requestOptions));
          case 6:
          case "end":
            return _context12.stop();
        }
      }, _callee12, this);
    }));
    function retrieveStatementFile(_x35, _x36, _x37, _x38, _x39) {
      return _retrieveStatementFile.apply(this, arguments);
    }
    return retrieveStatementFile;
  }()
  /**
   * This request queries the statement whose id is specified in the PNZ-T-AC-StatementId environment
   * variable.
   *
   * 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.
   * *   This step also relies on the PNZ-T-AC-AccountId environment variable, which is set from Step
   * AC10.1 - Retrieve consented account information
   * *   This step also relies on the PNZ-T-AC-StatementId environment variable, which is set from Step
   * AC11.10 - Retrieve account statements
   *
   *
   * Response:
   *
   * *   The response should be a collection of transaction resources for the statement whose id is PNZ-T-
   * AC-StatementId for the account whose id is PNZ-T-AC-AccountId.
   *
   *
   * Postconditions:
   *
   * *   None
   *
   *
   * Examples:
   *
   * *   There is one example which shows the request and the expected response.
   *
   *
   * Troubleshooting:
   *
   * *   The most likely cause of errors is that Step AC11.10 - Retrieve account statements has not been
   * completed prior to making this request. Complete Step AC11.10 - Retrieve account statements before
   * trying again.
   * *   Another likely cause of errors is an expired access token. Try starting from Step AC1 - Initiate
   * client credentials grant again.
   *
   * @param pNZTACAccountId
   * @param pNZTACStatementId
   * @param authorization
   * @return Response from the API call
   */
  ;
  _proto.retrieveTransactionsForSpecificStatement =
  /*#__PURE__*/
  function () {
    var _retrieveTransactionsForSpecificStatement = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(pNZTACAccountId, pNZTACStatementId, authorization, requestOptions) {
      var req, mapped;
      return _regeneratorRuntime().wrap(function _callee13$(_context13) {
        while (1) switch (_context13.prev = _context13.next) {
          case 0:
            req = this.createRequest('GET');
            mapped = req.prepareArgs({
              pNZTACAccountId: [pNZTACAccountId, schema.string()],
              pNZTACStatementId: [pNZTACStatementId, schema.string()],
              authorization: [authorization, schema.string()]
            });
            req.header('Authorization', mapped.authorization);
            req.appendTemplatePath(_templateObject13 || (_templateObject13 = _taggedTemplateLiteralLoose(["/open-banking-nz/v2.3/accounts/", "/statements/", "/transactions"])), mapped.pNZTACAccountId, mapped.pNZTACStatementId);
            return _context13.abrupt("return", req.callAsJson(aC123RetrievetransactionsforaspecificstatementSchema, requestOptions));
          case 5:
          case "end":
            return _context13.stop();
        }
      }, _callee13, this);
    }));
    function retrieveTransactionsForSpecificStatement(_x40, _x41, _x42, _x43) {
      return _retrieveTransactionsForSpecificStatement.apply(this, arguments);
    }
    return retrieveTransactionsForSpecificStatement;
  }();
  return SpecificAccountEndpointsController;
}(BaseController);

Object.defineProperty(exports, 'AbortError', {
  enumerable: true,
  get: function () {
    return core.AbortError;
  }
});
Object.defineProperty(exports, 'ApiError', {
  enumerable: true,
  get: function () {
    return core.ApiError;
  }
});
Object.defineProperty(exports, 'ArgumentsValidationError', {
  enumerable: true,
  get: function () {
    return core.ArgumentsValidationError;
  }
});
Object.defineProperty(exports, 'FileWrapper', {
  enumerable: true,
  get: function () {
    return core.FileWrapper;
  }
});
Object.defineProperty(exports, 'ResponseValidationError', {
  enumerable: true,
  get: function () {
    return core.ResponseValidationError;
  }
});
Object.defineProperty(exports, 'cloneFileWrapper', {
  enumerable: true,
  get: function () {
    return core.cloneFileWrapper;
  }
});
Object.defineProperty(exports, 'isFileWrapper', {
  enumerable: true,
  get: function () {
    return core.isFileWrapper;
  }
});
exports.AuthorizeConsentController = AuthorizeConsentController;
exports.BulkEndpointsController = BulkEndpointsController;
exports.Client = Client;
exports.ClientAssertionJWT = ClientAssertionJWT;
exports.ConsentStatusController = ConsentStatusController;
exports.DEFAULT_CONFIGURATION = DEFAULT_CONFIGURATION;
exports.DEFAULT_RETRY_CONFIG = DEFAULT_RETRY_CONFIG;
exports.RefreshTokenController = RefreshTokenController;
exports.SetupAccountAccessConsentsResourceController = SetupAccountAccessConsentsResourceController;
exports.SpecificAccountEndpointsController = SpecificAccountEndpointsController;
//# sourceMappingURL=pnz-apicentre-sandbox-sdk.cjs.development.js.map