La conexión con alai funciona
This commit is contained in:
@@ -6,7 +6,8 @@ info:
|
||||
http:
|
||||
method: POST
|
||||
url: "{{baseurl}}/v1/order"
|
||||
auth: inherit
|
||||
auth:
|
||||
type: bearer
|
||||
|
||||
settings:
|
||||
encodeUrl: true
|
||||
|
||||
22
docs/sim-alai/SIM.yml
Normal file
22
docs/sim-alai/SIM.yml
Normal file
@@ -0,0 +1,22 @@
|
||||
info:
|
||||
name: SIM
|
||||
type: http
|
||||
seq: 4
|
||||
|
||||
http:
|
||||
method: GET
|
||||
url: "{{baseurl}}/v1/sim/{{iccid}}"
|
||||
auth:
|
||||
type: bearer
|
||||
token: ""
|
||||
|
||||
runtime:
|
||||
variables:
|
||||
- name: iccid
|
||||
value: "8934909001500561503"
|
||||
|
||||
settings:
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
followRedirects: true
|
||||
maxRedirects: 5
|
||||
16
docs/sim-api/Alai/Preactivate.bru
Normal file
16
docs/sim-api/Alai/Preactivate.bru
Normal file
@@ -0,0 +1,16 @@
|
||||
meta {
|
||||
name: Preactivate
|
||||
type: http
|
||||
seq: 2
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{baseAlai}}/preactivate
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
20
docs/sim-api/Alai/Select SIM.bru
Normal file
20
docs/sim-api/Alai/Select SIM.bru
Normal file
@@ -0,0 +1,20 @@
|
||||
meta {
|
||||
name: Select SIM
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{baseAlai}}/select/?iccid=8934909001500561503
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
params:query {
|
||||
iccid: 8934909001500561503
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
8
docs/sim-api/Alai/folder.bru
Normal file
8
docs/sim-api/Alai/folder.bru
Normal file
@@ -0,0 +1,8 @@
|
||||
meta {
|
||||
name: Alai
|
||||
seq: 15
|
||||
}
|
||||
|
||||
auth {
|
||||
mode: inherit
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
vars {
|
||||
baseurl: http://localhost:3000
|
||||
baseAlai: http://localhost:3002
|
||||
}
|
||||
color: #2E8A54
|
||||
|
||||
@@ -1 +1 @@
|
||||
eyJhbGciOiJIUzM4NCJ9.eyJiciI6InNhdmVmYW1pbHkiLCJpcCI6IjUyLjIxNC4xMTIuMTgxIiwic3ViIjoiaW5mb3NhdmVmYW1pbHkiLCJzIjoiRVdTMTY0NjI4YjE0MmRlZWI3IiwicG9zIjoic2F2ZWZhbWlseUNhYyIsImlkV3NVc2VyIjoiODkiLCJpc012bmEiOmZhbHNlLCJkb21haW4iOiJBbGFpfHNhdmVmYW1pbHkiLCJpYXQiOjE3Nzc4OTA0ODEsImV4cCI6MTc3NzkwMTI4MX0.SNO14ONoayy7MEnauSsT7H4To7bbW_GYTq1ZvC2IdcdHZq8oOLlVPAJyu3uMXHRk
|
||||
eyJhbGciOiJIUzM4NCJ9.eyJiciI6InNhdmVmYW1pbHkiLCJpcCI6Ijg4LjE1LjE1Ny4xNjciLCJzdWIiOiJwYWxvbWFpYmFuZXoiLCJzIjoiRVdTMTY0NmFmNjNlZGUyMjgzIiwicG9zIjoic2F2ZWZhbWlseUNhYyIsImlkV3NVc2VyIjoiODYiLCJpc012bmEiOmZhbHNlLCJkb21haW4iOiJBbGFpfHNhdmVmYW1pbHkiLCJpYXQiOjE3Nzc4OTk3MzcsImV4cCI6MTc3NzkxMDUzN30.PvTTRhUpKlslGOerQsLY4RLBXdQ5FIVvUKb_1ZK4b2Zggt04KZhwX0d-XoLAcP93
|
||||
|
||||
@@ -14,6 +14,7 @@ try {
|
||||
console.error("Error cargando el .env desde ./.env")
|
||||
}
|
||||
|
||||
|
||||
export const env = {
|
||||
ENVIRONMENT: process.env.ENVIORMENT,
|
||||
POSTGRES_USER: process.env.POSTGRES_USER,
|
||||
@@ -32,8 +33,8 @@ export const env = {
|
||||
RABBITMQ_RETRY_INTERVAL: process.env.RABBITMQ_INTERVAL,
|
||||
RABBITMQ_VHOST: String(process.env.RABBITMQ_VHOST),
|
||||
|
||||
ALAI_PORT: Number(process.env.APP_PORT),
|
||||
ALAI_HOST: String(process.env.APP_HOST),
|
||||
ALAI_PORT: parseInt(process.env.ALAI_PORT ?? "3002"),
|
||||
ALAI_HOST: String(process.env.ALAI_HOST),
|
||||
|
||||
// ESPECIFICO ALAI
|
||||
ALAI_API_URL: process.env.ALAI_API_URL,
|
||||
|
||||
@@ -52,8 +52,13 @@ async function startWorker() {
|
||||
|
||||
// WIP
|
||||
app.get("/select", alaiController.selectREST())
|
||||
app.get("/health",
|
||||
(req, res) => res.json({
|
||||
ok: "alai"
|
||||
}))
|
||||
//app.get("/selectPage", alaiController.selectPageREST())
|
||||
|
||||
console.log(PORT, HOSTNAME)
|
||||
app.listen(PORT, HOSTNAME, (e) => {
|
||||
if (e == undefined) {
|
||||
console.log("[o] Servidor (Alai) iniciado en el puerto %d", PORT)
|
||||
@@ -61,7 +66,6 @@ async function startWorker() {
|
||||
console.error("Error express ", e)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
startWorker()
|
||||
@@ -69,7 +73,7 @@ startWorker()
|
||||
console.log("[o] Worker de SIM de Alai iniciado")
|
||||
})
|
||||
.catch(e => {
|
||||
console.log("[x] Error iniciando worker de SIM de Alai")
|
||||
console.log("[x] Error iniciando worker de SIM de Alai", e)
|
||||
})
|
||||
|
||||
export default {}
|
||||
|
||||
@@ -108,7 +108,7 @@ export class AlaiRepository {
|
||||
|
||||
public async getSimByICCID(iccid: string) {
|
||||
const endpoint = `/v1/sim/${iccid}`
|
||||
const promReq = this.httpClient.post<AlaiAPI.Sim | undefined>(endpoint, undefined)
|
||||
const promReq = this.httpClient.get<AlaiAPI.Sim | undefined>(endpoint, undefined)
|
||||
const res = await this.manageRequest(promReq)
|
||||
return res
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ export class HttpClient {
|
||||
headers: Record<string, string>,
|
||||
jwtManager: JWTProvider<{}>, // todo: asociar el tipo de token
|
||||
jwtService?: IJWTService<any>,
|
||||
httpsAgent: https.Agent
|
||||
httpsAgent?: https.Agent
|
||||
}) {
|
||||
this.client = axios.create({
|
||||
baseURL: args.baseURL,
|
||||
|
||||
24
yarn.lock
24
yarn.lock
@@ -2943,6 +2943,30 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"sim-consumidor-alai@workspace:packages/sim-consumidor-alai":
|
||||
version: 0.0.0-use.local
|
||||
resolution: "sim-consumidor-alai@workspace:packages/sim-consumidor-alai"
|
||||
dependencies:
|
||||
"@tsconfig/node22": "npm:*"
|
||||
"@types/amqplib": "npm:^0.10.8"
|
||||
"@types/cors": "npm:*"
|
||||
"@types/express": "npm:*"
|
||||
"@types/node": "npm:*"
|
||||
"@types/supertest": "npm:*"
|
||||
amqplib: "npm:^0.10.9"
|
||||
cors: "npm:*"
|
||||
dotenv: "npm:*"
|
||||
express: "npm:*"
|
||||
prettier: "npm:*"
|
||||
sim-shared: "sim-shared:*"
|
||||
supertest: "npm:*"
|
||||
tsc-alias: "npm:^1.8.16"
|
||||
tsx: "npm:*"
|
||||
typescript: "npm:*"
|
||||
vitest: "npm:*"
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"sim-consumidor-nos@workspace:packages/sim-consumidor-nos":
|
||||
version: 0.0.0-use.local
|
||||
resolution: "sim-consumidor-nos@workspace:packages/sim-consumidor-nos"
|
||||
|
||||
Reference in New Issue
Block a user