summaryrefslogtreecommitdiff
path: root/src/lib/checkout
diff options
context:
space:
mode:
authortrisusilo <tri.susilo@altama.co.id>2023-09-01 02:35:31 +0000
committertrisusilo <tri.susilo@altama.co.id>2023-09-01 02:35:31 +0000
commitc5d2fcb605f5d18cbd921bd271b1b878612a518b (patch)
tree9fcf1aff82d24c01313c06b055c30710097e3370 /src/lib/checkout
parentda727c41d5221e13389005dbdff2706d3eb42842 (diff)
parenta08c6f9a773732c959e440dbcc653a6e80045e81 (diff)
Merged in Feature/page_tracking_awb (pull request #57)
Feature/page tracking awb
Diffstat (limited to 'src/lib/checkout')
-rw-r--r--src/lib/checkout/components/Checkout.jsx18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx
index afb94c10..0eb05345 100644
--- a/src/lib/checkout/components/Checkout.jsx
+++ b/src/lib/checkout/components/Checkout.jsx
@@ -297,10 +297,12 @@ const Checkout = () => {
order_line: JSON.stringify(productOrder),
delivery_amount: biayaKirim,
carrier_id: selectedCarrierId,
+ estimated_arrival_days: splitDuration(etd),
delivery_service_type: selectedExpedisiService,
voucher: activeVoucher,
type: 'sale_order'
}
+
if (query) {
data.source = 'buy'
}
@@ -1444,6 +1446,22 @@ function calculateEstimatedArrival(duration) {
return ''
}
+function splitDuration(duration){
+ if (duration) {
+ let estimationDate = null
+ if (duration.includes('-')){
+ estimationDate = duration.split('-')
+ estimationDate = parseInt(estimationDate[1])
+ }else{
+ estimationDate = parseInt(duration)
+ }
+
+ return estimationDate
+ }
+
+ return ''
+}
+
const extractDuration = (text) => {
const matches = text.match(/\d+(?:-\d+)?/g)