envio-comprobantes-sri
Version:
Envia comprobantes electronicos al SRI (Ecuador). Recibe un objeto JSON. Lo convierte a XML, lo firma, lo envía al servicio web del SRI y devuelve la respuesta.
13 lines (12 loc) • 1.02 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.VALIDATION_CURRENCY_NUMBER = exports.MIN_CURRENCY_MANDATORY = exports.MAX_CURRENCY_VALUE = exports.Transform2Places = exports.REGEXP_ddMMyyyy = exports.REGEXP_NUMERO_COMPROBANTE = void 0;
exports.REGEXP_NUMERO_COMPROBANTE = /^\d{3}\-\d{3}-\d{9}$/;
exports.REGEXP_ddMMyyyy = /^(?:(?:31(\/)(?:0?[13578]|1[02]))\1|(?:(?:29|30)(\/)(?:0?[13-9]|1[0-2])\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})$|^(?:29(\/)0?2\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:0?[1-9]|1\d|2[0-8])(\/|-|\.)(?:(?:0?[1-9])|(?:1[0-2]))\4(?:(?:1[6-9]|[2-9]\d)?\d{2})$/;
function Transform2Places(param) {
return (typeof param.value === typeof 1) ? +param.value.toFixed(2) : param.value;
}
exports.Transform2Places = Transform2Places;
exports.MAX_CURRENCY_VALUE = 99999999999.99;
exports.MIN_CURRENCY_MANDATORY = 0.01;
exports.VALIDATION_CURRENCY_NUMBER = { maxDecimalPlaces: 2, allowInfinity: false, allowNaN: false };