Fix suspension
This commit is contained in:
@@ -6,10 +6,18 @@ meta {
|
||||
|
||||
post {
|
||||
url: {{baseurl}}/sim/pause
|
||||
body: none
|
||||
body: formUrlEncoded
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
params:query {
|
||||
:
|
||||
}
|
||||
|
||||
body:form-urlencoded {
|
||||
iccid: 8933201124059176320
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
|
||||
@@ -5,3 +5,4 @@ OBJ_CLI_ASSERTION=XOc7FtwXD8hUX2SFVX94XSty8wkOmChkwDNF09O_aIxPubMDdFUdCDCB4zpzSI
|
||||
OBJ_CLIENT_ID=savefamily_rest_ws
|
||||
OBJ_KID=xNfbMiyL1ORXGP8lElhcv8nVaG3EJKye4Lc1YoN3I1E
|
||||
OBJ_BASE_URL=https://api-getway.objenious.com/ws
|
||||
//OBJ_BASE_URL=https://api-getway.objenious.com/ws/test
|
||||
|
||||
@@ -119,7 +119,7 @@ export class SimUseCases {
|
||||
data: true
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error pausa", error)
|
||||
console.error("[Pausa Use case] Error pausa")
|
||||
return {
|
||||
error: "Error general pausando/suspendiendo la sim" + suspendData.identifier,
|
||||
data: undefined
|
||||
|
||||
@@ -123,28 +123,29 @@ export class SimController {
|
||||
|
||||
}
|
||||
|
||||
async pause(req: Request, res: Response) {
|
||||
public pause() {
|
||||
return async (req: Request, res: Response) => {
|
||||
const valido = this.validateBody(req.body, res)
|
||||
|
||||
const valido = this.validateBody(req.body, res)
|
||||
if (valido == false) return; // Si no es valido ya se ha enviado el error
|
||||
|
||||
if (valido == false) return; // Si no es valido ya se ha enviado el error
|
||||
const { iccid } = req.body
|
||||
const compañia = this.compañiaFromIccid(iccid)
|
||||
|
||||
const { iccid } = req.body
|
||||
const compañia = this.compañiaFromIccid(iccid)
|
||||
|
||||
try {
|
||||
await this.simUseCases.cancelation({ iccid, compañia })
|
||||
res.status(200).json({
|
||||
iccid: iccid,
|
||||
operation: "cancelation"
|
||||
})
|
||||
} catch (err) {
|
||||
console.error("Error pausando la sim ", req.body)
|
||||
res.status(500).json({
|
||||
errors: {
|
||||
msg: "Error pausando la sim"
|
||||
}
|
||||
})
|
||||
try {
|
||||
await this.simUseCases.pause({ iccid, compañia })
|
||||
res.status(200).json({
|
||||
iccid: iccid,
|
||||
operation: "cancelation"
|
||||
})
|
||||
} catch (err) {
|
||||
console.error("Error pausando la sim ", req.body)
|
||||
res.status(500).json({
|
||||
errors: {
|
||||
msg: "Error pausando la sim"
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ simRoutes.post("/activate", simController.activation)
|
||||
|
||||
simRoutes.post("/preActivate", simController.preactivation)
|
||||
|
||||
simRoutes.post("/pause", simController.pause)
|
||||
simRoutes.post("/pause", simController.pause())
|
||||
|
||||
simRoutes.post("/cancel", simController.cancelation)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user