ongkir
Version:
Shipping charges from logistic services in Indonesia
33 lines (28 loc) • 820 B
text/typescript
import { Subdistrict, SubdistrictType } from '../Geolocation'
import { BaseExpedition } from './Base'
export class Wahana extends BaseExpedition {
protected subdistrict?: SubdistrictType
public constructor() {
super('wahana')
this.mappingTableResult = {
service: 0,
price: 1,
etd: 2
}
}
public async querySubdistrictDestinations(): Promise<SubdistrictType[]> {
if (!this.destination) {
throw new Error('destination city should defined first')
}
return await Subdistrict(this.expedition, this.destination?.id)
}
public setSubdistrict(subdistrict: SubdistrictType) {
this.subdistrict = subdistrict
}
protected buildParams(): any {
return {
...super.buildParams(),
['kecTujuanwahana_val']: this.subdistrict?.kode_kecamatan
}
}
}