Bug preactivacion si id de operacion
This commit is contained in:
@@ -15,7 +15,9 @@ params:query {
|
|||||||
}
|
}
|
||||||
|
|
||||||
body:form-urlencoded {
|
body:form-urlencoded {
|
||||||
iccid: 8933201125065160380
|
iccid: 8934909001500954922
|
||||||
|
offer: mensual
|
||||||
|
orderId: test
|
||||||
}
|
}
|
||||||
|
|
||||||
settings {
|
settings {
|
||||||
|
|||||||
@@ -84,12 +84,14 @@ export class SimAlaiController {
|
|||||||
|
|
||||||
public preactivate() {
|
public preactivate() {
|
||||||
return async (msg: ConsumeMessage) => {
|
return async (msg: ConsumeMessage) => {
|
||||||
console.log("[i] Evento activate ", msg.fields)
|
console.log("[i] Evento preactivate ", msg)
|
||||||
const data = this.validateMsg(msg) as SimEvents.activation
|
const data = this.validateMsg(msg) as SimEvents.preActivation
|
||||||
const iccid = data.payload.iccid
|
const iccid = data.payload.iccid
|
||||||
const correlation_id = data.headers?.message_id
|
const correlation_id = data.headers?.message_id
|
||||||
const externalId = data.payload.orderId
|
const externalId = data.payload.orderId
|
||||||
|
|
||||||
|
console.log("MSG:", data, data.headers)
|
||||||
|
|
||||||
const res = await this.tryUseCase(msg, this.uscases.preactivate({
|
const res = await this.tryUseCase(msg, this.uscases.preactivate({
|
||||||
iccid: iccid,
|
iccid: iccid,
|
||||||
correlation_id: correlation_id,
|
correlation_id: correlation_id,
|
||||||
@@ -133,7 +135,7 @@ export class SimAlaiController {
|
|||||||
|
|
||||||
public terminate() {
|
public terminate() {
|
||||||
return async (msg: ConsumeMessage) => {
|
return async (msg: ConsumeMessage) => {
|
||||||
console.log("Evento reActivate ", msg.fields)
|
console.log("Evento reActivate ", msg.fields, msg)
|
||||||
const data = this.validateMsg(msg) as SimEvents.reActivation
|
const data = this.validateMsg(msg) as SimEvents.reActivation
|
||||||
const iccid = data.payload.iccid
|
const iccid = data.payload.iccid
|
||||||
const correlation_id = data.headers?.message_id
|
const correlation_id = data.headers?.message_id
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ export class SimAlaiRouter {
|
|||||||
["pause", this.simController.suspend()],
|
["pause", this.simController.suspend()],
|
||||||
["reactivate", this.simController.reActivate()],
|
["reactivate", this.simController.reActivate()],
|
||||||
["cancel", this.simController.terminate()],
|
["cancel", this.simController.terminate()],
|
||||||
["preActivate", this.simController.preactivate()]
|
["preactivate", this.simController.preactivate()]
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export class SimRouter {
|
|||||||
["pause", this.simController.suspend()],
|
["pause", this.simController.suspend()],
|
||||||
["cancel", this.simController.terminate()],
|
["cancel", this.simController.terminate()],
|
||||||
["reactivate", this.simController.reActivate()],
|
["reactivate", this.simController.reActivate()],
|
||||||
["preActivate", this.simController.preActivate()]
|
["preactivate", this.simController.preActivate()]
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ export class SimUseCases {
|
|||||||
console.log("Sim preactivada con exito", resp.data)
|
console.log("Sim preactivada con exito", resp.data)
|
||||||
const operation: ObjeniousOperation = {
|
const operation: ObjeniousOperation = {
|
||||||
correlation_id: preActivateData.correlation_id,
|
correlation_id: preActivateData.correlation_id,
|
||||||
operation: "preActivate",
|
operation: "preactivate",
|
||||||
iccids: String(preActivateData.identifier.identifiers),
|
iccids: String(preActivateData.identifier.identifiers),
|
||||||
status: "noMassID",
|
status: "noMassID",
|
||||||
request_id: resp.data.requestId
|
request_id: resp.data.requestId
|
||||||
|
|||||||
@@ -164,15 +164,16 @@ export class SimUsecases {
|
|||||||
Promise<Result<string, { iccid: string, message_id: string, operation: "preactivation" }>> {
|
Promise<Result<string, { iccid: string, message_id: string, operation: "preactivation" }>> {
|
||||||
|
|
||||||
const preActivationEvent = <SimEvents.preActivation>{
|
const preActivationEvent = <SimEvents.preActivation>{
|
||||||
key: `sim.${args.compañia}.preActivate`,
|
key: `sim.${args.compañia}.preactivate`,
|
||||||
payload: {
|
payload: {
|
||||||
iccid: args.iccid
|
iccid: args.iccid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log("[d] Pre - activation ", preActivationEvent)
|
|
||||||
await this.eventBus.publish([preActivationEvent])
|
const preActivationWithId = this.addMessage_id(preActivationEvent)
|
||||||
const preactivationWithId = this.addMessage_id(preActivationEvent)
|
console.log("[d] Pre - activation ", preActivationWithId)
|
||||||
const createdOrder = await this.saveOrder<SimEvents.preActivation>(preactivationWithId)
|
await this.eventBus.publish([preActivationWithId])
|
||||||
|
const createdOrder = await this.saveOrder<SimEvents.preActivation>(preActivationWithId)
|
||||||
if (createdOrder.error != undefined) {
|
if (createdOrder.error != undefined) {
|
||||||
console.error(createdOrder.error)
|
console.error(createdOrder.error)
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -18,9 +18,10 @@ export namespace SimEvents {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type preActivation = DomainEvent & {
|
export type preActivation = DomainEvent & {
|
||||||
key: `sim.${string}.preActivate`,
|
key: `sim.${string}.preactivate`,
|
||||||
payload: {
|
payload: {
|
||||||
iccid: string
|
iccid: string,
|
||||||
|
orderId?: string // Solo Alai
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user