mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-19 04:23:59 +00:00
update logic for state_rate
This commit is contained in:
+9
-2
@@ -63,6 +63,9 @@ class ShippingEstimationCalculatorLogic extends AbstractControllerLogic
|
||||
$selected_warehouse_rate = $this->getConstantByKey($warehouse_rate_constant, $request->input('warehouse_id'));
|
||||
$warehouse_rate = is_object($selected_warehouse_rate) ? $selected_warehouse_rate->amount : 0;
|
||||
|
||||
$stateId = 1; // TODO: should query from DB
|
||||
$state_rate_constant = $this->getConstantByKey($state_rate_constant, $stateId);
|
||||
|
||||
$this->checkPostcodeExistInConstant($center_postcode_constant, $request->input('postcode')) === true ? $state_select = 'center' : '' ;
|
||||
$this->checkPostcodeExistInConstant($outstation_postcode_constant, $request->input('postcode')) === true ? $state_select = 'outstation' : '' ;
|
||||
$state_rate_constant = (array)$state_rate_constant;
|
||||
@@ -70,10 +73,14 @@ class ShippingEstimationCalculatorLogic extends AbstractControllerLogic
|
||||
$state_rate = $state_select == '' ? 0 : $state_rate_constant[$state_select];
|
||||
|
||||
$price_cbm = $base_price + $warehouse_rate + $state_rate;
|
||||
$total_cbm = $price_cbm * $cbm;
|
||||
$total_price_cbm = $price_cbm * $cbm;
|
||||
|
||||
return $this->response([
|
||||
'cbm' => $cbm, 'total_cbm' => $total_cbm
|
||||
'cbm' => $cbm,
|
||||
'base_price' => $base_price,
|
||||
'warehouse_rate' => $warehouse_rate,
|
||||
'state_rate' => $state_rate,
|
||||
'total_price_cbm' => $total_price_cbm
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user