summaryrefslogtreecommitdiff
path: root/src/lib/checkout
diff options
context:
space:
mode:
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)