5 Commits
1.3.0 ... 1.3.1

Author SHA1 Message Date
1b6da651a6 Ajustado el periodo de comprobaciones 2026-03-27 12:47:10 +01:00
9b305f887f Test .env ajustado 2026-03-27 12:24:20 +01:00
9506b9e28e Error de nombre de activacion 2026-03-27 10:59:15 +01:00
61c0edca07 Logs del envio 2026-03-27 10:52:03 +01:00
9470b5605d Pribando el env 2026-03-27 10:50:03 +01:00
6 changed files with 14 additions and 10 deletions

View File

@@ -7,6 +7,6 @@ OBJ_KID=xNfbMiyL1ORXGP8lElhcv8nVaG3EJKye4Lc1YoN3I1E
OBJ_BASE_URL=https://api-getway.objenious.com/ws OBJ_BASE_URL=https://api-getway.objenious.com/ws
# OBJ_BASE_URL=https://api-getway.objenious.com/ws/test # OBJ_BASE_URL=https://api-getway.objenious.com/ws/test
# NOTIFICATION_URL="https://sf-sim-activation.savefamilygps.net/send-activation-mail" NOTIFICATION_URL="https://sf-sim-activation.savefamilygps.net/send-activation-mail"
NOTIFICATION_URL="localhost" # NOTIFICATION_URL="localhost"
SIM_ACTIVATION_API_KEY=9e48c4ac-1ab0-4397-b3f3-6c239200dfe6 SIM_ACTIVATION_API_KEY=9e48c4ac-1ab0-4397-b3f3-6c239200dfe6

View File

@@ -31,15 +31,15 @@ export const env = {
OBJ_KID: String(process.env.OBJ_KID), OBJ_KID: String(process.env.OBJ_KID),
OBJ_BASE_URL: String(process.env.OBJ_BASE_URL), OBJ_BASE_URL: String(process.env.OBJ_BASE_URL),
NOTIFICATION_URL: String(process.env.NOTIFICATION_URL), NOTIFICATION_URL: String(process.env.NOTIFICATION_URL ?? ""),
SIM_ACTIVATION_API_KEY: String(process.env.SIM_ACTIVATION_API_KEY) SIM_ACTIVATION_API_KEY: String(process.env.SIM_ACTIVATION_API_KEY ?? "")
}; };
// assert las partes criticas // assert las partes criticas
assert(env.RABBITMQ_PASSWORD != undefined) assert(env.RABBITMQ_PASSWORD != undefined)
assert(env.RABBITMQ_USER != undefined) assert(env.RABBITMQ_USER != undefined)
assert(env.SIM_ACTIVATION_API_KEY != undefined) assert(env.SIM_ACTIVATION_API_KEY != "")
assert(env.NOTIFICATION_URL != undefined) assert(env.NOTIFICATION_URL != "")
if (env.ENVIRONMENT == "production") { if (env.ENVIRONMENT == "production") {
assert(env.RABBITMQ_PASSWORD != "guest") assert(env.RABBITMQ_PASSWORD != "guest")
@@ -47,3 +47,5 @@ if (env.ENVIRONMENT == "production") {
} }
console.log("[i] verificado env")

View File

@@ -33,7 +33,7 @@ async function startCron() {
const volcadoLineasTask = new TaskVolcadoLineas(httpClient, objeniousLineRepository) const volcadoLineasTask = new TaskVolcadoLineas(httpClient, objeniousLineRepository)
const PERIODO_PETICIONES = 10 * 60 * 60 const PERIODO_PETICIONES = 10 * 60 * 1000
const interval = setInterval(async () => { const interval = setInterval(async () => {
try { try {
await objTask.getPendingOperations() await objTask.getPendingOperations()

View File

@@ -32,7 +32,7 @@
}, },
"scripts": { "scripts": {
"test": "node --import tsx --test ./**/*.test.ts", "test": "node --import tsx --test ./**/*.test.ts",
"build": "tsc --build && tsc-alias -p tsconfig.json && cp package.json ../../dist/packages/sim-objenious-cron/", "build": "tsc --build && tsc-alias -p tsconfig.json && cp .env package.json ../../dist/packages/sim-objenious-cron/",
"dev": "tsx watch index.ts", "dev": "tsx watch index.ts",
"start": "node ../../dist/packages/sim-objenious-cron/index.js" "start": "node ../../dist/packages/sim-objenious-cron/index.js"
}, },

View File

@@ -137,7 +137,7 @@ export class CheckObjeniousRequests {
}) })
} }
if (originalAction.operation == "activation") { if (originalAction.operation == "activate") {
this.notifyFinalization({ this.notifyFinalization({
...originalAction, ...originalAction,
msisdn msisdn
@@ -300,6 +300,8 @@ export class CheckObjeniousRequests {
* al servicio que manda los mails * al servicio que manda los mails
*/ */
private async notifyFinalization(operation: ObjeniousOperation & { msisdn: string }) { private async notifyFinalization(operation: ObjeniousOperation & { msisdn: string }) {
console.log("[i] Enviando activacion a", env.NOTIFICATION_URL)
console.log("[i] Operation", operation)
const req = axios.post(env.NOTIFICATION_URL, { const req = axios.post(env.NOTIFICATION_URL, {
...operation, ...operation,
iccids: [operation.iccids] iccids: [operation.iccids]

View File

@@ -12,7 +12,7 @@ export type ObjeniousOperation = {
id?: number; id?: number;
/** Uuid del mensaje asociado a la operacion */ /** Uuid del mensaje asociado a la operacion */
correlation_id?: string; correlation_id?: string;
operation: string; operation: "activate" | string; // TODO: completar y actualizar
retry_count?: number; retry_count?: number;
max_retry?: number; max_retry?: number;
max_date_retry?: string | null; max_date_retry?: string | null;