text: "use strict";
  
  /* global dw empty */
  var ObjectSerializer = require("../serializers/ObjectSerializer");
  // @ts-ignore
  var ClientError = require("../models/ClientError");
  // @ts-ignore
  var EntityExportRequest = require("../models/EntityExportRequest");
  // @ts-ignore
  var EntityQuery = require("../models/EntityQuery");
  // @ts-ignore
  var EntityQueryFilter = require("../models/EntityQueryFilter");
  // @ts-ignore
  var PaymentMethodConfiguration = require("../models/PaymentMethodConfiguration");
  // @ts-ignore
  var RenderedDocument = require("../models/RenderedDocument");
  // @ts-ignore
  var ServerError = require("../models/ServerError");
  // @ts-ignore
  var TokenVersion = require("../models/TokenVersion");
  // @ts-ignore
  var Transaction = require("../models/Transaction");
  // @ts-ignore
  var TransactionCreate = require("../models/TransactionCreate");
  // @ts-ignore
  var TransactionLineItemUpdateRequest = require("../models/TransactionLineItemUpdateRequest");
  // @ts-ignore
  var TransactionLineItemVersion = require("../models/TransactionLineItemVersion");
  // @ts-ignore
  var TransactionPending = require("../models/TransactionPending");
  var TransactionService = /** @class */ (function () {
      function TransactionService(httpService) {
          this.basePath = "https://app-wallee.com:443/api";
          this.defaultHeaders = {};
          this._useQuerystring = false;
          this.httpService = {};
          this.httpService = httpService;
      }
      /**
      * Exports the transactions into a CSV file. The file will contain the properties defined in the request.
      * @summary Export
      * @param { number } spaceId spaceId
      * @param { EntityExportRequest } request request The request controls the entries which are exported.
      * @param {*} [options] Override http request options.
      * @return {  string  }
      */
      TransactionService.prototype._export = function (spaceId, request, options) {
          if (options === void 0) { options = {}; }
          var localVarQueryParameters = {};
          var localVarHeaderParams = {};
          var localVarFormParams = {};
          // verify required parameter 'spaceId' is not null or undefined
          if (spaceId === null || spaceId === undefined) {
              throw new Error("Required parameter spaceId was null or undefined when calling _export.");
          }
          // verify required parameter 'request' is not null or undefined
          if (request === null || request === undefined) {
              throw new Error("Required parameter request was null or undefined when calling _export.");
          }
          if (spaceId !== undefined) {
              localVarQueryParameters["spaceId"] = ObjectSerializer.serialize(spaceId, "number");
          }
          for (var optionsHeadersKey in options.headers) {
              if (options.headers.hasOwnProperty(optionsHeadersKey)) {
                  localVarHeaderParams[optionsHeadersKey] = options.headers[optionsHeadersKey];
              }
          }
          var localVarUseFormData = false;
          var localVarRequestOptions = {
              method: "POST",
              queryString: localVarQueryParameters,
              headers: localVarHeaderParams,
              useQuerystring: this._useQuerystring,
              url: this.basePath,
              path: "/transaction/export",
              contentType: "application/json",
              body: JSON.stringify(ObjectSerializer.serialize(request, "EntityExportRequest")),
              form: {},
              formData: {}
          };
          if (Object.keys(localVarFormParams).length) {
              if (localVarUseFormData) {
                  localVarRequestOptions.formData = localVarFormParams;
              }
              else {
                  localVarRequestOptions.form = localVarFormParams;
              }
          }
          // dw.net.HTTPClient
          var response = this.httpService.callApi(localVarRequestOptions);
          if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
              var body = response.text;
              if (ObjectSerializer.primitives.indexOf("string".toLowerCase()) !== -1) {
                  return body;
              }
              try {
                  body = JSON.parse(body);
                  body = ObjectSerializer.deserialize(body, "string");
              }
              catch (e) {
                  dw.system.Logger.error("wallee > TransactionService > _export > unable to parse JSON > " + JSON.stringify({ message: e.message, fileName: e.fileName, lineNumber: e.lineNumber }));
              }
              return body;
          }
          else {
              var error = {
                  type: "Unknown",
                  date: (new Date()).toUTCString(),
                  statusCode: response.statusCode,
                  statusMessage: response.statusMessage,
                  errorText: response.errorText
              };
              if (response.statusCode && response.statusCode >= 400 && response.statusCode <= 499) {
                  error.type = "ClientError";
              }
              else if (response.statusCode && response.statusCode >= 500 && response.statusCode <= 599) {
                  error.type = "ServerError";
              }
              throw new Error("wallee > TransactionService > _export > " + error.type + " > " + JSON.stringify(error));
          }
      };
      /**
      * The confirm operation marks the transaction as confirmed. Once the transaction is confirmed no more changes can be applied.
      * @summary Confirm
      * @param { number } spaceId spaceId
      * @param { TransactionPending } transactionModel transactionModel The transaction JSON object to update and confirm.
      * @param {*} [options] Override http request options.
      * @return {  Transaction  }
      */
      TransactionService.prototype.confirm = function (spaceId, transactionModel, options) {
          if (options === void 0) { options = {}; }
          var localVarQueryParameters = {};
          var localVarHeaderParams = {};
          var localVarFormParams = {};
          // verify required parameter 'spaceId' is not null or undefined
          if (spaceId === null || spaceId === undefined) {
              throw new Error("Required parameter spaceId was null or undefined when calling confirm.");
          }
          // verify required parameter 'transactionModel' is not null or undefined
          if (transactionModel === null || transactionModel === undefined) {
              throw new Error("Required parameter transactionModel was null or undefined when calling confirm.");
          }
          if (spaceId !== undefined) {
              localVarQueryParameters["spaceId"] = ObjectSerializer.serialize(spaceId, "number");
          }
          for (var optionsHeadersKey in options.headers) {
              if (options.headers.hasOwnProperty(optionsHeadersKey)) {
                  localVarHeaderParams[optionsHeadersKey] = options.headers[optionsHeadersKey];
              }
          }
          var localVarUseFormData = false;
          var localVarRequestOptions = {
              method: "POST",
              queryString: localVarQueryParameters,
              headers: localVarHeaderParams,
              useQuerystring: this._useQuerystring,
              url: this.basePath,
              path: "/transaction/confirm",
              contentType: "application/json",
              body: JSON.stringify(ObjectSerializer.serialize(transactionModel, "TransactionPending")),
              form: {},
              formData: {}
          };
          if (Object.keys(localVarFormParams).length) {
              if (localVarUseFormData) {
                  localVarRequestOptions.formData = localVarFormParams;
              }
              else {
                  localVarRequestOptions.form = localVarFormParams;
              }
          }
          // dw.net.HTTPClient
          var response = this.httpService.callApi(localVarRequestOptions);
          if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
              var body = response.text;
              if (ObjectSerializer.primitives.indexOf("Transaction".toLowerCase()) !== -1) {
                  return body;
              }
              try {
                  body = JSON.parse(body);
                  body = ObjectSerializer.deserialize(body, "Transaction");
              }
              catch (e) {
                  dw.system.Logger.error("wallee > TransactionService > confirm > unable to parse JSON > " + JSON.stringify({ message: e.message, fileName: e.fileName, lineNumber: e.lineNumber }));
              }
              return body;
          }
          else {
              var error = {
                  type: "Unknown",
                  date: (new Date()).toUTCString(),
                  statusCode: response.statusCode,
                  statusMessage: response.statusMessage,
                  errorText: response.errorText
              };
              if (response.statusCode && response.statusCode >= 400 && response.statusCode <= 499) {
                  error.type = "ClientError";
              }
              else if (response.statusCode && response.statusCode >= 500 && response.statusCode <= 599) {
                  error.type = "ServerError";
              }
              throw new Error("wallee > TransactionService > confirm > " + error.type + " > " + JSON.stringify(error));
          }
      };
      /**
      * Counts the number of items in the database as restricted by the given filter.
      * @summary Count
      * @param { number } spaceId spaceId
      * @param { EntityQueryFilter } filter filter The filter which restricts the entities which are used to calculate the count.
      * @param {*} [options] Override http request options.
      * @return {  number  }
      */
      TransactionService.prototype.count = function (spaceId, filter, options) {
          if (options === void 0) { options = {}; }
          var localVarQueryParameters = {};
          var localVarHeaderParams = {};
          var localVarFormParams = {};
          // verify required parameter 'spaceId' is not null or undefined
          if (spaceId === null || spaceId === undefined) {
              throw new Error("Required parameter spaceId was null or undefined when calling count.");
          }
          if (spaceId !== undefined) {
              localVarQueryParameters["spaceId"] = ObjectSerializer.serialize(spaceId, "number");
          }
          for (var optionsHeadersKey in options.headers) {
              if (options.headers.hasOwnProperty(optionsHeadersKey)) {
                  localVarHeaderParams[optionsHeadersKey] = options.headers[optionsHeadersKey];
              }
          }
          var localVarUseFormData = false;
          var localVarRequestOptions = {
              method: "POST",
              queryString: localVarQueryParameters,
              headers: localVarHeaderParams,
              useQuerystring: this._useQuerystring,
              url: this.basePath,
              path: "/transaction/count",
              contentType: "application/json",
              body: JSON.stringify(ObjectSerializer.serialize(filter, "EntityQueryFilter")),
              form: {},
              formData: {}
          };
          if (Object.keys(localVarFormParams).length) {
              if (localVarUseFormData) {
                  localVarRequestOptions.formData = localVarFormParams;
              }
              else {
                  localVarRequestOptions.form = localVarFormParams;
              }
          }
          // dw.net.HTTPClient
          var response = this.httpService.callApi(localVarRequestOptions);
          if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
              var body = response.text;
              if (ObjectSerializer.primitives.indexOf("number".toLowerCase()) !== -1) {
                  return body;
              }
              try {
                  body = JSON.parse(body);
                  body = ObjectSerializer.deserialize(body, "number");
              }
              catch (e) {
                  dw.system.Logger.error("wallee > TransactionService > count > unable to parse JSON > " + JSON.stringify({ message: e.message, fileName: e.fileName, lineNumber: e.lineNumber }));
              }
              return body;
          }
          else {
              var error = {
                  type: "Unknown",
                  date: (new Date()).toUTCString(),
                  statusCode: response.statusCode,
                  statusMessage: response.statusMessage,
                  errorText: response.errorText
              };
              if (response.statusCode && response.statusCode >= 400 && response.statusCode <= 499) {
                  error.type = "ClientError";
              }
              else if (response.statusCode && response.statusCode >= 500 && response.statusCode <= 599) {
                  error.type = "ServerError";
              }
              throw new Error("wallee > TransactionService > count > " + error.type + " > " + JSON.stringify(error));
          }
      };
      /**
      * Creates the entity with the given properties.
      * @summary Create
      * @param { number } spaceId spaceId
      * @param { TransactionCreate } transaction transaction The transaction object which should be created.
      * @param {*} [options] Override http request options.
      * @return {  Transaction  }
      */
      TransactionService.prototype.create = function (spaceId, transaction, options) {
          if (options === void 0) { options = {}; }
          var localVarQueryParameters = {};
          var localVarHeaderParams = {};
          var localVarFormParams = {};
          // verify required parameter 'spaceId' is not null or undefined
          if (spaceId === null || spaceId === undefined) {
              throw new Error("Required parameter spaceId was null or undefined when calling create.");
          }
          // verify required parameter 'transaction' is not null or undefined
          if (transaction === null || transaction === undefined) {
              throw new Error("Required parameter transaction was null or undefined when calling create.");
          }
          if (spaceId !== undefined) {
              localVarQueryParameters["spaceId"] = ObjectSerializer.serialize(spaceId, "number");
          }
          for (var optionsHeadersKey in options.headers) {
              if (options.headers.hasOwnProperty(optionsHeadersKey)) {
                  localVarHeaderParams[optionsHeadersKey] = options.headers[optionsHeadersKey];
              }
          }
          var localVarUseFormData = false;
          var localVarRequestOptions = {
              method: "POST",
              queryString: localVarQueryParameters,
              headers: localVarHeaderParams,
              useQuerystring: this._useQuerystring,
              url: this.basePath,
              path: "/transaction/create",
              contentType: "application/json",
              body: JSON.stringify(ObjectSerializer.serialize(transaction, "TransactionCreate")),
              form: {},
              formData: {}
          };
          if (Object.keys(localVarFormParams).length) {
              if (localVarUseFormData) {
                  localVarRequestOptions.formData = localVarFormParams;
              }
              else {
                  localVarRequestOptions.form = localVarFormParams;
              }
          }
          // dw.net.HTTPClient
          var response = this.httpService.callApi(localVarRequestOptions);
          if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
              var body = response.text;
              if (ObjectSerializer.primitives.indexOf("Transaction".toLowerCase()) !== -1) {
                  return body;
              }
              try {
                  body = JSON.parse(body);
                  body = ObjectSerializer.deserialize(body, "Transaction");
              }
              catch (e) {
                  dw.system.Logger.error("wallee > TransactionService > create > unable to parse JSON > " + JSON.stringify({ message: e.message, fileName: e.fileName, lineNumber: e.lineNumber }));
              }
              return body;
          }
          else {
              var error = {
                  type: "Unknown",
                  date: (new Date()).toUTCString(),
                  statusCode: response.statusCode,
                  statusMessage: response.statusMessage,
                  errorText: response.errorText
              };
              if (response.statusCode && response.statusCode >= 400 && response.statusCode <= 499) {
                  error.type = "ClientError";
              }
              else if (response.statusCode && response.statusCode >= 500 && response.statusCode <= 599) {
                  error.type = "ServerError";
              }
              throw new Error("wallee > TransactionService > create > " + error.type + " > " + JSON.stringify(error));
          }
      };
      /**
      * This operation allows to create transaction credentials to delegate temporarily the access to the web service API for this particular transaction.
      * @summary Create Transaction Credentials
      * @param { number } spaceId spaceId
      * @param { number } id id The id of the transaction which should be returned.
      * @param {*} [options] Override http request options.
      * @return {  string  }
      */
      TransactionService.prototype.createTransactionCredentials = function (spaceId, id, options) {
          if (options === void 0) { options = {}; }
          var localVarQueryParameters = {};
          var localVarHeaderParams = {};
          var localVarFormParams = {};
          // verify required parameter 'spaceId' is not null or undefined
          if (spaceId === null || spaceId === undefined) {
              throw new Error("Required parameter spaceId was null or undefined when calling createTransactionCredentials.");
          }
          // verify required parameter 'id' is not null or undefined
          if (id === null || id === undefined) {
              throw new Error("Required parameter id was null or undefined when calling createTransactionCredentials.");
          }
          if (spaceId !== undefined) {
              localVarQueryParameters["spaceId"] = ObjectSerializer.serialize(spaceId, "number");
          }
          if (id !== undefined) {
              localVarQueryParameters["id"] = ObjectSerializer.serialize(id, "number");
          }
          for (var optionsHeadersKey in options.headers) {
              if (options.headers.hasOwnProperty(optionsHeadersKey)) {
                  localVarHeaderParams[optionsHeadersKey] = options.headers[optionsHeadersKey];
              }
          }
          var localVarUseFormData = false;
          var localVarRequestOptions = {
              method: "POST",
              queryString: localVarQueryParameters,
              headers: localVarHeaderParams,
              useQuerystring: this._useQuerystring,
              url: this.basePath,
              path: "/transaction/createTransactionCredentials",
              contentType: "application/json",
              form: {},
              formData: {}
          };
          if (Object.keys(localVarFormParams).length) {
              if (localVarUseFormData) {
                  localVarRequestOptions.formData = localVarFormParams;
              }
              else {
                  localVarRequestOptions.form = localVarFormParams;
              }
          }
          // dw.net.HTTPClient
          var response = this.httpService.callApi(localVarRequestOptions);
          if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
              var body = response.text;
              if (ObjectSerializer.primitives.indexOf("string".toLowerCase()) !== -1) {
                  return body;
              }
              try {
                  body = JSON.parse(body);
                  body = ObjectSerializer.deserialize(body, "string");
              }
              catch (e) {
                  dw.system.Logger.error("wallee > TransactionService > createTransactionCredentials > unable to parse JSON > " + JSON.stringify({ message: e.message, fileName: e.fileName, lineNumber: e.lineNumber }));
              }
              return body;
          }
          else {
              var error = {
                  type: "Unknown",
                  date: (new Date()).toUTCString(),
                  statusCode: response.statusCode,
                  statusMessage: response.statusMessage,
                  errorText: response.errorText
              };
              if (response.statusCode && response.statusCode >= 400 && response.statusCode <= 499) {
                  error.type = "ClientError";
              }
              else if (response.statusCode && response.statusCode >= 500 && response.statusCode <= 599) {
                  error.type = "ServerError";
              }
              throw new Error("wallee > TransactionService > createTransactionCredentials > " + error.type + " > " + JSON.stringify(error));
          }
      };
      /**
      * This operation removes the given token.
      * @summary Delete One-Click Token with Credentials
      * @param { string } credentials credentials The credentials identifies the transaction and contains the security details which grants the access this operation.
      * @param { number } tokenId tokenId The token ID will be used to find the token which should be removed.
      * @param {*} [options] Override http request options.
      * @return {  any  }
      */
      TransactionService.prototype.deleteOneClickTokenWithCredentials = function (credentials, tokenId, options) {
          if (options === void 0) { options = {}; }
          var localVarQueryParameters = {};
          var localVarHeaderParams = {};
          var localVarFormParams = {};
          // verify required parameter 'credentials' is not null or undefined
          if (credentials === null || credentials === undefined) {
              throw new Error("Required parameter credentials was null or undefined when calling deleteOneClickTokenWithCredentials.");
          }
          // verify required parameter 'tokenId' is not null or undefined
          if (tokenId === null || tokenId === undefined) {
              throw new Error("Required parameter tokenId was null or undefined when calling deleteOneClickTokenWithCredentials.");
          }
          if (credentials !== undefined) {
              localVarQueryParameters["credentials"] = ObjectSerializer.serialize(credentials, "string");
          }
          if (tokenId !== undefined) {
              localVarQueryParameters["tokenId"] = ObjectSerializer.serialize(tokenId, "number");
          }
          for (var optionsHeadersKey in options.headers) {
              if (options.headers.hasOwnProperty(optionsHeadersKey)) {
                  localVarHeaderParams[optionsHeadersKey] = options.headers[optionsHeadersKey];
              }
          }
          var localVarUseFormData = false;
          var localVarRequestOptions = {
              method: "POST",
              queryString: localVarQueryParameters,
              headers: localVarHeaderParams,
              useQuerystring: this._useQuerystring,
              url: this.basePath,
              path: "/transaction/deleteOneClickTokenWithCredentials",
              contentType: "application/json",
              form: {},
              formData: {}
          };
          if (Object.keys(localVarFormParams).length) {
              if (localVarUseFormData) {
                  localVarRequestOptions.formData = localVarFormParams;
              }
              else {
                  localVarRequestOptions.form = localVarFormParams;
              }
          }
          // dw.net.HTTPClient
          var response = this.httpService.callApi(localVarRequestOptions);
          if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
              var body = response.text;
              try {
                  body = JSON.parse(body);
              }
              catch (e) {
                  dw.system.Logger.error("wallee > TransactionService > deleteOneClickTokenWithCredentials > unable to parse JSON > " + JSON.stringify({ message: e.message, fileName: e.fileName, lineNumber: e.lineNumber }));
              }
              return body;
          }
          else {
              var error = {
                  type: "Unknown",
                  date: (new Date()).toUTCString(),
                  statusCode: response.statusCode,
                  statusMessage: response.statusMessage,
                  errorText: response.errorText
              };
              if (response.statusCode && response.statusCode >= 400 && response.statusCode <= 499) {
                  error.type = "ClientError";
              }
              else if (response.statusCode && response.statusCode >= 500 && response.statusCode <= 599) {
                  error.type = "ServerError";
              }
              throw new Error("wallee > TransactionService > deleteOneClickTokenWithCredentials > " + error.type + " > " + JSON.stringify(error));
          }
      };
      /**
      * This operation returns the token version objects which references the tokens usable as one-click payment tokens for the provided transaction.
      * @summary Fetch One Click Tokens with Credentials
      * @param { string } credentials credentials The credentials identifies the transaction and contains the security details which grants the access this operation.
      * @param {*} [options] Override http request options.
      * @return {  Array<TokenVersion>  }
      */
      TransactionService.prototype.fetchOneClickTokensWithCredentials = function (credentials, options) {
          if (options === void 0) { options = {}; }
          var localVarQueryParameters = {};
          var localVarHeaderParams = {};
          var localVarFormParams = {};
          // verify required parameter 'credentials' is not null or undefined
          if (credentials === null || credentials === undefined) {
              throw new Error("Required parameter credentials was null or undefined when calling fetchOneClickTokensWithCredentials.");
          }
          if (credentials !== undefined) {
              localVarQueryParameters["credentials"] = ObjectSerializer.serialize(credentials, "string");
          }
          for (var optionsHeadersKey in options.headers) {
              if (options.headers.hasOwnProperty(optionsHeadersKey)) {
                  localVarHeaderParams[optionsHeadersKey] = options.headers[optionsHeadersKey];
              }
          }
          var localVarUseFormData = false;
          var localVarRequestOptions = {
              method: "GET",
              queryString: localVarQueryParameters,
              headers: localVarHeaderParams,
              useQuerystring: this._useQuerystring,
              url: this.basePath,
              path: "/transaction/fetchOneClickTokensWithCredentials",
              contentType: "application/json",
              form: {},
              formData: {}
          };
          if (Object.keys(localVarFormParams).length) {
              if (localVarUseFormData) {
                  localVarRequestOptions.formData = localVarFormParams;
              }
              else {
                  localVarRequestOptions.form = localVarFormParams;
              }
          }
          // dw.net.HTTPClient
          var response = this.httpService.callApi(localVarRequestOptions);
          if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
              var body = response.text;
              if (ObjectSerializer.primitives.indexOf("Array<TokenVersion>".toLowerCase()) !== -1) {
                  return body;
              }
              try {
                  body = JSON.parse(body);
                  body = ObjectSerializer.deserialize(body, "Array<TokenVersion>");
              }
              catch (e) {
                  dw.system.Logger.error("wallee > TransactionService > fetchOneClickTokensWithCredentials > unable to parse JSON > " + JSON.stringify({ message: e.message, fileName: e.fileName, lineNumber: e.lineNumber }));
              }
              return body;
          }
          else {
              var error = {
                  type: "Unknown",
                  date: (new Date()).toUTCString(),
                  statusCode: response.statusCode,
                  statusMessage: response.statusMessage,
                  errorText: response.errorText
              };
              if (response.statusCode && response.statusCode >= 400 && response.statusCode <= 499) {
                  error.type = "ClientError";
              }
              else if (response.statusCode && response.statusCode >= 500 && response.statusCode <= 599) {
                  error.type = "ServerError";
              }
              throw new Error("wallee > TransactionService > fetchOneClickTokensWithCredentials > " + error.type + " > " + JSON.stringify(error));
          }
      };
      /**
      * This operation allows to get the payment method configurations which can be used with the provided transaction.
      * @summary Fetch Possible Payment Methods
      * @param { number } spaceId spaceId
      * @param { number } id id The id of the transaction which should be returned.
      * @param {*} [options] Override http request options.
      * @return {  Array<PaymentMethodConfiguration>  }
      */
      TransactionService.prototype.fetchPossiblePaymentMethods = function (spaceId, id, options) {
          if (options === void 0) { options = {}; }
          var localVarQueryParameters = {};
          var localVarHeaderParams = {};
          var localVarFormParams = {};
          // verify required parameter 'spaceId' is not null or undefined
          if (spaceId === null || spaceId === undefined) {
              throw new Error("Required parameter spaceId was null or undefined when calling fetchPossiblePaymentMethods.");
          }
          // verify required parameter 'id' is not null or undefined
          if (id === null || id === undefined) {
              throw new Error("Required parameter id was null or undefined when calling fetchPossiblePaymentMethods.");
          }
          if (spaceId !== undefined) {
              localVarQueryParameters["spaceId"] = ObjectSerializer.serialize(spaceId, "number");
          }
          if (id !== undefined) {
              localVarQueryParameters["id"] = ObjectSerializer.serialize(id, "number");
          }
          for (var optionsHeadersKey in options.headers) {
              if (options.headers.hasOwnProperty(optionsHeadersKey)) {
                  localVarHeaderParams[optionsHeadersKey] = options.headers[optionsHeadersKey];
              }
          }
          var localVarUseFormData = false;
          var localVarRequestOptions = {
              method: "GET",
              queryString: localVarQueryParameters,
              headers: localVarHeaderParams,
              useQuerystring: this._useQuerystring,
              url: this.basePath,
              path: "/transaction/fetchPossiblePaymentMethods",
              contentType: "application/json",
              form: {},
              formData: {}
          };
          if (Object.keys(localVarFormParams).length) {
              if (localVarUseFormData) {
                  localVarRequestOptions.formData = localVarFormParams;
              }
              else {
                  localVarRequestOptions.form = localVarFormParams;
              }
          }
          // dw.net.HTTPClient
          var response = this.httpService.callApi(localVarRequestOptions);
          if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
              var body = response.text;
              if (ObjectSerializer.primitives.indexOf("Array<PaymentMethodConfiguration>".toLowerCase()) !== -1) {
                  return body;
              }
              try {
                  body = JSON.parse(body);
                  body = ObjectSerializer.deserialize(body, "Array<PaymentMethodConfiguration>");
              }
              catch (e) {
                  dw.system.Logger.error("wallee > TransactionService > fetchPossiblePaymentMethods > unable to parse JSON > " + JSON.stringify({ message: e.message, fileName: e.fileName, lineNumber: e.lineNumber }));
              }
              return body;
          }
          else {
              var error = {
                  type: "Unknown",
                  date: (new Date()).toUTCString(),
                  statusCode: response.statusCode,
                  statusMessage: response.statusMessage,
                  errorText: response.errorText
              };
              if (response.statusCode && response.statusCode >= 400 && response.statusCode <= 499) {
                  error.type = "ClientError";
              }
              else if (response.statusCode && response.statusCode >= 500 && response.statusCode <= 599) {
                  error.type = "ServerError";
              }
              throw new Error("wallee > TransactionService > fetchPossiblePaymentMethods > " + error.type + " > " + JSON.stringify(error));
          }
      };
      /**
      * This operation allows to get the payment method configurations which can be used with the provided transaction.
      * @summary Fetch Possible Payment Methods with Credentials
      * @param { string } credentials credentials The credentials identifies the transaction and contains the security details which grants the access this operation.
      * @param {*} [options] Override http request options.
      * @return {  Array<PaymentMethodConfiguration>  }
      */
      TransactionService.prototype.fetchPossiblePaymentMethodsWithCredentials = function (credentials, options) {
          if (options === void 0) { options = {}; }
          var localVarQueryParameters = {};
          var localVarHeaderParams = {};
          var localVarFormParams = {};
          // verify required parameter 'credentials' is not null or undefined
          if (credentials === null || credentials === undefined) {
              throw new Error("Required parameter credentials was null or undefined when calling fetchPossiblePaymentMethodsWithCredentials.");
          }
          if (credentials !== undefined) {
              localVarQueryParameters["credentials"] = ObjectSerializer.serialize(credentials, "string");
          }
          for (var optionsHeadersKey in options.headers) {
              if (options.headers.hasOwnProperty(optionsHeadersKey)) {
                  localVarHeaderParams[optionsHeadersKey] = options.headers[optionsHeadersKey];
              }
          }
          var localVarUseFormData = false;
          var localVarRequestOptions = {
              method: "GET",
              queryString: localVarQueryParameters,
              headers: localVarHeaderParams,
              useQuerystring: this._useQuerystring,
              url: this.basePath,
              path: "/transaction/fetchPossiblePaymentMethodsWithCredentials",
              contentType: "application/json",
              form: {},
              formData: {}
          };
          if (Object.keys(localVarFormParams).length) {
              if (localVarUseFormData) {
                  localVarRequestOptions.formData = localVarFormParams;
              }
              else {
                  localVarRequestOptions.form = localVarFormParams;
              }
          }
          // dw.net.HTTPClient
          var response = this.httpService.callApi(localVarRequestOptions);
          if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
              var body = response.text;
              if (ObjectSerializer.primitives.indexOf("Array<PaymentMethodConfiguration>".toLowerCase()) !== -1) {
                  return body;
              }
              try {
                  body = JSON.parse(body);
                  body = ObjectSerializer.deserialize(body, "Array<PaymentMethodConfiguration>");
              }
              catch (e) {
                  dw.system.Logger.error("wallee > TransactionService > fetchPossiblePaymentMethodsWithCredentials > unable to parse JSON > " + JSON.stringify({ message: e.message, fileName: e.fileName, lineNumber: e.lineNumber }));
              }
              return body;
          }
          else {
              var error = {
                  type: "Unknown",
                  date: (new Date()).toUTCString(),
                  statusCode: response.statusCode,
                  statusMessage: response.statusMessage,
                  errorText: response.errorText
              };
              if (response.statusCode && response.statusCode >= 400 && response.statusCode <= 499) {
                  error.type = "ClientError";
              }
              else if (response.statusCode && response.statusCode >= 500 && response.statusCode <= 599) {
                  error.type = "ServerError";
              }
              throw new Error("wallee > TransactionService > fetchPossiblePaymentMethodsWithCredentials > " + error.type + " > " + JSON.stringify(error));
          }
      };
      /**
      * Returns the PDF document for the transaction invoice with given id.
      * @summary getInvoiceDocument
      * @param { number } spaceId spaceId
      * @param { number } id id The id of the transaction to get the invoice document for.
      * @param {*} [options] Override http request options.
      * @return {  RenderedDocument  }
      */
      TransactionService.prototype.getInvoiceDocument = function (spaceId, id, options) {
          if (options === void 0) { options = {}; }
          var localVarQueryParameters = {};
          var localVarHeaderParams = {};
          var localVarFormParams = {};
          // verify required parameter 'spaceId' is not null or undefined
          if (spaceId === null || spaceId === undefined) {
              throw new Error("Required parameter spaceId was null or undefined when calling getInvoiceDocument.");
          }
          // verify required parameter 'id' is not null or undefined
          if (id === null || id === undefined) {
              throw new Error("Required parameter id was null or undefined when calling getInvoiceDocument.");
          }
          if (spaceId !== undefined) {
              localVarQueryParameters["spaceId"] = ObjectSerializer.serialize(spaceId, "number");
          }
          if (id !== undefined) {
              localVarQueryParameters["id"] = ObjectSerializer.serialize(id, "number");
          }
          for (var optionsHeadersKey in options.headers) {
              if (options.headers.hasOwnProperty(optionsHeadersKey)) {
                  localVarHeaderParams[optionsHeadersKey] = options.headers[optionsHeadersKey];
              }
          }
          var localVarUseFormData = false;
          var localVarRequestOptions = {
              method: "GET",
              queryString: localVarQueryParameters,
              headers: localVarHeaderParams,
              useQuerystring: this._useQuerystring,
              url: this.basePath,
              path: "/transaction/getInvoiceDocument",
              contentType: "application/json",
              form: {},
              formData: {}
          };
          if (Object.keys(localVarFormParams).length) {
              if (localVarUseFormData) {
                  localVarRequestOptions.formData = localVarFormParams;
              }
              else {
                  localVarRequestOptions.form = localVarFormParams;
              }
          }
          // dw.net.HTTPClient
          var response = this.httpService.callApi(localVarRequestOptions);
          if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
              var body = response.text;
              if (ObjectSerializer.primitives.indexOf("RenderedDocument".toLowerCase()) !== -1) {
                  return body;
              }
              try {
                  body = JSON.parse(body);
                  body = ObjectSerializer.deserialize(body, "RenderedDocument");
              }
              catch (e) {
                  dw.system.Logger.error("wallee > TransactionService > getInvoiceDocument > unable to parse JSON > " + JSON.stringify({ message: e.message, fileName: e.fileName, lineNumber: e.lineNumber }));
              }
              return body;
          }
          else {
              var error = {
                  type: "Unknown",
                  date: (new Date()).toUTCString(),
                  statusCode: response.statusCode,
                  statusMessage: response.statusMessage,
                  errorText: response.errorText
              };
              if (response.statusCode && response.statusCode >= 400 && response.statusCode <= 499) {
                  error.type = "ClientError";
              }
              else if (response.statusCode && response.statusCode >= 500 && response.statusCode <= 599) {
                  error.type = "ServerError";
              }
              throw new Error("wallee > TransactionService > getInvoiceDocument > " + error.type + " > " + JSON.stringify(error));
          }
      };
      /**
      *
      * @summary getLatestTransactionLineItemVersion
      * @param { number } spaceId spaceId
      * @param { number } id id The id of the transaction to get the latest line item version for.
      * @param {*} [options] Override http request options.
      * @return {  TransactionLineItemVersion  }
      */
      TransactionService.prototype.getLatestTransactionLineItemVersion = function (spaceId, id, options) {
          if (options === void 0) { options = {}; }
          var localVarQueryParameters = {};
          var localVarHeaderParams = {};
          var localVarFormParams = {};
          // verify required parameter 'spaceId' is not null or undefined
          if (spaceId === null || spaceId === undefined) {
              throw new Error("Required parameter spaceId was null or undefined when calling getLatestTransactionLineItemVersion.");
          }
          // verify required parameter 'id' is not null or undefined
          if (id === null || id === undefined) {
              throw new Error("Required parameter id was null or undefined when calling getLatestTransactionLineItemVersion.");
          }
          if (spaceId !== undefined) {
              localVarQueryParameters["spaceId"] = ObjectSerializer.serialize(spaceId, "number");
          }
          if (id !== undefined) {
              localVarQueryParameters["id"] = ObjectSerializer.serialize(id, "number");
          }
          for (var optionsHeadersKey in options.headers) {
              if (options.headers.hasOwnProperty(optionsHeadersKey)) {
                  localVarHeaderParams[optionsHeadersKey] = options.headers[optionsHeadersKey];
              }
          }
          var localVarUseFormData = false;
          var localVarRequestOptions = {
              method: "GET",
              queryString: localVarQueryParameters,
              headers: localVarHeaderParams,
              useQuerystring: this._useQuerystring,
              url: this.basePath,
              path: "/transaction/getLatestTransactionLineItemVersion",
              contentType: "application/json",
              form: {},
              formData: {}
          };
          if (Object.keys(localVarFormParams).length) {
              if (localVarUseFormData) {
                  localVarRequestOptions.formData = localVarFormParams;
              }
              else {
                  localVarRequestOptions.form = localVarFormParams;
              }
          }
          // dw.net.HTTPClient
          var response = this.httpService.callApi(localVarRequestOptions);
          if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
              var body = response.text;
              if (ObjectSerializer.primitives.indexOf("TransactionLineItemVersion".toLowerCase()) !== -1) {
                  return body;
              }
              try {
                  body = JSON.parse(body);
                  body = ObjectSerializer.deserialize(body, "TransactionLineItemVersion");
              }
              catch (e) {
                  dw.system.Logger.error("wallee > TransactionService > getLatestTransactionLineItemVersion > unable to parse JSON > " + JSON.stringify({ message: e.message, fileName: e.fileName, lineNumber: e.lineNumber }));
              }
              return body;
          }
          else {
              var error = {
                  type: "Unknown",
                  date: (new Date()).toUTCString(),
                  statusCode: response.statusCode,
                  statusMessage: response.statusMessage,
                  errorText: response.errorText
              };
              if (response.statusCode && response.statusCode >= 400 && response.statusCode <= 499) {
                  error.type = "ClientError";
              }
              else if (response.statusCode && response.statusCode >= 500 && response.statusCode <= 599) {
                  error.type = "ServerError";
              }
              throw new Error("wallee > TransactionService > getLatestTransactionLineItemVersion > " + error.type + " > " + JSON.stringify(error));
          }
      };
      /**
      * Returns the packing slip for the transaction with given id.
      * @summary getPackingSlip
      * @param { number } spaceId spaceId
      * @param { number } id id The id of the transaction to get the packing slip for.
      * @param {*} [options] Override http request options.
      * @return {  RenderedDocument  }
      */
      TransactionService.prototype.getPackingSlip = function (spaceId, id, options) {
          if (options === void 0) { options = {}; }
          var localVarQueryParameters = {};
          var localVarHeaderParams = {};
          var localVarFormParams = {};
          // verify required parameter 'spaceId' is not null or undefined
          if (spaceId === null || spaceId === undefined) {
              throw new Error("Required parameter spaceId was null or undefined when calling getPackingSlip.");
          }
          // verify required parameter 'id' is not null or undefined
          if (id === null || id === undefined) {
              throw new Error("Required parameter id was null or undefined when calling getPackingSlip.");
          }
          if (spaceId !== undefined) {
              localVarQueryParameters["spaceId"] = ObjectSerializer.serialize(spaceId, "number");
          }
          if (id !== undefined) {
              localVarQueryParameters["id"] = ObjectSerializer.serialize(id, "number");
          }
          for (var optionsHeadersKey in options.headers) {
              if (options.headers.hasOwnProperty(optionsHeadersKey)) {
                  localVarHeaderParams[optionsHeadersKey] = options.headers[optionsHeadersKey];
              }
          }
          var localVarUseFormData = false;
          var localVarRequestOptions = {
              method: "GET",
              queryString: localVarQueryParameters,
              headers: localVarHeaderParams,
              useQuerystring: this._useQuerystring,
              url: this.basePath,
              path: "/transaction/getPackingSlip",
              contentType: "application/json",
              form: {},
              formData: {}
          };
          if (Object.keys(localVarFormParams).length) {
              if (localVarUseFormData) {
                  localVarRequestOptions.formData = localVarFormParams;
              }
              else {
                  localVarRequestOptions.form = localVarFormParams;
              }
          }
          // dw.net.HTTPClient
          var response = this.httpService.callApi(localVarRequestOptions);
          if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
              var body = response.text;
              if (ObjectSerializer.primitives.indexOf("RenderedDocument".toLowerCase()) !== -1) {
                  return body;
              }
              try {
                  body = JSON.parse(body);
                  body = ObjectSerializer.deserialize(body, "RenderedDocument");
              }
              catch (e) {
                  dw.system.Logger.error("wallee > TransactionService > getPackingSlip > unable to parse JSON > " + JSON.stringify({ message: e.message, fileName: e.fileName, lineNumber: e.lineNumber }));
              }
              return body;
          }
          else {
              var error = {
                  type: "Unknown",
                  date: (new Date()).toUTCString(),
                  statusCode: response.statusCode,
                  statusMessage: response.statusMessage,
                  errorText: response.errorText
              };
              if (response.statusCode && response.statusCode >= 400 && response.statusCode <= 499) {
                  error.type = "ClientError";
              }
              else if (response.statusCode && response.statusCode >= 500 && response.statusCode <= 599) {
                  error.type = "ServerError";
              }
              throw new Error("wallee > TransactionService > getPackingSlip > " + error.type + " > " + JSON.stringify(error));
          }
      };
      /**
      * This operation assigns the given token to the transaction and process it. This method will return an URL where the customer has to be redirect to complete the transaction.
      * @summary Process One-Click Token with Credentials
      * @param { string } credentials credentials The credentials identifies the transaction and contains the security details which grants the access this operation.
      * @param { number } tokenId tokenId The token ID is used to load the corresponding token and to process the transaction with it.
      * @param {*} [options] Override http request options.
      * @return {  string  }
      */
      TransactionService.prototype.processOneClickTokenAndRedirectWithCredentials = function (credentials, tokenId, options) {
          if (options === void 0) { options = {}; }
          var localVarQueryParameters = {};
          var localVarHeaderParams = {};
          var localVarFormParams = {};
          // verify required parameter 'credentials' is not null or undefined
          if (credentials === null || credentials === undefined) {
              throw new Error("Required parameter credentials was null or undefined when calling processOneClickTokenAndRedirectWithCredentials.");
          }
          // verify required parameter 'tokenId' is not null or undefined
          if (tokenId === null || tokenId === undefined) {
              throw new Error("Required parameter tokenId was null or undefined when calling processOneClickTokenAndRedirectWithCredentials.");
          }
          if (credentials !== undefined) {
              localVarQueryParameters["credentials"] = ObjectSerializer.serialize(credentials, "string");
          }
          if (tokenId !== undefined) {
              localVarQueryParameters["tokenId"] = ObjectSerializer.serialize(tokenId, "number");
          }
          for (var optionsHeadersKey in options.headers) {
              if (options.headers.hasOwnProperty(optionsHeadersKey)) {
                  localVarHeaderParams[optionsHeadersKey] = options.headers[optionsHeadersKey];
              }
          }
          var localVarUseFormData = false;
          var localVarRequestOptions = {
              method: "POST",
              queryString: localVarQueryParameters,
              headers: localVarHeaderParams,
              useQuerystring: this._useQuerystring,
              url: this.basePath,
              path: "/transaction/processOneClickTokenAndRedirectWithCredentials",
              contentType: "application/json",
              form: {},
              formData: {}
          };
          if (Object.keys(localVarFormParams).length) {
              if (localVarUseFormData) {
                  localVarRequestOptions.formData = localVarFormParams;
              }
              else {
                  localVarRequestOptions.form = localVarFormParams;
              }
          }
          // dw.net.HTTPClient
          var response = this.httpService.callApi(localVarRequestOptions);
          if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
              var body = response.text;
              if (ObjectSerializer.primitives.indexOf("string".toLowerCase()) !== -1) {
                  return body;
              }
              try {
                  body = JSON.parse(body);
                  body = ObjectSerializer.deserialize(body, "string");
              }
              catch (e) {
                  dw.system.Logger.error("wallee > TransactionService > processOneClickTokenAndRedirectWithCredentials > unable to parse JSON > " + JSON.stringify({ message: e.message, fileName: e.fileName, lineNumber: e.lineNumber }));
              }
              return body;
          }
          else {
              var error = {
                  type: "Unknown",
                  date: (new Date()).toUTCString(),
                  statusCode: response.statusCode,
                  statusMessage: response.statusMessage,
                  errorText: response.errorText
              };
              if (response.statusCode && response.statusCode >= 400 && response.statusCode <= 499) {
                  error.type = "ClientError";
              }
              else if (response.statusCode && response.statusCode >= 500 && response.statusCode <= 599) {
                  error.type = "ServerError";
              }
              throw new Error("wallee > TransactionService > processOneClickTokenAndRedirectWithCredentials > " + error.type + " > " + JSON.stringify(error));
          }
      };
      /**
      * This operation processes the transaction without requiring that the customer is present. Means this operation applies strategies to process the transaction without a direct interaction with the buyer. This operation is suitable for recurring transactions.
      * @summary Process Without User Interaction
      * @param { number } spaceId spaceId
      * @param { number } id id The id of the transaction which should be processed.
      * @param {*} [options] Override http request options.
      * @return {  Transaction  }
      */
      TransactionService.prototype.processWithoutUserInteraction = function (spaceId, id, options) {
          if (options === void 0) { options = {}; }
          var localVarQueryParameters = {};
          var localVarHeaderParams = {};
          var localVarFormParams = {};
          // verify required parameter 'spaceId' is not null or undefined
          if (spaceId === null || spaceId === undefined) {
              throw new Error("Required parameter spaceId was null or undefined when calling processWithoutUserInteraction.");
          }
          // verify required parameter 'id' is not null or undefined
          if (id === null || id === undefined) {
              throw new Error("Required parameter id was null or undefined when calling processWithoutUserInteraction.");
          }
          if (spaceId !== undefined) {
              localVarQueryParameters["spaceId"] = ObjectSerializer.serialize(spaceId, "number");
          }
          if (id !== undefined) {
              localVarQueryParameters["id"] = ObjectSerializer.serialize(id, "number");
          }
          for (var optionsHeadersKey in options.headers) {
              if (options.headers.hasOwnProperty(optionsHeadersKey)) {
                  localVarHeaderParams[optionsHeadersKey] = options.headers[optionsHeadersKey];
              }
          }
          var localVarUseFormData = false;
          var localVarRequestOptions = {
              method: "POST",
              queryString: localVarQueryParameters,
              headers: localVarHeaderParams,
              useQuerystring: this._useQuerystring,
              url: this.basePath,
              path: "/transaction/processWithoutUserInteraction",
              contentType: "application/json",
              form: {},
              formData: {}
          };
          if (Object.keys(localVarFormParams).length) {
              if (localVarUseFormData) {
                  localVarRequestOptions.formData = localVarFormParams;
              }
              else {
                  localVarRequestOptions.form = localVarFormParams;
              }
          }
          // dw.net.HTTPClient
          var response = this.httpService.callApi(localVarRequestOptions);
          if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
              var body = response.text;
              if (ObjectSerializer.primitives.indexOf("Transaction".toLowerCase()) !== -1) {
                  return body;
              }
              try {
                  body = JSON.parse(body);
                  body = ObjectSerializer.deserialize(body, "Transaction");
              }
              catch (e) {
                  dw.system.Logger.error("wallee > TransactionService > processWithoutUserInteraction > unable to parse JSON > " + JSON.stringify({ message: e.message, fileName: e.fileName, lineNumber: e.lineNumber }));
              }
              return body;
          }
          else {
              var error = {
                  type: "Unknown",
                  date: (new Date()).toUTCString(),
                  statusCode: response.statusCode,
                  statusMessage: response.statusMessage,
                  errorText: response.errorText
              };
              if (response.statusCode && response.statusCode >= 400 && response.statusCode <= 499) {
                  error.type = "ClientError";
              }
              else if (response.statusCode && response.statusCode >= 500 && response.statusCode <= 599) {
                  error.type = "ServerError";
              }
              throw new Error("wallee > TransactionService > processWithoutUserInteraction > " + error.type + " > " + JSON.stringify(error));
          }
      };
      /**
      * Reads the entity with the given 'id' and returns it.
      * @summary Read
      * @param { number } spaceId spaceId
      * @param { number } id id The id of the transaction which should be returned.
      * @param {*} [options] Override http request options.
      * @return {  Transaction  }
      */
      TransactionService.prototype.read = function (spaceId, id, options) {
          if (options === void 0) { options = {}; }
          var localVarQueryParameters = {};
          var localVarHeaderParams = {};
          var localVarFormParams = {};
          // verify required parameter 'spaceId' is not null or undefined
          if (spaceId === null || spaceId === undefined) {
              throw new Error("Required parameter spaceId was null or undefined when calling read.");
          }
          // verify required parameter 'id' is not null or undefined
          if (id === null || id === undefined) {
              throw new Error("Required parameter id was null or undefined when calling read.");
          }
          if (spaceId !== undefined) {
              localVarQueryParameters["spaceId"] = ObjectSerializer.serialize(spaceId, "number");
          }
          if (id !== undefined) {
              localVarQueryParameters["id"] = ObjectSerializer.serialize(id, "number");
          }
          for (var optionsHeadersKey in options.headers) {
              if (options.headers.hasOwnProperty(optionsHeadersKey)) {
                  localVarHeaderParams[optionsHeadersKey] = options.headers[optionsHeadersKey];
              }
          }
          var localVarUseFormData = false;
          var localVarRequestOptions = {
              method: "GET",
              queryString: localVarQueryParameters,
              headers: localVarHeaderParams,
              useQuerystring: this._useQuerystring,
              url: this.basePath,
              path: "/transaction/read",
              contentType: "application/json",
              form: {},
              formData: {}
          };
          if (Object.keys(localVarFormParams).length) {
              if (localVarUseFormData) {
                  localVarRequestOptions.formData = localVarFormParams;
              }
              else {
                  localVarRequestOptions.form = localVarFormParams;
              }
          }
          // dw.net.HTTPClient
          var response = this.httpService.callApi(localVarRequestOptions);
          if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
              var body = response.text;
              if (ObjectSerializer.primitives.indexOf("Transaction".toLowerCase()) !== -1) {
                  return body;
              }
              try {
                  body = JSON.parse(body);
                  body = ObjectSerializer.deserialize(body, "Transaction");
              }
              catch (e) {
                  dw.system.Logger.error("wallee > TransactionService > read > unable to parse JSON > " + JSON.stringify({ message: e.message, fileName: e.fileName, lineNumber: e.lineNumber }));
              }
              return body;
          }
          else {
              var error = {
                  type: "Unknown",
                  date: (new Date()).toUTCString(),
                  statusCode: response.statusCode,
                  statusMessage: response.statusMessage,
                  errorText: response.errorText
              };
              if (response.statusCode && response.statusCode >= 400 && response.statusCode <= 499) {
                  error.type = "ClientError";
              }
              else if (response.statusCode && response.statusCode >= 500 && response.statusCode <= 599) {
                  error.type = "ServerError";
              }
              throw new Error("wallee > TransactionService > read > " + error.type + " > " + JSON.stringify(error));
          }
      };
      /**
      * Reads the transaction with the given 'id' and returns it. This method uses the credentials to authenticate and identify the transaction.
      * @summary Read With Credentials
      * @param { string } credentials credentials The credentials identifies the transaction and contains the security details which grants the access this operation.
      * @param {*} [options] Override http request options.
      * @return {  Transaction  }
      */
      TransactionService.prototype.readWithCredentials = function (credentials, options) {
          if (options === void 0) { options = {}; }
          var localVarQueryParameters = {};
          var localVarHeaderParams = {};
          var localVarFormParams = {};
          // verify required parameter 'credentials' is not null or undefined
          if (credentials === null || credentials === undefined) {
              throw new Error("Required parameter credentials was null or undefined when calling readWithCredentials.");
          }
          if (credentials !== undefined) {
              localVarQueryParameters["credentials"] = ObjectSerializer.serialize(credentials, "string");
          }
          for (var optionsHeadersKey in options.headers) {
              if (options.headers.hasOwnProperty(optionsHeadersKey)) {
                  localVarHeaderParams[optionsHeadersKey] = options.headers[optionsHeadersKey];
              }
          }
          var localVarUseFormData = false;
          var localVarRequestOptions = {
              method: "GET",
              queryString: localVarQueryParameters,
              headers: localVarHeaderParams,
              useQuerystring: this._useQuerystring,
              url: this.basePath,
              path: "/transaction/readWithCredentials",
              contentType: "application/json",
              form: {},
              formData: {}
          };
          if (Object.keys(localVarFormParams).length) {
              if (localVarUseFormData) {
                  localVarRequestOptions.formData = localVarFormParams;
              }
              else {
                  localVarRequestOptions.form = localVarFormParams;
              }
          }
          // dw.net.HTTPClient
          var response = this.httpService.callApi(localVarRequestOptions);
          if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
              var body = response.text;
              if (ObjectSerializer.primitives.indexOf("Transaction".toLowerCase()) !== -1) {
                  return body;
              }
              try {
                  body = JSON.parse(body);
                  body = ObjectSerializer.deserialize(body, "Transaction");
              }
              catch (e) {
                  dw.system.Logger.error("wallee > TransactionService > readWithCredentials > unable to parse JSON > " + JSON.stringify({ message: e.message, fileName: e.fileName, lineNumber: e.lineNumber }));
              }
              return body;
          }
          else {
              var error = {
                  type: "Unknown",
                  date: (new Date()).toUTCString(),
                  statusCode: response.statusCode,
                  statusMessage: response.statusMessage,
                  errorText: response.errorText
              };
              if (response.statusCode && response.statusCode >= 400 && response.statusCode <= 499) {
                  error.type = "ClientError";
              }
              else if (response.statusCode && response.statusCode >= 500 && response.statusCode <= 599) {
                  error.type = "ServerError";
              }
              throw new Error("wallee > TransactionService > readWithCredentials > " + error.type + " > " + JSON.stringify(error));
          }
      };
      /**
      * Searches for the entities as specified by the given query.
      * @summary Search
      * @param { number } spaceId spaceId
      * @param { EntityQuery } query query The query restricts the transactions which are returned by the search.
      * @param {*} [options] Override http request options.
      * @return {  Array<Transaction>  }
      */
      TransactionService.prototype.search = function (spaceId, query, options) {
          if (options === void 0) { options = {}; }
          var localVarQueryParameters = {};
          var localVarHeaderParams = {};
          var localVarFormParams = {};
          // verify required parameter 'spaceId' is not null or undefined
          if (spaceId === null || spaceId === undefined) {
              throw new Error("Required parameter spaceId was null or undefined when calling search.");
          }
          // verify required parameter 'query' is not null or undefined
          if (query === null || query === undefined) {
              throw new Error("Required parameter query was null or undefined when calling search.");
          }
          if (spaceId !== undefined) {
              localVarQueryParameters["spaceId"] = ObjectSerializer.serialize(spaceId, "number");
          }
          for (var optionsHeadersKey in options.headers) {
              if (options.headers.hasOwnProperty(optionsHeadersKey)) {
                  localVarHeaderParams[optionsHeadersKey] = options.headers[optionsHeadersKey];
              }
          }
          var localVarUseFormData = false;
          var localVarRequestOptions = {
              method: "POST",
              queryString: localVarQueryParameters,
              headers: localVarHeaderParams,
              useQuerystring: this._useQuerystring,
              url: this.basePath,
              path: "/transaction/search",
              contentType: "application/json",
              body: JSON.stringify(ObjectSerializer.serialize(query, "EntityQuery")),
              form: {},
              formData: {}
          };
          if (Object.keys(localVarFormParams).length) {
              if (localVarUseFormData) {
                  localVarRequestOptions.formData = localVarFormParams;
              }
              else {
                  localVarRequestOptions.form = localVarFormParams;
              }
          }
          // dw.net.HTTPClient
          var response = this.httpService.callApi(localVarRequestOptions);
          if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
              var body = response.text;
              if (ObjectSerializer.primitives.indexOf("Array<Transaction>".toLowerCase()) !== -1) {
                  return body;
              }
              try {
                  body = JSON.parse(body);
                  body = ObjectSerializer.deserialize(body, "Array<Transaction>");
              }
              catch (e) {
                  dw.system.Logger.error("wallee > TransactionService > search > unable to parse JSON > " + JSON.stringify({ message: e.message, fileName: e.fileName, lineNumber: e.lineNumber }));
              }
              return body;
          }
          else {
              var error = {
                  type: "Unknown",
                  date: (new Date()).toUTCString(),
                  statusCode: response.statusCode,
                  statusMessage: response.statusMessage,
                  errorText: response.errorText
              };
              if (response.statusCode && response.statusCode >= 400 && response.statusCode <= 499) {
                  error.type = "ClientError";
              }
              else if (response.statusCode && response.statusCode >= 500 && response.statusCode <= 599) {
                  error.type = "ServerError";
              }
              throw new Error("wallee > TransactionService > search > " + error.type + " > " + JSON.stringify(error));
          }
      };
      /**
      * This updates the entity with the given properties. Only those properties which should be updated can be provided. The 'id' and 'version' are required to identify the entity.
      * @summary Update
      * @param { number } spaceId spaceId
      * @param { TransactionPending } entity entity The transaction object with the properties which should be updated.
      * @param {*} [options] Override http request options.
      * @return {  Transaction  }
      */
      TransactionService.prototype.update = function (spaceId, entity, options) {
          if (options === void 0) { options = {}; }
          var localVarQueryParameters = {};
          var localVarHeaderParams = {};
          var localVarFormParams = {};
          // verify required parameter 'spaceId' is not null or undefined
          if (spaceId === null || spaceId === undefined) {
              throw new Error("Required parameter spaceId was null or undefined when calling update.");
          }
          // verify required parameter 'entity' is not null or undefined
          if (entity === null || entity === undefined) {
              throw new Error("Required parameter entity was null or undefined when calling update.");
          }
          if (spaceId !== undefined) {
              localVarQueryParameters["spaceId"] = ObjectSerializer.serialize(spaceId, "number");
          }
          for (var optionsHeadersKey in options.headers) {
              if (options.headers.hasOwnProperty(optionsHeadersKey)) {
                  localVarHeaderParams[optionsHeadersKey] = options.headers[optionsHeadersKey];
              }
          }
          var localVarUseFormData = false;
          var localVarRequestOptions = {
              method: "POST",
              queryString: localVarQueryParameters,
              headers: localVarHeaderParams,
              useQuerystring: this._useQuerystring,
              url: this.basePath,
              path: "/transaction/update",
              contentType: "application/json",
              body: JSON.stringify(ObjectSerializer.serialize(entity, "TransactionPending")),
              form: {},
              formData: {}
          };
          if (Object.keys(localVarFormParams).length) {
              if (localVarUseFormData) {
                  localVarRequestOptions.formData = localVarFormParams;
              }
              else {
                  localVarRequestOptions.form = localVarFormParams;
              }
          }
          // dw.net.HTTPClient
          var response = this.httpService.callApi(localVarRequestOptions);
          if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
              var body = response.text;
              if (ObjectSerializer.primitives.indexOf("Transaction".toLowerCase()) !== -1) {
                  return body;
              }
              try {
                  body = JSON.parse(body);
                  body = ObjectSerializer.deserialize(body, "Transaction");
              }
              catch (e) {
                  dw.system.Logger.error("wallee > TransactionService > update > unable to parse JSON > " + JSON.stringify({ message: e.message, fileName: e.fileName, lineNumber: e.lineNumber }));
              }
              return body;
          }
          else {
              var error = {
                  type: "Unknown",
                  date: (new Date()).toUTCString(),
                  statusCode: response.statusCode,
                  statusMessage: response.statusMessage,
                  errorText: response.errorText
              };
              if (response.statusCode && response.statusCode >= 400 && response.statusCode <= 499) {
                  error.type = "ClientError";
              }
              else if (response.statusCode && response.statusCode >= 500 && response.statusCode <= 599) {
                  error.type = "ServerError";
              }
              throw new Error("wallee > TransactionService > update > " + error.type + " > " + JSON.stringify(error));
          }
      };
      /**
      *
      * @summary updateTransactionLineItems
      * @param { number } spaceId spaceId
      * @param { TransactionLineItemUpdateRequest } updateRequest updateRequest
      * @param {*} [options] Override http request options.
      * @return {  TransactionLineItemVersion  }
      */
      TransactionService.prototype.updateTransactionLineItems = function (spaceId, updateRequest, options) {
          if (options === void 0) { options = {}; }
          var localVarQueryParameters = {};
          var localVarHeaderParams = {};
          var localVarFormParams = {};
          // verify required parameter 'spaceId' is not null or undefined
          if (spaceId === null || spaceId === undefined) {
              throw new Error("Required parameter spaceId was null or undefined when calling updateTransactionLineItems.");
          }
          // verify required parameter 'updateRequest' is not null or undefined
          if (updateRequest === null || updateRequest === undefined) {
              throw new Error("Required parameter updateRequest was null or undefined when calling updateTransactionLineItems.");
          }
          if (spaceId !== undefined) {
              localVarQueryParameters["spaceId"] = ObjectSerializer.serialize(spaceId, "number");
          }
          for (var optionsHeadersKey in options.headers) {
              if (options.headers.hasOwnProperty(optionsHeadersKey)) {
                  localVarHeaderParams[optionsHeadersKey] = options.headers[optionsHeadersKey];
              }
          }
          var localVarUseFormData = false;
          var localVarRequestOptions = {
              method: "POST",
              queryString: localVarQueryParameters,
              headers: localVarHeaderParams,
              useQuerystring: this._useQuerystring,
              url: this.basePath,
              path: "/transaction/updateTransactionLineItems",
              contentType: "application/json",
              body: JSON.stringify(ObjectSerializer.serialize(updateRequest, "TransactionLineItemUpdateRequest")),
              form: {},
              formData: {}
          };
          if (Object.keys(localVarFormParams).length) {
              if (localVarUseFormData) {
                  localVarRequestOptions.formData = localVarFormParams;
              }
              else {
                  localVarRequestOptions.form = localVarFormParams;
              }
          }
          // dw.net.HTTPClient
          var response = this.httpService.callApi(localVarRequestOptions);
          if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
              var body = response.text;
              if (ObjectSerializer.primitives.indexOf("TransactionLineItemVersion".toLowerCase()) !== -1) {
                  return body;
              }
              try {
                  body = JSON.parse(body);
                  body = ObjectSerializer.deserialize(body, "TransactionLineItemVersion");
              }
              catch (e) {
                  dw.system.Logger.error("wallee > TransactionService > updateTransactionLineItems > unable to parse JSON > " + JSON.stringify({ message: e.message, fileName: e.fileName, lineNumber: e.lineNumber }));
              }
              return body;
          }
          else {
              var error = {
                  type: "Unknown",
                  date: (new Date()).toUTCString(),
                  statusCode: response.statusCode,
                  statusMessage: response.statusMessage,
                  errorText: response.errorText
              };
              if (response.statusCode && response.statusCode >= 400 && response.statusCode <= 499) {
                  error.type = "ClientError";
              }
              else if (response.statusCode && response.statusCode >= 500 && response.statusCode <= 599) {
                  error.type = "ServerError";
              }
              throw new Error("wallee > TransactionService > updateTransactionLineItems > " + error.type + " > " + JSON.stringify(error));
          }
      };
      return TransactionService;
  }());
  exports.TransactionService = TransactionService;
  module.exports = TransactionService;
  