"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getButtonPaymentKey = void 0;
var _locale = require("@mirai/locale");
var _getButtonPaymentKey = require("./getButtonPaymentKey.l10n");
var _helpers = require("../../helpers");
const {
  APLAZAME,
  CARD,
  PCIPROXY,
  TPV
} = _helpers.PAYMENT_METHOD;
const {
  ACTION_SAVE,
  ACTION_CONTINUE,
  ACTION_PAY_NOW
} = _getButtonPaymentKey.L10N;
const getButtonPaymentKey = function () {
  let {
    cardValidation,
    date,
    method
  } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  return [CARD, PCIPROXY].includes(method) && !cardValidation ? ACTION_SAVE : method === CARD && cardValidation || method === APLAZAME || method == TPV && date && (0, _locale.dateDiff)((0, _locale.UTC)(new Date()), (0, _locale.parseDate)(date)).days > 0 ? ACTION_CONTINUE : ACTION_PAY_NOW;
};
exports.getButtonPaymentKey = getButtonPaymentKey;
//# sourceMappingURL=getButtonPaymentKey.js.map