"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,
      id,
      locale,
      tpvNumOrder,
      tracking,
      urlParams: {
        hsri = _ButtonPayment.DEFAULT_HSRI,
        idchain,
        variant
      } = {}
    } = _ref,
    others = _objectWithoutProperties(_ref, _excluded);
  if (!tpvNumOrder || !id || !locale) return;
  const {
    redsysTokenization,
    sipayRequestId,
    checkoutToken,
    paycometToken,
    alternativePaymentMethodSelected
  } = others;
  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