@fleetbase/storefront-engine 0.3.4 → 0.3.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/composer.json +4 -4
- package/extension.json +1 -1
- package/package.json +3 -3
- package/server/seeders/OrderConfigSeeder.php +2 -249
- package/server/src/Http/Controllers/v1/ServiceQuoteController.php +7 -9
- package/server/src/Observers/CompanyObserver.php +20 -0
- package/server/src/Providers/StorefrontServiceProvider.php +1 -0
- package/server/src/Support/Storefront.php +249 -0
- package/server/src/Support/OrderConfig.php +0 -14
package/composer.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fleetbase/storefront-api",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"description": "Headless Commerce & Marketplace Extension for Fleetbase",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fleetbase-extension",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
],
|
|
23
23
|
"require": {
|
|
24
24
|
"php": "^8.0",
|
|
25
|
-
"fleetbase/core-api": "^1.4.
|
|
26
|
-
"fleetbase/fleetops-api": "^0.4.
|
|
25
|
+
"fleetbase/core-api": "^1.4.12",
|
|
26
|
+
"fleetbase/fleetops-api": "^0.4.18",
|
|
27
27
|
"geocoder-php/google-maps-places-provider": "^1.4",
|
|
28
28
|
"laravel-notification-channels/apn": "^5.0",
|
|
29
29
|
"laravel-notification-channels/fcm": "^4.1",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"autoload": {
|
|
45
45
|
"psr-4": {
|
|
46
46
|
"Fleetbase\\Storefront\\": "server/src/",
|
|
47
|
-
"Fleetbase\\Storefront\\Seeders\\": "seeders/"
|
|
47
|
+
"Fleetbase\\Storefront\\Seeders\\": "server/seeders/"
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
"autoload-dev": {
|
package/extension.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fleetbase/storefront-engine",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"description": "Headless Commerce & Marketplace Extension for Fleetbase",
|
|
5
5
|
"fleetbase": {
|
|
6
6
|
"route": "storefront",
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"publish:github": "npm config set '@fleetbase:registry' https://npm.pkg.github.com/ && npm publish"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@fleetbase/ember-core": "^0.2.
|
|
46
|
+
"@fleetbase/ember-core": "^0.2.6",
|
|
47
47
|
"@fleetbase/ember-ui": "^0.2.11",
|
|
48
|
-
"@fleetbase/fleetops-data": "^0.1.
|
|
48
|
+
"@fleetbase/fleetops-data": "^0.1.13",
|
|
49
49
|
"@babel/core": "^7.23.2",
|
|
50
50
|
"@fortawesome/ember-fontawesome": "^0.4.1",
|
|
51
51
|
"@fortawesome/fontawesome-svg-core": "^6.4.0",
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
namespace Fleetbase\Storefront\Seeders;
|
|
4
4
|
|
|
5
|
-
use Fleetbase\FleetOps\Models\OrderConfig;
|
|
6
5
|
use Fleetbase\Models\Company;
|
|
6
|
+
use Fleetbase\Storefront\Support\Storefront;
|
|
7
7
|
use Illuminate\Database\Seeder;
|
|
8
|
-
use Illuminate\Support\Str;
|
|
9
8
|
|
|
10
9
|
class OrderConfigSeeder extends Seeder
|
|
11
10
|
{
|
|
@@ -18,253 +17,7 @@ class OrderConfigSeeder extends Seeder
|
|
|
18
17
|
{
|
|
19
18
|
$companies = Company::all();
|
|
20
19
|
foreach ($companies as $company) {
|
|
21
|
-
|
|
20
|
+
Storefront::createStorefrontConfig($company);
|
|
22
21
|
}
|
|
23
22
|
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Creates or retrieves an existing storefront configuration for a given company.
|
|
27
|
-
*
|
|
28
|
-
* This method checks if a storefront configuration (OrderConfig) already exists for the given company.
|
|
29
|
-
* If it exists, the method returns the existing configuration. Otherwise, it creates a new configuration with
|
|
30
|
-
* predefined settings for a storefront order process. The configuration includes various stages like 'created',
|
|
31
|
-
* 'started', 'canceled', 'completed', etc., each defined with specific attributes like key, code, color, logic,
|
|
32
|
-
* events, status, actions, details, and more. These stages help manage the order lifecycle in a storefront context.
|
|
33
|
-
*
|
|
34
|
-
* @param Company $company The company for which the storefront configuration is being created or retrieved.
|
|
35
|
-
* @return OrderConfig The storefront order configuration associated with the specified company.
|
|
36
|
-
*/
|
|
37
|
-
public static function createStorefrontConfig(Company $company): OrderConfig
|
|
38
|
-
{
|
|
39
|
-
return OrderConfig::firstOrCreate(
|
|
40
|
-
[
|
|
41
|
-
'company_uuid' => $company->uuid,
|
|
42
|
-
'key' => 'storefront',
|
|
43
|
-
'namespace' => 'system:order-config:storefront',
|
|
44
|
-
],
|
|
45
|
-
[
|
|
46
|
-
'name' => 'Storefront',
|
|
47
|
-
'key' => 'storefront',
|
|
48
|
-
'namespace' => 'system:order-config:storefront',
|
|
49
|
-
'description' => 'Storefront order configuration for hyperlocal delivery and pickup',
|
|
50
|
-
'core_service' => 1,
|
|
51
|
-
'status' => 'private',
|
|
52
|
-
'version' => '0.0.1',
|
|
53
|
-
'tags' => ['storefront', 'ecommerce', 'hyperlocal'],
|
|
54
|
-
'entities' => [],
|
|
55
|
-
'meta' => [],
|
|
56
|
-
'flow' => [
|
|
57
|
-
'created' => [
|
|
58
|
-
'key' => 'created',
|
|
59
|
-
'code' => 'created',
|
|
60
|
-
'color' => '#1f2937',
|
|
61
|
-
'logic' => [],
|
|
62
|
-
'events' => [],
|
|
63
|
-
'status' => 'Order Created',
|
|
64
|
-
'actions' => [],
|
|
65
|
-
'details' => 'New order was created.',
|
|
66
|
-
'options' => [],
|
|
67
|
-
'complete' => false,
|
|
68
|
-
'entities' => [],
|
|
69
|
-
'sequence' => 0,
|
|
70
|
-
'activities' => ['dispatched'],
|
|
71
|
-
'internalId' => Str::uuid(),
|
|
72
|
-
'pod_method' => 'scan',
|
|
73
|
-
'require_pod' => false,
|
|
74
|
-
],
|
|
75
|
-
'started' => [
|
|
76
|
-
'key' => 'started',
|
|
77
|
-
'code' => 'started',
|
|
78
|
-
'color' => '#1f2937',
|
|
79
|
-
'logic' => [],
|
|
80
|
-
'events' => [],
|
|
81
|
-
'status' => 'Order Started',
|
|
82
|
-
'actions' => [],
|
|
83
|
-
'details' => 'Order has been started',
|
|
84
|
-
'options' => [],
|
|
85
|
-
'complete' => false,
|
|
86
|
-
'entities' => [],
|
|
87
|
-
'sequence' => 0,
|
|
88
|
-
'activities' => ['canceled', 'preparing'],
|
|
89
|
-
'internalId' => Str::uuid(),
|
|
90
|
-
'pod_method' => 'scan',
|
|
91
|
-
'require_pod' => false,
|
|
92
|
-
],
|
|
93
|
-
'canceled' => [
|
|
94
|
-
'key' => 'canceled',
|
|
95
|
-
'code' => 'canceled',
|
|
96
|
-
'color' => '#1f2937',
|
|
97
|
-
'logic' => [],
|
|
98
|
-
'events' => ['order.canceled'],
|
|
99
|
-
'status' => 'Order canceled',
|
|
100
|
-
'actions' => [],
|
|
101
|
-
'details' => 'Order could not be accepted',
|
|
102
|
-
'options' => [],
|
|
103
|
-
'complete' => false,
|
|
104
|
-
'entities' => [],
|
|
105
|
-
'sequence' => 0,
|
|
106
|
-
'activities' => [],
|
|
107
|
-
'internalId' => Str::uuid(),
|
|
108
|
-
'pod_method' => 'scan',
|
|
109
|
-
'require_pod' => false,
|
|
110
|
-
],
|
|
111
|
-
'completed' => [
|
|
112
|
-
'key' => 'completed',
|
|
113
|
-
'code' => 'completed',
|
|
114
|
-
'color' => '#1f2937',
|
|
115
|
-
'logic' => [],
|
|
116
|
-
'events' => [],
|
|
117
|
-
'status' => 'Order completed',
|
|
118
|
-
'actions' => [],
|
|
119
|
-
'details' => 'Driver has completed the order',
|
|
120
|
-
'options' => [],
|
|
121
|
-
'complete' => true,
|
|
122
|
-
'entities' => [],
|
|
123
|
-
'sequence' => 0,
|
|
124
|
-
'activities' => [],
|
|
125
|
-
'internalId' => Str::uuid(),
|
|
126
|
-
'pod_method' => 'scan',
|
|
127
|
-
'require_pod' => false,
|
|
128
|
-
],
|
|
129
|
-
'picked_up' => [
|
|
130
|
-
'key' => 'completed',
|
|
131
|
-
'code' => 'picked_up',
|
|
132
|
-
'color' => '#1f2937',
|
|
133
|
-
'logic' => [],
|
|
134
|
-
'events' => [],
|
|
135
|
-
'status' => 'Order picked up',
|
|
136
|
-
'actions' => [],
|
|
137
|
-
'details' => 'Order has been picked up by customer',
|
|
138
|
-
'options' => [],
|
|
139
|
-
'complete' => true,
|
|
140
|
-
'entities' => [],
|
|
141
|
-
'sequence' => 0,
|
|
142
|
-
'activities' => [],
|
|
143
|
-
'internalId' => Str::uuid(),
|
|
144
|
-
'pod_method' => 'scan',
|
|
145
|
-
'require_pod' => false,
|
|
146
|
-
],
|
|
147
|
-
'preparing' => [
|
|
148
|
-
'key' => 'preparing',
|
|
149
|
-
'code' => 'preparing',
|
|
150
|
-
'color' => '#1f2937',
|
|
151
|
-
'logic' => [],
|
|
152
|
-
'events' => [],
|
|
153
|
-
'status' => 'Order is being prepared',
|
|
154
|
-
'actions' => [],
|
|
155
|
-
'details' => 'Order has been received by {storefront.name} and is being prepared',
|
|
156
|
-
'options' => [],
|
|
157
|
-
'complete' => false,
|
|
158
|
-
'entities' => [],
|
|
159
|
-
'sequence' => 0,
|
|
160
|
-
'activities' => ['driver_enroute_to_store', 'pickup_ready'],
|
|
161
|
-
'internalId' => Str::uuid(),
|
|
162
|
-
'pod_method' => 'scan',
|
|
163
|
-
'require_pod' => false,
|
|
164
|
-
],
|
|
165
|
-
'dispatched' => [
|
|
166
|
-
'key' => 'dispatched',
|
|
167
|
-
'code' => 'dispatched',
|
|
168
|
-
'color' => '#1f2937',
|
|
169
|
-
'logic' => [],
|
|
170
|
-
'events' => [],
|
|
171
|
-
'status' => 'Order Dispatched',
|
|
172
|
-
'actions' => [],
|
|
173
|
-
'details' => 'Order has been dispatched.',
|
|
174
|
-
'options' => [],
|
|
175
|
-
'complete' => false,
|
|
176
|
-
'entities' => [],
|
|
177
|
-
'sequence' => 0,
|
|
178
|
-
'activities' => ['started'],
|
|
179
|
-
'internalId' => Str::uuid(),
|
|
180
|
-
'pod_method' => 'scan',
|
|
181
|
-
'require_pod' => false,
|
|
182
|
-
],
|
|
183
|
-
'pickup_ready' => [
|
|
184
|
-
'key' => 'ready',
|
|
185
|
-
'code' => 'pickup_ready',
|
|
186
|
-
'color' => '#1f2937',
|
|
187
|
-
'logic' => [
|
|
188
|
-
[
|
|
189
|
-
'type' => 'if',
|
|
190
|
-
'conditions' => [
|
|
191
|
-
[
|
|
192
|
-
'field' => 'meta.is_pickup',
|
|
193
|
-
'value' => 'true',
|
|
194
|
-
'operator' => 'equal',
|
|
195
|
-
],
|
|
196
|
-
],
|
|
197
|
-
],
|
|
198
|
-
],
|
|
199
|
-
'events' => [],
|
|
200
|
-
'status' => 'Order is ready for pickup',
|
|
201
|
-
'actions' => [],
|
|
202
|
-
'details' => 'Order is ready to be picked up by customer',
|
|
203
|
-
'options' => [],
|
|
204
|
-
'complete' => false,
|
|
205
|
-
'entities' => [],
|
|
206
|
-
'sequence' => 0,
|
|
207
|
-
'activities' => ['picked_up'],
|
|
208
|
-
'internalId' => Str::uuid(),
|
|
209
|
-
'pod_method' => 'scan',
|
|
210
|
-
'require_pod' => false,
|
|
211
|
-
],
|
|
212
|
-
'driver_enroute' => [
|
|
213
|
-
'key' => 'driver_enroute',
|
|
214
|
-
'code' => 'driver_enroute',
|
|
215
|
-
'color' => '#1f2937',
|
|
216
|
-
'logic' => [],
|
|
217
|
-
'events' => [],
|
|
218
|
-
'status' => 'Driver en-route',
|
|
219
|
-
'actions' => [],
|
|
220
|
-
'details' => 'Driver is on the way to the customer',
|
|
221
|
-
'options' => [],
|
|
222
|
-
'complete' => false,
|
|
223
|
-
'entities' => [],
|
|
224
|
-
'sequence' => 0,
|
|
225
|
-
'activities' => ['completed'],
|
|
226
|
-
'internalId' => Str::uuid(),
|
|
227
|
-
'pod_method' => 'scan',
|
|
228
|
-
'require_pod' => false,
|
|
229
|
-
],
|
|
230
|
-
'driver_picked_up' => [
|
|
231
|
-
'key' => 'driver_picked_up',
|
|
232
|
-
'code' => 'driver_picked_up',
|
|
233
|
-
'color' => '#1f2937',
|
|
234
|
-
'logic' => [],
|
|
235
|
-
'events' => [],
|
|
236
|
-
'status' => 'Driver picked up',
|
|
237
|
-
'actions' => [],
|
|
238
|
-
'details' => 'Driver has picked up order',
|
|
239
|
-
'options' => [],
|
|
240
|
-
'complete' => false,
|
|
241
|
-
'entities' => [],
|
|
242
|
-
'sequence' => 0,
|
|
243
|
-
'activities' => ['driver_enroute'],
|
|
244
|
-
'internalId' => Str::uuid(),
|
|
245
|
-
'pod_method' => 'scan',
|
|
246
|
-
'require_pod' => false,
|
|
247
|
-
],
|
|
248
|
-
'driver_enroute_to_store' => [
|
|
249
|
-
'key' => 'driver_enroute',
|
|
250
|
-
'code' => 'driver_enroute_to_store',
|
|
251
|
-
'color' => '#1f2937',
|
|
252
|
-
'logic' => [],
|
|
253
|
-
'events' => [],
|
|
254
|
-
'status' => 'Driver en-route',
|
|
255
|
-
'actions' => [],
|
|
256
|
-
'details' => 'Driver en-route to store',
|
|
257
|
-
'options' => [],
|
|
258
|
-
'complete' => false,
|
|
259
|
-
'entities' => [],
|
|
260
|
-
'sequence' => 0,
|
|
261
|
-
'activities' => ['driver_picked_up'],
|
|
262
|
-
'internalId' => Str::uuid(),
|
|
263
|
-
'pod_method' => 'scan',
|
|
264
|
-
'require_pod' => false,
|
|
265
|
-
],
|
|
266
|
-
],
|
|
267
|
-
]
|
|
268
|
-
);
|
|
269
|
-
}
|
|
270
23
|
}
|
|
@@ -5,11 +5,11 @@ namespace Fleetbase\Storefront\Http\Controllers\v1;
|
|
|
5
5
|
use Fleetbase\FleetOps\Http\Resources\v1\ServiceQuote as ServiceQuoteResource;
|
|
6
6
|
use Fleetbase\FleetOps\Models\Entity;
|
|
7
7
|
use Fleetbase\FleetOps\Models\IntegratedVendor;
|
|
8
|
+
use Fleetbase\FleetOps\Models\OrderConfig;
|
|
8
9
|
use Fleetbase\FleetOps\Models\Place;
|
|
9
10
|
use Fleetbase\FleetOps\Models\ServiceQuote;
|
|
10
11
|
use Fleetbase\FleetOps\Models\ServiceQuoteItem;
|
|
11
12
|
use Fleetbase\FleetOps\Models\ServiceRate;
|
|
12
|
-
use Fleetbase\FleetOps\Support\Flow;
|
|
13
13
|
use Fleetbase\FleetOps\Support\Utils;
|
|
14
14
|
use Fleetbase\Http\Controllers\Controller;
|
|
15
15
|
use Fleetbase\Storefront\Http\Requests\GetServiceQuoteFromCart;
|
|
@@ -100,12 +100,11 @@ class ServiceQuoteController extends Controller
|
|
|
100
100
|
$serviceQuotes = collect();
|
|
101
101
|
|
|
102
102
|
// get order configurations for ecommerce / task
|
|
103
|
-
$
|
|
104
|
-
|
|
105
|
-
});
|
|
103
|
+
$orderConfig = OrderConfig::resolveFromIdentifier($config);
|
|
104
|
+
$orderConfigKey = data_get($orderConfig, 'key', 'storefront');
|
|
106
105
|
|
|
107
106
|
// get service rates for config type
|
|
108
|
-
$serviceRates = ServiceRate::
|
|
107
|
+
$serviceRates = ServiceRate::where('service_type', $orderConfigKey)->get();
|
|
109
108
|
|
|
110
109
|
// if no service rates send an empty quote
|
|
111
110
|
if ($serviceRates->isEmpty()) {
|
|
@@ -289,12 +288,11 @@ class ServiceQuoteController extends Controller
|
|
|
289
288
|
$serviceQuotes = collect();
|
|
290
289
|
|
|
291
290
|
// get order configurations for ecommerce / task
|
|
292
|
-
$
|
|
293
|
-
|
|
294
|
-
});
|
|
291
|
+
$orderConfig = OrderConfig::resolveFromIdentifier($config);
|
|
292
|
+
$orderConfigKey = data_get($orderConfig, 'key', 'storefront');
|
|
295
293
|
|
|
296
294
|
// get service rates for config type
|
|
297
|
-
$serviceRates = ServiceRate::
|
|
295
|
+
$serviceRates = ServiceRate::where('service_type', $orderConfigKey)->get();
|
|
298
296
|
|
|
299
297
|
// if no service rates send an empty quote
|
|
300
298
|
if ($serviceRates->isEmpty()) {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Fleetbase\Storefront\Observers;
|
|
4
|
+
|
|
5
|
+
use Fleetbase\Models\Company;
|
|
6
|
+
use Fleetbase\Storefront\Support\Storefront;
|
|
7
|
+
|
|
8
|
+
class CompanyObserver
|
|
9
|
+
{
|
|
10
|
+
/**
|
|
11
|
+
* Handle the Company "created" event.
|
|
12
|
+
*
|
|
13
|
+
* @return void
|
|
14
|
+
*/
|
|
15
|
+
public function created(Company $company)
|
|
16
|
+
{
|
|
17
|
+
// Add the default storefront order config
|
|
18
|
+
Storefront::createStorefrontConfig($company);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -26,6 +26,7 @@ class StorefrontServiceProvider extends CoreServiceProvider
|
|
|
26
26
|
public $observers = [
|
|
27
27
|
\Fleetbase\Storefront\Models\Product::class => \Fleetbase\Storefront\Observers\ProductObserver::class,
|
|
28
28
|
\Fleetbase\Storefront\Models\Network::class => \Fleetbase\Storefront\Observers\NetworkObserver::class,
|
|
29
|
+
\Fleetbase\Models\Company::class => \Fleetbase\Storefront\Observers\CompanyObserver::class,
|
|
29
30
|
];
|
|
30
31
|
|
|
31
32
|
/**
|
|
@@ -4,6 +4,8 @@ namespace Fleetbase\Storefront\Support;
|
|
|
4
4
|
|
|
5
5
|
use Fleetbase\FleetOps\Models\Contact;
|
|
6
6
|
use Fleetbase\FleetOps\Models\Order;
|
|
7
|
+
use Fleetbase\FleetOps\Models\OrderConfig;
|
|
8
|
+
use Fleetbase\Models\Company;
|
|
7
9
|
use Fleetbase\Models\User;
|
|
8
10
|
use Fleetbase\Storefront\Models\Gateway;
|
|
9
11
|
use Fleetbase\Storefront\Models\Network;
|
|
@@ -200,4 +202,251 @@ class Storefront
|
|
|
200
202
|
|
|
201
203
|
return $stripeCustomer;
|
|
202
204
|
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Creates or retrieves an existing storefront configuration for a given company.
|
|
208
|
+
*
|
|
209
|
+
* This method checks if a storefront configuration (OrderConfig) already exists for the given company.
|
|
210
|
+
* If it exists, the method returns the existing configuration. Otherwise, it creates a new configuration with
|
|
211
|
+
* predefined settings for a storefront order process. The configuration includes various stages like 'created',
|
|
212
|
+
* 'started', 'canceled', 'completed', etc., each defined with specific attributes like key, code, color, logic,
|
|
213
|
+
* events, status, actions, details, and more. These stages help manage the order lifecycle in a storefront context.
|
|
214
|
+
*
|
|
215
|
+
* @param Company $company the company for which the storefront configuration is being created or retrieved
|
|
216
|
+
*
|
|
217
|
+
* @return OrderConfig the storefront order configuration associated with the specified company
|
|
218
|
+
*/
|
|
219
|
+
public static function createStorefrontConfig(Company $company): OrderConfig
|
|
220
|
+
{
|
|
221
|
+
return OrderConfig::firstOrCreate(
|
|
222
|
+
[
|
|
223
|
+
'company_uuid' => $company->uuid,
|
|
224
|
+
'key' => 'storefront',
|
|
225
|
+
'namespace' => 'system:order-config:storefront',
|
|
226
|
+
],
|
|
227
|
+
[
|
|
228
|
+
'name' => 'Storefront',
|
|
229
|
+
'key' => 'storefront',
|
|
230
|
+
'namespace' => 'system:order-config:storefront',
|
|
231
|
+
'description' => 'Storefront order configuration for hyperlocal delivery and pickup',
|
|
232
|
+
'core_service' => 1,
|
|
233
|
+
'status' => 'private',
|
|
234
|
+
'version' => '0.0.1',
|
|
235
|
+
'tags' => ['storefront', 'ecommerce', 'hyperlocal'],
|
|
236
|
+
'entities' => [],
|
|
237
|
+
'meta' => [],
|
|
238
|
+
'flow' => [
|
|
239
|
+
'created' => [
|
|
240
|
+
'key' => 'created',
|
|
241
|
+
'code' => 'created',
|
|
242
|
+
'color' => '#1f2937',
|
|
243
|
+
'logic' => [],
|
|
244
|
+
'events' => [],
|
|
245
|
+
'status' => 'Order Created',
|
|
246
|
+
'actions' => [],
|
|
247
|
+
'details' => 'New order was created.',
|
|
248
|
+
'options' => [],
|
|
249
|
+
'complete' => false,
|
|
250
|
+
'entities' => [],
|
|
251
|
+
'sequence' => 0,
|
|
252
|
+
'activities' => ['dispatched'],
|
|
253
|
+
'internalId' => Str::uuid(),
|
|
254
|
+
'pod_method' => 'scan',
|
|
255
|
+
'require_pod' => false,
|
|
256
|
+
],
|
|
257
|
+
'started' => [
|
|
258
|
+
'key' => 'started',
|
|
259
|
+
'code' => 'started',
|
|
260
|
+
'color' => '#1f2937',
|
|
261
|
+
'logic' => [],
|
|
262
|
+
'events' => [],
|
|
263
|
+
'status' => 'Order Started',
|
|
264
|
+
'actions' => [],
|
|
265
|
+
'details' => 'Order has been started',
|
|
266
|
+
'options' => [],
|
|
267
|
+
'complete' => false,
|
|
268
|
+
'entities' => [],
|
|
269
|
+
'sequence' => 0,
|
|
270
|
+
'activities' => ['canceled', 'preparing'],
|
|
271
|
+
'internalId' => Str::uuid(),
|
|
272
|
+
'pod_method' => 'scan',
|
|
273
|
+
'require_pod' => false,
|
|
274
|
+
],
|
|
275
|
+
'canceled' => [
|
|
276
|
+
'key' => 'canceled',
|
|
277
|
+
'code' => 'canceled',
|
|
278
|
+
'color' => '#1f2937',
|
|
279
|
+
'logic' => [],
|
|
280
|
+
'events' => ['order.canceled'],
|
|
281
|
+
'status' => 'Order canceled',
|
|
282
|
+
'actions' => [],
|
|
283
|
+
'details' => 'Order could not be accepted',
|
|
284
|
+
'options' => [],
|
|
285
|
+
'complete' => false,
|
|
286
|
+
'entities' => [],
|
|
287
|
+
'sequence' => 0,
|
|
288
|
+
'activities' => [],
|
|
289
|
+
'internalId' => Str::uuid(),
|
|
290
|
+
'pod_method' => 'scan',
|
|
291
|
+
'require_pod' => false,
|
|
292
|
+
],
|
|
293
|
+
'completed' => [
|
|
294
|
+
'key' => 'completed',
|
|
295
|
+
'code' => 'completed',
|
|
296
|
+
'color' => '#1f2937',
|
|
297
|
+
'logic' => [],
|
|
298
|
+
'events' => [],
|
|
299
|
+
'status' => 'Order completed',
|
|
300
|
+
'actions' => [],
|
|
301
|
+
'details' => 'Driver has completed the order',
|
|
302
|
+
'options' => [],
|
|
303
|
+
'complete' => true,
|
|
304
|
+
'entities' => [],
|
|
305
|
+
'sequence' => 0,
|
|
306
|
+
'activities' => [],
|
|
307
|
+
'internalId' => Str::uuid(),
|
|
308
|
+
'pod_method' => 'scan',
|
|
309
|
+
'require_pod' => false,
|
|
310
|
+
],
|
|
311
|
+
'picked_up' => [
|
|
312
|
+
'key' => 'completed',
|
|
313
|
+
'code' => 'picked_up',
|
|
314
|
+
'color' => '#1f2937',
|
|
315
|
+
'logic' => [],
|
|
316
|
+
'events' => [],
|
|
317
|
+
'status' => 'Order picked up',
|
|
318
|
+
'actions' => [],
|
|
319
|
+
'details' => 'Order has been picked up by customer',
|
|
320
|
+
'options' => [],
|
|
321
|
+
'complete' => true,
|
|
322
|
+
'entities' => [],
|
|
323
|
+
'sequence' => 0,
|
|
324
|
+
'activities' => [],
|
|
325
|
+
'internalId' => Str::uuid(),
|
|
326
|
+
'pod_method' => 'scan',
|
|
327
|
+
'require_pod' => false,
|
|
328
|
+
],
|
|
329
|
+
'preparing' => [
|
|
330
|
+
'key' => 'preparing',
|
|
331
|
+
'code' => 'preparing',
|
|
332
|
+
'color' => '#1f2937',
|
|
333
|
+
'logic' => [],
|
|
334
|
+
'events' => [],
|
|
335
|
+
'status' => 'Order is being prepared',
|
|
336
|
+
'actions' => [],
|
|
337
|
+
'details' => 'Order has been received by {storefront.name} and is being prepared',
|
|
338
|
+
'options' => [],
|
|
339
|
+
'complete' => false,
|
|
340
|
+
'entities' => [],
|
|
341
|
+
'sequence' => 0,
|
|
342
|
+
'activities' => ['driver_enroute_to_store', 'pickup_ready'],
|
|
343
|
+
'internalId' => Str::uuid(),
|
|
344
|
+
'pod_method' => 'scan',
|
|
345
|
+
'require_pod' => false,
|
|
346
|
+
],
|
|
347
|
+
'dispatched' => [
|
|
348
|
+
'key' => 'dispatched',
|
|
349
|
+
'code' => 'dispatched',
|
|
350
|
+
'color' => '#1f2937',
|
|
351
|
+
'logic' => [],
|
|
352
|
+
'events' => [],
|
|
353
|
+
'status' => 'Order Dispatched',
|
|
354
|
+
'actions' => [],
|
|
355
|
+
'details' => 'Order has been dispatched.',
|
|
356
|
+
'options' => [],
|
|
357
|
+
'complete' => false,
|
|
358
|
+
'entities' => [],
|
|
359
|
+
'sequence' => 0,
|
|
360
|
+
'activities' => ['started'],
|
|
361
|
+
'internalId' => Str::uuid(),
|
|
362
|
+
'pod_method' => 'scan',
|
|
363
|
+
'require_pod' => false,
|
|
364
|
+
],
|
|
365
|
+
'pickup_ready' => [
|
|
366
|
+
'key' => 'ready',
|
|
367
|
+
'code' => 'pickup_ready',
|
|
368
|
+
'color' => '#1f2937',
|
|
369
|
+
'logic' => [
|
|
370
|
+
[
|
|
371
|
+
'type' => 'if',
|
|
372
|
+
'conditions' => [
|
|
373
|
+
[
|
|
374
|
+
'field' => 'meta.is_pickup',
|
|
375
|
+
'value' => 'true',
|
|
376
|
+
'operator' => 'equal',
|
|
377
|
+
],
|
|
378
|
+
],
|
|
379
|
+
],
|
|
380
|
+
],
|
|
381
|
+
'events' => [],
|
|
382
|
+
'status' => 'Order is ready for pickup',
|
|
383
|
+
'actions' => [],
|
|
384
|
+
'details' => 'Order is ready to be picked up by customer',
|
|
385
|
+
'options' => [],
|
|
386
|
+
'complete' => false,
|
|
387
|
+
'entities' => [],
|
|
388
|
+
'sequence' => 0,
|
|
389
|
+
'activities' => ['picked_up'],
|
|
390
|
+
'internalId' => Str::uuid(),
|
|
391
|
+
'pod_method' => 'scan',
|
|
392
|
+
'require_pod' => false,
|
|
393
|
+
],
|
|
394
|
+
'driver_enroute' => [
|
|
395
|
+
'key' => 'driver_enroute',
|
|
396
|
+
'code' => 'driver_enroute',
|
|
397
|
+
'color' => '#1f2937',
|
|
398
|
+
'logic' => [],
|
|
399
|
+
'events' => [],
|
|
400
|
+
'status' => 'Driver en-route',
|
|
401
|
+
'actions' => [],
|
|
402
|
+
'details' => 'Driver is on the way to the customer',
|
|
403
|
+
'options' => [],
|
|
404
|
+
'complete' => false,
|
|
405
|
+
'entities' => [],
|
|
406
|
+
'sequence' => 0,
|
|
407
|
+
'activities' => ['completed'],
|
|
408
|
+
'internalId' => Str::uuid(),
|
|
409
|
+
'pod_method' => 'scan',
|
|
410
|
+
'require_pod' => false,
|
|
411
|
+
],
|
|
412
|
+
'driver_picked_up' => [
|
|
413
|
+
'key' => 'driver_picked_up',
|
|
414
|
+
'code' => 'driver_picked_up',
|
|
415
|
+
'color' => '#1f2937',
|
|
416
|
+
'logic' => [],
|
|
417
|
+
'events' => [],
|
|
418
|
+
'status' => 'Driver picked up',
|
|
419
|
+
'actions' => [],
|
|
420
|
+
'details' => 'Driver has picked up order',
|
|
421
|
+
'options' => [],
|
|
422
|
+
'complete' => false,
|
|
423
|
+
'entities' => [],
|
|
424
|
+
'sequence' => 0,
|
|
425
|
+
'activities' => ['driver_enroute'],
|
|
426
|
+
'internalId' => Str::uuid(),
|
|
427
|
+
'pod_method' => 'scan',
|
|
428
|
+
'require_pod' => false,
|
|
429
|
+
],
|
|
430
|
+
'driver_enroute_to_store' => [
|
|
431
|
+
'key' => 'driver_enroute',
|
|
432
|
+
'code' => 'driver_enroute_to_store',
|
|
433
|
+
'color' => '#1f2937',
|
|
434
|
+
'logic' => [],
|
|
435
|
+
'events' => [],
|
|
436
|
+
'status' => 'Driver en-route',
|
|
437
|
+
'actions' => [],
|
|
438
|
+
'details' => 'Driver en-route to store',
|
|
439
|
+
'options' => [],
|
|
440
|
+
'complete' => false,
|
|
441
|
+
'entities' => [],
|
|
442
|
+
'sequence' => 0,
|
|
443
|
+
'activities' => ['driver_picked_up'],
|
|
444
|
+
'internalId' => Str::uuid(),
|
|
445
|
+
'pod_method' => 'scan',
|
|
446
|
+
'require_pod' => false,
|
|
447
|
+
],
|
|
448
|
+
],
|
|
449
|
+
]
|
|
450
|
+
);
|
|
451
|
+
}
|
|
203
452
|
}
|