Operaciones basicas ALAI
This commit is contained in:
@@ -103,4 +103,54 @@ export namespace AlaiAPI {
|
||||
}
|
||||
links: Link[]
|
||||
}
|
||||
|
||||
export type Sim = {
|
||||
id: string,
|
||||
name: string,
|
||||
simCode: string,
|
||||
puk: string,
|
||||
puk2: string,
|
||||
pin: string,
|
||||
pin2: string,
|
||||
status: string,
|
||||
storeStatus: string,
|
||||
statusEsim: string,
|
||||
pool: {
|
||||
id: string,
|
||||
name: string,
|
||||
links: Link[]
|
||||
},
|
||||
sourcePool: {
|
||||
id: string,
|
||||
name: string,
|
||||
links: Link[]
|
||||
},
|
||||
subscription: {
|
||||
id: string,
|
||||
name: string,
|
||||
links: Link[]
|
||||
},
|
||||
imsi: {
|
||||
id: string,
|
||||
name: string,
|
||||
links: Link[]
|
||||
},
|
||||
msisdn: {
|
||||
id: string,
|
||||
name: string,
|
||||
links: Link[]
|
||||
},
|
||||
distributedPos: {
|
||||
id: string,
|
||||
name: string,
|
||||
links: Link[]
|
||||
},
|
||||
pkgi: {
|
||||
id: string,
|
||||
name: string,
|
||||
links: Link[]
|
||||
},
|
||||
links: Link[]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -77,19 +77,39 @@ export class AlaiRepository {
|
||||
return res
|
||||
}
|
||||
|
||||
public async applyOrder(orderId: string) {
|
||||
const endpoint = `/v1/order/${orderId}`
|
||||
const params = new URLSearchParams([
|
||||
["action", "APPLY"]
|
||||
])
|
||||
const promReq = this.httpClient.patch(endpoint, undefined, { params: params })
|
||||
const res = await this.manageRequest(promReq)
|
||||
return res
|
||||
}
|
||||
|
||||
/*
|
||||
* Ver estado del order
|
||||
*/
|
||||
public async getOrder(orderId: string) {
|
||||
const ENDPOINT = `/v1/order/${orderId}`
|
||||
// WIP
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Antes se usaba PATCH /v1/sim/{iccid}/{orderId} pero en la docu ha pasado a POST
|
||||
*/
|
||||
public async createReserve(order: string, iccid: string): Promise<Result<string, string>> {
|
||||
const ENDPOINT = `/v1/sim/${iccid}/order/${order}`
|
||||
|
||||
public async createReserve(orderId: string, iccid: string): Promise<Result<string, AlaiAPI.CreateOrderResponseDTO>> {
|
||||
const endpoint = `/v1/sim/${iccid}/order/${orderId}`
|
||||
// Crear la reserva no usa datos en el body
|
||||
const promReq = this.httpClient.post<AlaiAPI.CreateOrderResponseDTO>(endpoint, undefined)
|
||||
const res = await this.manageRequest(promReq)
|
||||
return res
|
||||
}
|
||||
|
||||
public async getSimByICCID(iccid: string) {
|
||||
const endpoint = `/v1/sim/${iccid}`
|
||||
const promReq = this.httpClient.post<AlaiAPI.Sim>(endpoint, undefined)
|
||||
const res = await this.manageRequest(promReq)
|
||||
return res
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user