"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 = _Payment.METHOD.APLAZAME,
  CARD = _Payment.METHOD.CARD,
  TRANSFER = _Payment.METHOD.TRANSFER,
  OXXO = _Payment.METHOD.OXXO,
  PAYLATER = _Payment.METHOD.PAYLATER,
  PCIPROXY = _Payment.METHOD.PCIPROXY,
  TPV = _Payment.METHOD.TPV;
const ADDON = _Payment.PROVIDER.ADDON,
  CARDNET = _Payment.PROVIDER.CARDNET,
  LINKAGEPAY = _Payment.PROVIDER.LINKAGEPAY,
  OPENPAY = _Payment.PROVIDER.OPENPAY,
  REDSYS = _Payment.PROVIDER.REDSYS,
  STRIPE = _Payment.PROVIDER.STRIPE;
const getCaption = function () {
  let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
    amount = _ref.amount,
    _ref$cardValidation = _ref.cardValidation,
    cardValidation = _ref$cardValidation === void 0 ? false : _ref$cardValidation,
    date = _ref.date,
    method = _ref.method,
    provider = _ref.provider;
  const _ref2 = amount > 0 && date ? (0, _locale.dateDiff)((0, _locale.UTC)(new Date()), date) : {},
    days = _ref2.days;
  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