diff options
| author | trisusilo48 <tri.susilo@altama.co.id> | 2024-11-13 14:46:59 +0700 |
|---|---|---|
| committer | trisusilo48 <tri.susilo@altama.co.id> | 2024-11-13 14:46:59 +0700 |
| commit | 7966f67569d01c25f7a337962d7d0bb1a0c57808 (patch) | |
| tree | 7069dae9adba31fd8dba56bbdaecaaa391e86654 /src/lib/checkout/api | |
| parent | ebba81f144b860eaf3bd7a9ef2b1c63a2ff021e0 (diff) | |
get couries, mapping couries and service
Diffstat (limited to 'src/lib/checkout/api')
| -rw-r--r-- | src/lib/checkout/api/ExpedisiList.js | 18 | ||||
| -rw-r--r-- | src/lib/checkout/api/getRatesCourier.js | 22 |
2 files changed, 23 insertions, 17 deletions
diff --git a/src/lib/checkout/api/ExpedisiList.js b/src/lib/checkout/api/ExpedisiList.js index 110295b7..67ef93e2 100644 --- a/src/lib/checkout/api/ExpedisiList.js +++ b/src/lib/checkout/api/ExpedisiList.js @@ -1,23 +1,7 @@ import odooApi from '@/core/api/odooApi'; -import axios from 'axios'; -import biteShipAPI from '../../../core/api/biteShip'; - const ExpedisiList = async () => { const dataExpedisi = await odooApi('GET', '/api/v1/courier'); return dataExpedisi; }; -const GetRatesCourierBiteship = async ({ destination, items }) => { - const couriers = process.env.NEXT_PUBLIC_BITESHIP_CODE_COURIERS; - let body = { - destination, - couriers: couriers, - items - }; - - const featch = await biteShipAPI('POST', '/v1/rates/couriers', body); - - return featch; -}; - -export { GetRatesCourierBiteship, ExpedisiList} ; +export default ExpedisiList; diff --git a/src/lib/checkout/api/getRatesCourier.js b/src/lib/checkout/api/getRatesCourier.js new file mode 100644 index 00000000..8db02d50 --- /dev/null +++ b/src/lib/checkout/api/getRatesCourier.js @@ -0,0 +1,22 @@ +import axios from "axios"; +import biteShipAPI from "../../../core/api/biteShip"; + +const GetRatesCourierBiteship = async ({ destination, items }) => { + const couriers = process.env.NEXT_PUBLIC_BITESHIP_CODE_COURIERS; + let body = { + ...destination, + couriers: 'gojek, grab, deliveree, lalamove, jne, tiki, ninja, lion, rara, sicepat, jnt, pos, idexpress, rpx, wahana, jdl, pos, anteraja, sap, paxel, borzo', + items: items, + }; + + const response = await axios(`${process.env.NEXT_PUBLIC_SELF_HOST}/api/biteship-service?method=POST&url=/v1/rates/couriers&body=` + JSON.stringify(body)); + + // const featch = await biteShipAPI('POST', '/v1/rates/couriers', body); + console.log('ini featch', response); + + + return response; +}; + + +export default GetRatesCourierBiteship
\ No newline at end of file |
