"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getComponent = void 0;
var _constants = require("./constants");
var _components = require("../components");
var _Payment = require("../Payment.constants");
const APLAZAME = _Payment.METHOD.APLAZAME,
  CARD = _Payment.METHOD.CARD,
  CARD_PREPAY = _Payment.METHOD.CARD_PREPAY,
  PCIPROXY = _Payment.METHOD.PCIPROXY,
  TPV = _Payment.METHOD.TPV;
const HIPAY = _Payment.PROVIDER.HIPAY,
  MULTIPAGOS = _Payment.PROVIDER.MULTIPAGOS,
  OPENPAY = _Payment.PROVIDER.OPENPAY,
  PAYBOX = _Payment.PROVIDER.PAYBOX,
  REDSYS = _Payment.PROVIDER.REDSYS,
  REDUNIQ = _Payment.PROVIDER.REDUNIQ;
const getComponent = function () {
  let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
    cardValidation = _ref.cardValidation,
    method = _ref.method,
    methodConfig = _ref.methodConfig,
    provider = _ref.provider;
  let component;
  if (methodConfig) component = _constants.COMPONENTS[methodConfig.component];else if ([CARD, CARD_PREPAY, PCIPROXY].includes(method) && !cardValidation) component = method === PCIPROXY ? _components.PCI : _components.Card;else if (method === TPV && [HIPAY, MULTIPAGOS, PAYBOX, REDSYS, REDUNIQ].includes(provider)) component = _components.Tpv;else if (method === TPV && provider === OPENPAY) component = _components.Openpay;else if (method === APLAZAME) component = _components.Aplazame;
  return component;
};
exports.getComponent = getComponent;
//# sourceMappingURL=getComponent.js.map