@fleetbase/storefront-engine 0.4.5 → 0.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/composer.json +1 -1
- package/extension.json +1 -1
- package/package.json +1 -1
- package/server/src/Http/Controllers/v1/CheckoutController.php +4 -4
- package/server/src/Http/Controllers/v1/OrderController.php +9 -1
- package/server/src/Models/FoodTruck.php +1 -1
- package/server/src/Support/QPay.php +4 -4
package/composer.json
CHANGED
package/extension.json
CHANGED
package/package.json
CHANGED
|
@@ -474,7 +474,7 @@ class CheckoutController extends Controller
|
|
|
474
474
|
$invoiceAmount = $amount;
|
|
475
475
|
$invoiceCode = $gateway->sandbox ? 'TEST_INVOICE' : $gateway->config?->invoice_id ?? null;
|
|
476
476
|
$invoiceDescription = $about->name . ' cart checkout';
|
|
477
|
-
$invoiceReceiverCode =
|
|
477
|
+
$invoiceReceiverCode = 'CITIZEN';
|
|
478
478
|
$senderInvoiceNo = $checkout->public_id;
|
|
479
479
|
$districtCode = $gateway->config?->district_code ?? null;
|
|
480
480
|
$invoiceReceiverData = Utils::filterArray([
|
|
@@ -486,14 +486,14 @@ class CheckoutController extends Controller
|
|
|
486
486
|
foreach ($cart->items as $item) {
|
|
487
487
|
$lines[] = [
|
|
488
488
|
'line_description' => $item->name,
|
|
489
|
-
'line_quantity' => $item->quantity ?? 1,
|
|
489
|
+
'line_quantity' => number_format($item->quantity ?? 1, 2, '.', ''),
|
|
490
490
|
'line_unit_price' => number_format($item->price, 2, '.', ''),
|
|
491
491
|
'note' => $checkout->public_id,
|
|
492
492
|
'classification_code' => '0111100',
|
|
493
493
|
'taxes' => [
|
|
494
494
|
[
|
|
495
|
-
|
|
496
|
-
'description' => '
|
|
495
|
+
'tax_code' => 'VAT',
|
|
496
|
+
'description' => 'VAT',
|
|
497
497
|
'amount' => QPay::calculateTax($item->subtotal),
|
|
498
498
|
'note' => $checkout->public_id,
|
|
499
499
|
],
|
|
@@ -157,8 +157,16 @@ class OrderController extends Controller
|
|
|
157
157
|
return $ebarimt; // Return error response if creation failed
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
+
// get ebarimt qr data
|
|
161
|
+
$qrData = data_get($ebarimt, 'ebarimt_qr_data');
|
|
162
|
+
if (!empty($qrData)) {
|
|
163
|
+
$order->updateMeta('ebarimt_qr_data', $qrData);
|
|
164
|
+
}
|
|
165
|
+
|
|
160
166
|
// Store receipt in order metadata
|
|
161
|
-
$order->
|
|
167
|
+
if ($order->doesntHaveMeta('ebarimt')) {
|
|
168
|
+
$order->updateMeta('ebarimt', $ebarimt);
|
|
169
|
+
}
|
|
162
170
|
|
|
163
171
|
return response()->json($ebarimt);
|
|
164
172
|
}
|
|
@@ -83,7 +83,7 @@ class FoodTruck extends StorefrontModel
|
|
|
83
83
|
*/
|
|
84
84
|
public function vehicle(): BelongsTo
|
|
85
85
|
{
|
|
86
|
-
return $this->setConnection(config('fleetbase.connection.db'))->belongsTo(Vehicle::class, 'vehicle_uuid', 'uuid');
|
|
86
|
+
return $this->setConnection(config('fleetbase.connection.db'))->belongsTo(Vehicle::class, 'vehicle_uuid', 'uuid')->withTrashed();
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
/**
|
|
@@ -312,11 +312,11 @@ class QPay
|
|
|
312
312
|
];
|
|
313
313
|
}
|
|
314
314
|
|
|
315
|
-
public static function calculateTax($amount):
|
|
315
|
+
public static function calculateTax($amount): float
|
|
316
316
|
{
|
|
317
|
-
$result
|
|
318
|
-
$
|
|
317
|
+
$result = ((float) $amount / 1.1) * 0.10;
|
|
318
|
+
$truncated = floor($result * 10000) / 10000;
|
|
319
319
|
|
|
320
|
-
return
|
|
320
|
+
return $truncated;
|
|
321
321
|
}
|
|
322
322
|
}
|