@fleetbase/storefront-engine 0.4.3 → 0.4.5
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/addon/components/modals/create-gateway.hbs +13 -27
- package/addon/components/schedule-manager.hbs +24 -20
- package/addon/components/settings-container.hbs +3 -2
- package/addon/components/widget/customers.hbs +56 -78
- package/addon/components/widget/orders.hbs +281 -303
- package/addon/components/widget/storefront-key-metrics.hbs +1 -1
- package/addon/components/widget/storefront-metrics.hbs +2 -2
- package/addon/controllers/settings.js +36 -0
- package/addon/services/storefront.js +6 -1
- package/addon/templates/settings/gateways.hbs +3 -3
- package/addon/templates/settings/index.hbs +322 -321
- package/addon/templates/settings/locations.hbs +2 -2
- package/addon/templates/settings.hbs +8 -30
- package/addon/utils/get-gateway-schemas.js +2 -0
- package/app/controllers/settings.js +1 -0
- package/composer.json +1 -1
- package/extension.json +1 -1
- package/package.json +3 -3
- package/server/config/storefront.php +11 -1
- package/server/src/Http/Controllers/v1/CheckoutController.php +41 -10
- package/server/src/Http/Controllers/v1/CustomerController.php +1 -1
- package/server/src/Http/Controllers/v1/OrderController.php +198 -1
- package/server/src/Http/Filter/OrderFilter.php +35 -29
- package/server/src/Http/Middleware/ThrottleRequests.php +16 -0
- package/server/src/Http/Resources/CatalogCategory.php +1 -0
- package/server/src/Models/Cart.php +1 -1
- package/server/src/Providers/StorefrontServiceProvider.php +1 -1
- package/server/src/Support/QPay.php +78 -0
- package/server/src/routes.php +1 -0
|
@@ -164,6 +164,27 @@ class QPay
|
|
|
164
164
|
return $this->createQPayInvoice($params);
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
+
public function createEbarimtInvoice(?string $invoiceCode = '', ?string $senderInvoiceNo = '', ?string $invoiceReceiverCode = '', array $invoiceReceiverData = [], ?string $invoiceDescription = '', ?string $taxType = '1', ?string $districtCode = '', array $lines = [], ?string $callbackUrl = null)
|
|
168
|
+
{
|
|
169
|
+
if (!$callbackUrl && $this->hasCallbackUrl()) {
|
|
170
|
+
$callbackUrl = $this->callbackUrl;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
$params = array_filter([
|
|
174
|
+
'invoice_code' => $invoiceCode,
|
|
175
|
+
'sender_invoice_no' => $senderInvoiceNo,
|
|
176
|
+
'invoice_receiver_code' => $invoiceReceiverCode,
|
|
177
|
+
'invoice_receiver_data' => $invoiceReceiverData,
|
|
178
|
+
'invoice_description' => $invoiceDescription,
|
|
179
|
+
'tax_type' => $taxType,
|
|
180
|
+
'district_code' => $districtCode,
|
|
181
|
+
'lines' => $lines,
|
|
182
|
+
'callback_url' => $callbackUrl,
|
|
183
|
+
]);
|
|
184
|
+
|
|
185
|
+
return $this->createQPayInvoice($params);
|
|
186
|
+
}
|
|
187
|
+
|
|
167
188
|
public function createQPayInvoice(array $params = [], $options = [])
|
|
168
189
|
{
|
|
169
190
|
if (!isset($params['callback_url']) && $this->hasCallbackUrl()) {
|
|
@@ -188,6 +209,14 @@ class QPay
|
|
|
188
209
|
return $this->post('payment/check', $params, $options);
|
|
189
210
|
}
|
|
190
211
|
|
|
212
|
+
public function getPayment(string $invoiceId)
|
|
213
|
+
{
|
|
214
|
+
$paymentCheck = $this->paymentCheck($invoiceId);
|
|
215
|
+
$rows = data_get($paymentCheck, 'rows');
|
|
216
|
+
|
|
217
|
+
return $paymentCheck && is_array($rows) && count($rows) ? $rows[0] : null;
|
|
218
|
+
}
|
|
219
|
+
|
|
191
220
|
public function paymentCancel(string $invoiceId, $options = [])
|
|
192
221
|
{
|
|
193
222
|
$params = [
|
|
@@ -241,4 +270,53 @@ class QPay
|
|
|
241
270
|
'p2p_transactions' => [],
|
|
242
271
|
];
|
|
243
272
|
}
|
|
273
|
+
|
|
274
|
+
public static function mockEbarimtResponse(): array
|
|
275
|
+
{
|
|
276
|
+
return [
|
|
277
|
+
'id' => 'ca48461c-0b85-438d-b8f4-8b46582a668c',
|
|
278
|
+
'ebarimt_by' => 'QPAY',
|
|
279
|
+
'g_wallet_id' => '0fc9b71c-cd87-4ffd-9cac-2279ebd9deb0',
|
|
280
|
+
'g_wallet_customer_id' => 'b8361d3d-2a22-4942-9682-336daf87c025',
|
|
281
|
+
'ebarimt_receiver_type' => 'CITIZEN',
|
|
282
|
+
'ebarimt_receiver' => '88614450',
|
|
283
|
+
'ebarimt_district_code' => '3505',
|
|
284
|
+
'ebarimt_bill_type' => '1',
|
|
285
|
+
'g_merchant_id' => 'KKTT',
|
|
286
|
+
'merchant_branch_code' => 'BRANCH1',
|
|
287
|
+
'merchant_terminal_code' => null,
|
|
288
|
+
'merchant_staff_code' => 'online',
|
|
289
|
+
'merchant_register_no' => '5395305',
|
|
290
|
+
'g_payment_id' => '019276866891878',
|
|
291
|
+
'paid_by' => 'P2P',
|
|
292
|
+
'object_type' => 'INVOICE',
|
|
293
|
+
'object_id' => '18f4d9be-9ad7-42d4-95b9-c0d2f9e75900',
|
|
294
|
+
'amount' => '200.00',
|
|
295
|
+
'vat_amount' => '0.00',
|
|
296
|
+
'city_tax_amount' => '0.00',
|
|
297
|
+
'ebarimt_qr_data' => '1384317094375011435297579636399454618202815732865429083584377335965767295542878017999436539632565406872654525818990190095811371347814623214640752059894152037',
|
|
298
|
+
'ebarimt_lottery' => 'HV 83198235',
|
|
299
|
+
'note' => null,
|
|
300
|
+
'barimt_status' => 'REGISTERED',
|
|
301
|
+
'barimt_status_date' => '2024-11-04T05:45:42.945Z',
|
|
302
|
+
'ebarimt_sent_email' => null,
|
|
303
|
+
'ebarimt_receiver_phone' => '88*144*0',
|
|
304
|
+
'tax_type' => '2',
|
|
305
|
+
'merchant_tin' => '30101065006',
|
|
306
|
+
'ebarimt_receipt_id' => '030101065006000090690000210005595',
|
|
307
|
+
'created_by' => '1',
|
|
308
|
+
'created_date' => '2024-11-04T05:45:42.295Z',
|
|
309
|
+
'updated_by' => '1',
|
|
310
|
+
'updated_date' => '2024-11-04T05:45:42.410Z',
|
|
311
|
+
'status' => true,
|
|
312
|
+
];
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
public static function calculateTax($amount): string
|
|
316
|
+
{
|
|
317
|
+
$result = ((float) $amount / 1.1) * 0.10;
|
|
318
|
+
$result = floor($result * 100) / 100;
|
|
319
|
+
|
|
320
|
+
return number_format($result, 2, '.', '');
|
|
321
|
+
}
|
|
244
322
|
}
|
package/server/src/routes.php
CHANGED
|
@@ -95,6 +95,7 @@ Route::prefix(config('storefront.api.routing.prefix', 'storefront'))->namespace(
|
|
|
95
95
|
// storefront/v1/orders
|
|
96
96
|
$router->group(['prefix' => 'orders'], function () use ($router) {
|
|
97
97
|
$router->put('picked-up', 'OrderController@completeOrderPickup');
|
|
98
|
+
$router->post('receipt', 'OrderController@getReceipt');
|
|
98
99
|
});
|
|
99
100
|
|
|
100
101
|
// storefront/v1/customers
|