@fleetbase/storefront-engine 0.3.20 → 0.3.21
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/config/storefront.php +20 -0
- package/server/src/Http/Controllers/v1/CheckoutController.php +1 -0
- package/server/src/Http/Controllers/v1/CustomerController.php +4 -4
- package/server/src/Http/Resources/Cart.php +1 -1
package/composer.json
CHANGED
package/extension.json
CHANGED
package/package.json
CHANGED
|
@@ -6,6 +6,11 @@
|
|
|
6
6
|
* -------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
return [
|
|
9
|
+
/*
|
|
10
|
+
|--------------------------------------------------------------------------
|
|
11
|
+
| API Config
|
|
12
|
+
|--------------------------------------------------------------------------
|
|
13
|
+
*/
|
|
9
14
|
'api' => [
|
|
10
15
|
'version' => '0.0.1',
|
|
11
16
|
'routing' => [
|
|
@@ -13,6 +18,21 @@ return [
|
|
|
13
18
|
'internal_prefix' => 'int'
|
|
14
19
|
],
|
|
15
20
|
],
|
|
21
|
+
|
|
22
|
+
/*
|
|
23
|
+
|--------------------------------------------------------------------------
|
|
24
|
+
| Storefront App
|
|
25
|
+
|--------------------------------------------------------------------------
|
|
26
|
+
*/
|
|
27
|
+
'storefront_app' => [
|
|
28
|
+
'bypass_verification_code' => env('STOREFRONT_BYPASS_VERIFICATION_CODE', '999000')
|
|
29
|
+
],
|
|
30
|
+
|
|
31
|
+
/*
|
|
32
|
+
|--------------------------------------------------------------------------
|
|
33
|
+
| Database Connection
|
|
34
|
+
|--------------------------------------------------------------------------
|
|
35
|
+
*/
|
|
16
36
|
'connection' => [
|
|
17
37
|
'db' => env('STOREFRONT_DB_CONNECTION', 'storefront')
|
|
18
38
|
]
|
|
@@ -283,6 +283,7 @@ class CheckoutController extends Controller
|
|
|
283
283
|
'setupIntent' => $setupIntent->id,
|
|
284
284
|
'clientSecret' => $setupIntent->client_secret,
|
|
285
285
|
'defaultPaymentMethod' => $defaultPaymentMethod,
|
|
286
|
+
'customerId' => $customer->getMeta('stripe_id'),
|
|
286
287
|
]);
|
|
287
288
|
} catch (\Exception $e) {
|
|
288
289
|
return response()->apiError($e->getMessage());
|
|
@@ -438,8 +438,7 @@ class CustomerController extends Controller
|
|
|
438
438
|
|
|
439
439
|
// find and verify code
|
|
440
440
|
$verificationCode = VerificationCode::where(['subject_uuid' => $user->uuid, 'code' => $code, 'for' => $for])->exists();
|
|
441
|
-
|
|
442
|
-
if (!$verificationCode && $code !== '999000') {
|
|
441
|
+
if (!$verificationCode && $code !== config('storefront.storefront_app.bypass_verification_code')) {
|
|
443
442
|
return response()->error('Invalid verification code!');
|
|
444
443
|
}
|
|
445
444
|
|
|
@@ -518,8 +517,8 @@ class CustomerController extends Controller
|
|
|
518
517
|
);
|
|
519
518
|
|
|
520
519
|
return response()->json([
|
|
521
|
-
'ephemeralKey'
|
|
522
|
-
'
|
|
520
|
+
'ephemeralKey' => $ephemeralKey->secret,
|
|
521
|
+
'customerId' => $customer->getMeta('stripe_id'),
|
|
523
522
|
]);
|
|
524
523
|
} catch (\Exception $e) {
|
|
525
524
|
return response()->apiError($e->getMessage());
|
|
@@ -554,6 +553,7 @@ class CustomerController extends Controller
|
|
|
554
553
|
return response()->json([
|
|
555
554
|
'setupIntentId' => $setupIntent->id,
|
|
556
555
|
'setupIntent' => $setupIntent->client_secret,
|
|
556
|
+
'customerId' => $customer->getMeta('stripe_id'),
|
|
557
557
|
]);
|
|
558
558
|
} catch (\Exception $e) {
|
|
559
559
|
return response()->apiError($e->getMessage());
|
|
@@ -44,7 +44,7 @@ class Cart extends FleetbaseResource
|
|
|
44
44
|
$items = $this->items ?? [];
|
|
45
45
|
|
|
46
46
|
return array_map(function ($cartItem) {
|
|
47
|
-
$product = Product::select(['public_id', 'primary_image_uuid', 'name', 'description'])->where('public_id', data_get($cartItem, 'product_id'))->first();
|
|
47
|
+
$product = Product::select(['uuid', 'public_id', 'primary_image_uuid', 'name', 'description'])->with(['files'])->where('public_id', data_get($cartItem, 'product_id'))->first();
|
|
48
48
|
if ($product) {
|
|
49
49
|
data_set($cartItem, 'name', $product->name);
|
|
50
50
|
data_set($cartItem, 'description', $product->description);
|