"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getCaption = void 0;
var _locale = require("@mirai/locale");
var _Payment = require("../Payment.constants");
var _Payment2 = require("../Payment.l10n");
const {
  APLAZAME,
  CARD,
  TRANSFER,
  OXXO,
  PAYLATER,
  PCIPROXY,
  TPV
} = _Payment.METHOD;
const {
  ADDON,
  CARDNET,
  LINKAGEPAY,
  OPENPAY,
  REDSYS,
  STRIPE
} = _Payment.PROVIDER;
const getCaption = function () {
  let {
    amount,
    cardValidation = false,
    date,
    method,
    provider
  } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  const {
    days
  } = amount > 0 && date ? (0, _locale.dateDiff)((0, _locale.UTC)(new Date()), date) : {};
  let caption = _Payment2.L10N.LABEL_REDIRECT;
  if ([OXXO, TRANSFER].includes(method)) caption = _Payment2.L10N.LABEL_REDIRECT_MORE_INFO;else if (method === TPV && provider === CARDNET) caption = _Payment2.L10N.LABEL_REDIRECT_CARDNET;else if (method === TPV && [ADDON, REDSYS, STRIPE].includes(provider) && days > 0) caption = _Payment2.L10N.LABEL_CAPTION_DEFERRED;else if (method === APLAZAME) caption = _Payment2.L10N.LABEL_REDIRECT_APLAZAME;else if (method === PAYLATER) caption = _Payment2.L10N.LABEL_CAPTION_PAYLATER;else if ([CARD, PCIPROXY].includes(method)) caption = cardValidation ? _Payment2.L10N.LABEL_REDIRECT_CARD_PREPAYMENT : undefined;else if ([LINKAGEPAY, OPENPAY].includes(provider)) caption = undefined;
  return caption;
};
exports.getCaption = getCaption;
//# sourceMappingURL=getCaption.js.map