42 lines
881 B
TypeScript
42 lines
881 B
TypeScript
import { HttpClient } from "#shared/infrastructure/HTTPClient"
|
|
|
|
// TODO: Pasar a un archivo de DTOs
|
|
|
|
export type ActivationData = {
|
|
dueDate: string, // isodate
|
|
filter?: {} // no se si hace falta
|
|
identifier: {
|
|
identifiers: string[]
|
|
identifierType: "IMSI" | "MSISDN" | "REFERENCE" | "ICCID" | "IMEI"
|
|
}
|
|
}
|
|
|
|
export type ResponseError = {
|
|
error: string,
|
|
detail: Object[]
|
|
}
|
|
|
|
export class SimActivationUseCase {
|
|
private httpClient: HttpClient
|
|
|
|
constructor(args: {
|
|
|
|
httpClient: HttpClient
|
|
}) {
|
|
this.httpClient = args.httpClient
|
|
}
|
|
|
|
public async run(activationData: ActivationData,) {
|
|
const req = this.httpClient.client.post("/actions/preactivate", {
|
|
...activationData
|
|
})
|
|
|
|
try {
|
|
const e = await req
|
|
console.log("Activacion con exito", e.data)
|
|
} catch (error) {
|
|
console.error("Error activando ", error)
|
|
}
|
|
}
|
|
}
|