Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1b6da651a6 | |||
| 9b305f887f | |||
| 9506b9e28e | |||
| 61c0edca07 | |||
| 9470b5605d |
@@ -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
|
||||||
|
|||||||
10
packages/sim-objenious-cron/config/env/index.ts
vendored
10
packages/sim-objenious-cron/config/env/index.ts
vendored
@@ -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")
|
||||||
|
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|||||||
@@ -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"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -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]
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user