summaryrefslogtreecommitdiff
path: root/src/lib/checkout
diff options
context:
space:
mode:
authorHATEC\SPVDEV001 <tri.susilo@altama.co.id>2023-09-02 10:37:04 +0700
committerHATEC\SPVDEV001 <tri.susilo@altama.co.id>2023-09-02 10:37:04 +0700
commit09996e253209cd6d163fa1b9a6667485b80dfa82 (patch)
tree78d33cc888b2433b5c0ac68fd0102de6c84a187a /src/lib/checkout
parentbca256dfc413400a6c17ca189a8f31a15d82473a (diff)
parent6b1083de2c5ad57953c6653d00a42b2da3fea108 (diff)
Merge branch 'master' into CR/tampilan
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 27a00aa8..ce691403 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'
}
@@ -1494,6 +1496,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)