@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetbase/storefront-api",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "description": "Headless Commerce & Marketplace Extension for Fleetbase",
5
5
  "keywords": [
6
6
  "fleetbase-extension",
package/extension.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "Storefront",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "description": "Headless Commerce & Marketplace Extension for Fleetbase",
5
5
  "repository": "https://github.com/fleetbase/storefront",
6
6
  "license": "AGPL-3.0-or-later",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fleetbase/storefront-engine",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "description": "Headless Commerce & Marketplace Extension for Fleetbase",
5
5
  "fleetbase": {
6
6
  "route": "storefront",
@@ -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 = $checkout->public_id;
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
- // 'tax_code' => 'VAT', // only works without this
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->updateMeta('ebarimt', $ebarimt);
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): string
315
+ public static function calculateTax($amount): float
316
316
  {
317
- $result = ((float) $amount / 1.1) * 0.10;
318
- $result = floor($result * 100) / 100;
317
+ $result = ((float) $amount / 1.1) * 0.10;
318
+ $truncated = floor($result * 10000) / 10000;
319
319
 
320
- return number_format($result, 2, '.', '');
320
+ return $truncated;
321
321
  }
322
322
  }