Todas las acciones de lineas de objenious
This commit is contained in:
@@ -64,7 +64,7 @@ export class SimController {
|
||||
}
|
||||
}
|
||||
|
||||
public activateSim() {
|
||||
public activate() {
|
||||
return async (msg: ConsumeMessage) => {
|
||||
let msgData;
|
||||
try {
|
||||
@@ -73,26 +73,83 @@ export class SimController {
|
||||
throw new Error("Error consumiendo el mensaje no es valido" + String(e))
|
||||
}
|
||||
|
||||
if (msgData == undefined || msgData.payload == undefined) throw new Error("Mensaje invalido")
|
||||
const iccid = msgData.payload.iccid
|
||||
const offer = msgData.payload.offer
|
||||
|
||||
if (offer == undefined) throw new Error("Error activando la sim, no se ha especificado la oferta")
|
||||
|
||||
this.tryUseCase(msg, this.useCases.activate({
|
||||
dueDate: this.genDueDate(2 * 60).toISOString(),
|
||||
identifier: {
|
||||
identifierType: "ICCID",
|
||||
identifiers: [iccid]
|
||||
},
|
||||
offer: {
|
||||
code: offer,
|
||||
services: []
|
||||
}
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
public suspendSim() {
|
||||
public preActivate() {
|
||||
return async (msg: ConsumeMessage) => {
|
||||
let msgData;
|
||||
try {
|
||||
msgData = this.validateMsg(msg) as SimEvents.pause
|
||||
} catch (e) {
|
||||
throw new Error("Error consumiendo el mensaje no es valido" + String(e))
|
||||
throw new Error("Error de preactivacion consumiendo el mensaje no es valido" + String(e))
|
||||
}
|
||||
|
||||
if (msgData == undefined) {
|
||||
return Promise.reject("Mensaje invalido")
|
||||
}
|
||||
|
||||
const iccid = msgData.payload.iccid
|
||||
this.tryUseCase(msg, this.useCases.preActivate({
|
||||
dueDate: this.genDueDate(2 * 60).toISOString(),
|
||||
identifier: {
|
||||
identifierType: "ICCID",
|
||||
identifiers: [iccid]
|
||||
}
|
||||
}))
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public reActivate() {
|
||||
return async (msg: ConsumeMessage) => {
|
||||
let msgData;
|
||||
try {
|
||||
msgData = this.validateMsg(msg) as SimEvents.pause
|
||||
} catch (e) {
|
||||
throw new Error("Error de reactivacion consumiendo el mensaje no es valido" + String(e))
|
||||
}
|
||||
|
||||
if (msgData == undefined) {
|
||||
return Promise.reject("Mensaje invalido")
|
||||
}
|
||||
|
||||
const iccid = msgData.payload.iccid
|
||||
this.tryUseCase(msg, this.useCases.suspend({
|
||||
dueDate: this.genDueDate(2 * 60).toISOString(),
|
||||
identifier: {
|
||||
identifierType: "ICCID",
|
||||
identifiers: [iccid]
|
||||
}
|
||||
}))
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public suspend() {
|
||||
return async (msg: ConsumeMessage) => {
|
||||
let msgData;
|
||||
try {
|
||||
msgData = this.validateMsg(msg) as SimEvents.pause
|
||||
} catch (e) {
|
||||
throw new Error("Error de suspension consumiendo el mensaje no es valido" + String(e))
|
||||
}
|
||||
|
||||
if (msgData == undefined) {
|
||||
|
||||
Reference in New Issue
Block a user