mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
Fix a decimal problem reported by kexin
This commit is contained in:
@@ -44,10 +44,16 @@ class ValidateVoucherLogic extends AbstractControllerLogic
|
||||
{
|
||||
$booking = Booking::find($request->input('itemId'));
|
||||
$employee = $booking->company->employees()->first();
|
||||
$amount = $this->floatvalue($request->input('amount'));
|
||||
|
||||
$validateVoucherifyVoucherObject = new ValidateVoucherifyVoucherObject($booking->company_id, $request->input('voucherCode'), $request->input('amount'), $employee);
|
||||
$validateVoucherifyVoucherObject = new ValidateVoucherifyVoucherObject($booking->company_id, $request->input('voucherCode'), $amount, $employee);
|
||||
$result = $this->validatesVoucherifyVoucher->execute($validateVoucherifyVoucherObject);
|
||||
return $this->response(['data' => $result]);
|
||||
}
|
||||
|
||||
private function floatvalue($val){
|
||||
$val = str_replace(",",".",$val);
|
||||
$val = preg_replace('/\.(?=.*\.)/', '', $val);
|
||||
return floatval($val);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user