"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getUrlTpv = void 0;
var _toUrlParams = require("./toUrlParams");
var _ButtonPayment = require("../ButtonPayment.constants");
const _excluded = ["environment", "id", "locale", "tpvNumOrder", "tracking", "urlParams"];
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
const getUrlTpv = _ref => {
  let environment = _ref.environment,
    id = _ref.id,
    locale = _ref.locale,
    tpvNumOrder = _ref.tpvNumOrder,
    tracking = _ref.tracking,
    _ref$urlParams = _ref.urlParams,
    _ref$urlParams2 = _ref$urlParams === void 0 ? {} : _ref$urlParams,
    _ref$urlParams2$hsri = _ref$urlParams2.hsri,
    hsri = _ref$urlParams2$hsri === void 0 ? _ButtonPayment.DEFAULT_HSRI : _ref$urlParams2$hsri,
    idchain = _ref$urlParams2.idchain,
    variant = _ref$urlParams2.variant,
    others = _objectWithoutProperties(_ref, _excluded);
  if (!tpvNumOrder || !id || !locale) return;
  const redsysTokenization = others.redsysTokenization,
    sipayRequestId = others.sipayRequestId,
    checkoutToken = others.checkoutToken,
    paycometToken = others.paycometToken,
    alternativePaymentMethodSelected = others.alternativePaymentMethodSelected;
  return "".concat(process.env.SERVICE_BOOKING, "/").concat(_ButtonPayment.ENDPOINT.TPV).concat((0, _toUrlParams.toUrlParams)({
    alternativePaymentMethodSelected,
    checkoutToken,
    env: environment,
    hsri,
    idchain,
    idTokenProvider: id,
    lang: locale.split('-')[0],
    numOrder: tpvNumOrder,
    paycometToken,
    redsysTokenization,
    sipayRequestId,
    tracking,
    variant,
    version: 2
  }));
};
exports.getUrlTpv = getUrlTpv;
//# sourceMappingURL=getUrlTpv.js.map