Fix suspension && paso a plantilla de caso de uso
This commit is contained in:
@@ -143,7 +143,7 @@ export class SimController {
|
||||
}
|
||||
|
||||
const iccid = msgData.payload.iccid
|
||||
const res = await this.tryUseCase(msg, this.useCases.suspend({
|
||||
const res = await this.tryUseCase(msg, this.useCases.reActivate({
|
||||
dueDate: this.genDueDate(2 * 60).toISOString(),
|
||||
identifier: {
|
||||
identifierType: "ICCID",
|
||||
|
||||
@@ -51,7 +51,7 @@ export class SimUseCases {
|
||||
operation: string,
|
||||
operationPayload: PAYLOAD,
|
||||
iccid: string
|
||||
onError: (_: any) => void
|
||||
onError?: (_: any) => void
|
||||
// on code response??
|
||||
}): () => Promise<Result<string, boolean>> {
|
||||
return async () => {
|
||||
@@ -79,7 +79,7 @@ export class SimUseCases {
|
||||
if (args.correlation_id != undefined) {
|
||||
this.orderRepository.updateOrder({
|
||||
correlation_id: args.correlation_id!,
|
||||
new_status: "running",
|
||||
new_status: "running", // Siempre es runing la primera vez que se consume
|
||||
})
|
||||
.then(e => console.log("Order actualizado: ", e))
|
||||
.catch(e => console.error("Error actualizando order", args.correlation_id))
|
||||
@@ -220,8 +220,17 @@ export class SimUseCases {
|
||||
}
|
||||
}
|
||||
|
||||
// Metodo nuevo
|
||||
public suspend(suspendData: ActionData): () => Promise<Result<string, boolean>> {
|
||||
const OPERATION_URL = "/actions/suspendLine"
|
||||
return this.generateUseCase({
|
||||
correlation_id: suspendData.correlation_id,
|
||||
operationPayload: suspendData,
|
||||
url: OPERATION_URL,
|
||||
iccid: suspendData.identifier.identifiers,
|
||||
operation: "suspend"
|
||||
})
|
||||
|
||||
return async () => {
|
||||
const req = this.httpClient.client.post(OPERATION_URL, {
|
||||
...suspendData
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
|
||||
export type ActionData = {
|
||||
correlation_id?: string;
|
||||
dueDate: string, // isodate
|
||||
filter?: {} // no se si hace falta
|
||||
identifier: {
|
||||
identifiers: string[]
|
||||
identifiers: string
|
||||
identifierType: "IMSI" | "MSISDN" | "REFERENCE" | "ICCID" | "IMEI"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user