clover_sandbox_simulator 1.2.0 → 1.4.0
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.
- checksums.yaml +4 -4
- data/README.md +284 -54
- data/bin/simulate +459 -7
- data/lib/clover_sandbox_simulator/configuration.rb +49 -1
- data/lib/clover_sandbox_simulator/data/restaurant/tax_rates.json +35 -0
- data/lib/clover_sandbox_simulator/generators/data_loader.rb +14 -0
- data/lib/clover_sandbox_simulator/generators/entity_generator.rb +197 -13
- data/lib/clover_sandbox_simulator/generators/order_generator.rb +309 -10
- data/lib/clover_sandbox_simulator/services/base_service.rb +53 -0
- data/lib/clover_sandbox_simulator/services/clover/cash_event_service.rb +111 -0
- data/lib/clover_sandbox_simulator/services/clover/customer_service.rb +55 -5
- data/lib/clover_sandbox_simulator/services/clover/discount_service.rb +37 -1
- data/lib/clover_sandbox_simulator/services/clover/employee_service.rb +46 -4
- data/lib/clover_sandbox_simulator/services/clover/inventory_service.rb +23 -9
- data/lib/clover_sandbox_simulator/services/clover/order_service.rb +96 -0
- data/lib/clover_sandbox_simulator/services/clover/order_type_service.rb +86 -0
- data/lib/clover_sandbox_simulator/services/clover/refund_service.rb +38 -1
- data/lib/clover_sandbox_simulator/services/clover/service_charge_service.rb +112 -0
- data/lib/clover_sandbox_simulator/services/clover/services_manager.rb +60 -13
- data/lib/clover_sandbox_simulator/services/clover/shift_service.rb +91 -0
- data/lib/clover_sandbox_simulator/services/clover/tax_service.rb +226 -2
- metadata +21 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 74de5928a11de82d6c3b389aec6fd92a4c63844eb55ad22bbfafecb805e4aca8
|
|
4
|
+
data.tar.gz: 2f11d97b104c0a58a37266b9792157d497ed30ff10fd39bb7bca964239893dc9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5ff02a1e8a9e90d8230c6af743887851e65c0eb266f9574571cdbcc3e973f06c719abb5fa64b164cdc14b473ee48355f0f822149ba89a0c543c36afa5b97eb68
|
|
7
|
+
data.tar.gz: 2ae75ceca9d7d77e762fa5fbb94361cd85bea8bdd3e4b8a8c15bc9461aa228f941096e7c079d681bbce4722068b068ecae27496562875fc9019e715dfe8e1167
|
data/README.md
CHANGED
|
@@ -5,14 +5,19 @@ A Ruby gem for simulating Point of Sale operations in Clover sandbox environment
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
7
|
- **Realistic Restaurant Data**: Complete menu with 39 items across 7 categories (appetizers, entrees, sides, desserts, drinks, alcoholic beverages, specials)
|
|
8
|
-
- **
|
|
8
|
+
- **Modifier Groups**: Temperature, add-ons, sides, dressings, drink sizes applied to menu items
|
|
9
|
+
- **Multiple Payment Methods**: Supports Credit/Debit cards via Ecommerce API, plus Cash, Check, Gift Card, and other tenders
|
|
9
10
|
- **Split Payments**: Supports 1-4 tender splits per order, more common for larger parties
|
|
10
11
|
- **Meal Period Simulation**: Orders distributed across breakfast, lunch, happy hour, dinner, and late night with realistic weights
|
|
11
|
-
- **
|
|
12
|
+
- **Order Types**: Dine-in, Takeout, and Delivery with configurable settings
|
|
13
|
+
- **Service Charges**: Auto-gratuity for large parties (18% for 6+ guests)
|
|
12
14
|
- **Dynamic Order Volume**: Different order counts for weekdays, Friday, Saturday, Sunday (40-120 orders/day)
|
|
13
15
|
- **Tips & Taxes**: Variable tip rates by dining option (15-25% dine-in, 0-15% takeout, 10-20% delivery)
|
|
16
|
+
- **Per-Item Tax Rates**: Different tax rates for food vs alcohol items
|
|
14
17
|
- **Discounts**: 7 discount types including Happy Hour, Senior, Military, Employee, Birthday, and fixed amounts
|
|
15
18
|
- **Employees & Customers**: Auto-generated with realistic names and contact info
|
|
19
|
+
- **Shift Tracking**: Clock in/out for employees with duration tracking
|
|
20
|
+
- **Cash Drawer Management**: Open/close drawer events with cash tracking
|
|
16
21
|
- **Party Size Variation**: 1-6 guests affecting item counts and split payment probability
|
|
17
22
|
- **Order Notes**: Random special instructions (allergies, modifications, VIP customers)
|
|
18
23
|
|
|
@@ -38,18 +43,39 @@ gem install clover_sandbox_simulator
|
|
|
38
43
|
|
|
39
44
|
## Configuration
|
|
40
45
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
46
|
+
### Multi-Merchant Setup (Recommended)
|
|
47
|
+
|
|
48
|
+
Create a `.env.json` file with multiple merchant configurations:
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
[
|
|
52
|
+
{
|
|
53
|
+
"CLOVER_MERCHANT_ID": "YOUR_MERCHANT_ID",
|
|
54
|
+
"CLOVER_MERCHANT_NAME": "My Test Merchant",
|
|
55
|
+
"CLOVER_API_TOKEN": "static-api-token",
|
|
56
|
+
"CLOVER_ACCESS_TOKEN": "oauth-jwt-token",
|
|
57
|
+
"CLOVER_REFRESH_TOKEN": "clvroar-refresh-token",
|
|
58
|
+
"PUBLIC_TOKEN": "ecommerce-public-token",
|
|
59
|
+
"PRIVATE_TOKEN": "ecommerce-private-token"
|
|
60
|
+
}
|
|
61
|
+
]
|
|
45
62
|
```
|
|
46
63
|
|
|
47
|
-
|
|
64
|
+
**Token Types:**
|
|
65
|
+
- `CLOVER_API_TOKEN` - Static API token (never expires, preferred)
|
|
66
|
+
- `CLOVER_ACCESS_TOKEN` - OAuth JWT token (expires, can be refreshed)
|
|
67
|
+
- `PUBLIC_TOKEN` / `PRIVATE_TOKEN` - Required for credit card payments via Ecommerce API
|
|
68
|
+
|
|
69
|
+
### Single Merchant Setup
|
|
70
|
+
|
|
71
|
+
Alternatively, use a `.env` file:
|
|
48
72
|
|
|
49
73
|
```env
|
|
50
74
|
CLOVER_MERCHANT_ID=your_merchant_id
|
|
51
75
|
CLOVER_API_TOKEN=your_api_token
|
|
52
76
|
CLOVER_ENVIRONMENT=https://sandbox.dev.clover.com/
|
|
77
|
+
PUBLIC_TOKEN=your_ecommerce_public_token
|
|
78
|
+
PRIVATE_TOKEN=your_ecommerce_private_token
|
|
53
79
|
LOG_LEVEL=INFO
|
|
54
80
|
TAX_RATE=8.25
|
|
55
81
|
```
|
|
@@ -67,6 +93,9 @@ Run a full simulation (setup + generate orders):
|
|
|
67
93
|
### Commands
|
|
68
94
|
|
|
69
95
|
```bash
|
|
96
|
+
# List available merchants from .env.json
|
|
97
|
+
./bin/simulate merchants
|
|
98
|
+
|
|
70
99
|
# Set up restaurant entities (categories, items, discounts, etc.)
|
|
71
100
|
./bin/simulate setup
|
|
72
101
|
|
|
@@ -76,14 +105,17 @@ Run a full simulation (setup + generate orders):
|
|
|
76
105
|
# Generate a specific number of orders
|
|
77
106
|
./bin/simulate generate -n 25
|
|
78
107
|
|
|
108
|
+
# Generate orders with refunds (5% default, customize with -r)
|
|
109
|
+
./bin/simulate generate -n 25 -r 10
|
|
110
|
+
|
|
79
111
|
# Generate a realistic full day of restaurant operations
|
|
80
112
|
./bin/simulate day
|
|
81
113
|
|
|
82
114
|
# Generate a busy day (2x normal volume)
|
|
83
|
-
./bin/simulate day -
|
|
115
|
+
./bin/simulate day -x 2.0
|
|
84
116
|
|
|
85
117
|
# Generate a slow day (0.5x normal volume)
|
|
86
|
-
./bin/simulate day -
|
|
118
|
+
./bin/simulate day -x 0.5
|
|
87
119
|
|
|
88
120
|
# Generate a lunch or dinner rush
|
|
89
121
|
./bin/simulate rush -p lunch -n 20
|
|
@@ -92,9 +124,50 @@ Run a full simulation (setup + generate orders):
|
|
|
92
124
|
# Run full simulation (setup + orders)
|
|
93
125
|
./bin/simulate full
|
|
94
126
|
|
|
95
|
-
# Check current status
|
|
127
|
+
# Check current status (all entities)
|
|
96
128
|
./bin/simulate status
|
|
97
129
|
|
|
130
|
+
# Use a specific merchant by index or ID
|
|
131
|
+
./bin/simulate status -i 0
|
|
132
|
+
./bin/simulate generate -m YOUR_MERCHANT_ID
|
|
133
|
+
|
|
134
|
+
# Gift card operations
|
|
135
|
+
./bin/simulate gift_cards # List all gift cards
|
|
136
|
+
./bin/simulate gift_card_create -a 5000 # Create $50 gift card
|
|
137
|
+
./bin/simulate gift_card_balance -i CARD_ID # Check balance
|
|
138
|
+
./bin/simulate gift_card_reload -i CARD_ID -a 2500 # Add $25
|
|
139
|
+
./bin/simulate gift_card_redeem -i CARD_ID -a 1000 # Use $10
|
|
140
|
+
|
|
141
|
+
# Refund operations
|
|
142
|
+
./bin/simulate refunds # List all refunds
|
|
143
|
+
./bin/simulate refund -p PAYMENT_ID # Full refund
|
|
144
|
+
./bin/simulate refund -p PAYMENT_ID -a 500 # Partial refund ($5)
|
|
145
|
+
|
|
146
|
+
# Inventory & Modifiers
|
|
147
|
+
./bin/simulate modifier_groups # List modifier groups
|
|
148
|
+
./bin/simulate tax_rates # List tax rates
|
|
149
|
+
|
|
150
|
+
# Order Types & Service Charges
|
|
151
|
+
./bin/simulate order_types # List order types (Dine In, Takeout, etc.)
|
|
152
|
+
./bin/simulate service_charges # List service charges
|
|
153
|
+
|
|
154
|
+
# Shift Management
|
|
155
|
+
./bin/simulate shifts # List active shifts
|
|
156
|
+
./bin/simulate shift_clock_in -e EMP_ID # Clock in an employee
|
|
157
|
+
./bin/simulate shift_clock_out -e EMP_ID # Clock out an employee
|
|
158
|
+
|
|
159
|
+
# Cash Drawer Operations
|
|
160
|
+
./bin/simulate cash_open_drawer -a 10000 # Open drawer with $100 starting cash
|
|
161
|
+
./bin/simulate cash_close_drawer -e EMP_ID # Close drawer for employee
|
|
162
|
+
|
|
163
|
+
# List recent orders
|
|
164
|
+
./bin/simulate orders
|
|
165
|
+
./bin/simulate orders -l 50 # Show 50 orders
|
|
166
|
+
|
|
167
|
+
# Reset orders (delete all orders, keep menu/employees)
|
|
168
|
+
./bin/simulate reset_orders --confirm # Delete today's orders
|
|
169
|
+
./bin/simulate reset_orders --confirm --no-today-only # Delete ALL orders
|
|
170
|
+
|
|
98
171
|
# Delete all entities (requires confirmation)
|
|
99
172
|
./bin/simulate delete --confirm
|
|
100
173
|
|
|
@@ -127,11 +200,42 @@ Run a full simulation (setup + generate orders):
|
|
|
127
200
|
| Drinks | Soft Drink | $2.99 |
|
|
128
201
|
| Alcoholic | Draft Beer | $5.99 |
|
|
129
202
|
|
|
130
|
-
|
|
203
|
+
### Modifier Groups
|
|
131
204
|
|
|
132
|
-
|
|
205
|
+
| Group | Options | Example Use |
|
|
206
|
+
|-------|---------|-------------|
|
|
207
|
+
| Temperature | Rare, Medium Rare, Medium, Medium Well, Well Done | Steaks, Burgers |
|
|
208
|
+
| Add-Ons | Extra Cheese (+$1.50), Bacon (+$2.00), Avocado (+$1.75) | Burgers, Sandwiches |
|
|
209
|
+
| Side Choice | French Fries, Sweet Potato Fries, Onion Rings, Salad | Entrees |
|
|
210
|
+
| Dressing | Ranch, Blue Cheese, Caesar, Balsamic, Honey Mustard | Salads |
|
|
211
|
+
| Drink Size | Small, Medium, Large | Beverages |
|
|
133
212
|
|
|
134
|
-
|
|
213
|
+
## Payment Methods
|
|
214
|
+
|
|
215
|
+
### Credit/Debit Card Payments (Ecommerce API)
|
|
216
|
+
|
|
217
|
+
Credit and debit card payments are fully supported via the **Clover Ecommerce API**. This requires configuring `PUBLIC_TOKEN` and `PRIVATE_TOKEN` in your `.env.json`.
|
|
218
|
+
|
|
219
|
+
**Test Card Numbers:**
|
|
220
|
+
|
|
221
|
+
| Card Type | Number |
|
|
222
|
+
|-----------|--------|
|
|
223
|
+
| Visa | 4242424242424242 |
|
|
224
|
+
| Visa Debit | 4005562231212123 |
|
|
225
|
+
| Mastercard | 5200828282828210 |
|
|
226
|
+
| Amex | 378282246310005 |
|
|
227
|
+
| Discover | 6011111111111117 |
|
|
228
|
+
| Decline (test) | 4000000000000002 |
|
|
229
|
+
| Insufficient Funds (test) | 4000000000009995 |
|
|
230
|
+
|
|
231
|
+
**Ecommerce API Endpoints:**
|
|
232
|
+
- Tokenization: `https://token-sandbox.dev.clover.com/v1/tokens`
|
|
233
|
+
- Charges: `https://scl-sandbox.dev.clover.com/v1/charges`
|
|
234
|
+
- Refunds: `https://scl-sandbox.dev.clover.com/v1/refunds`
|
|
235
|
+
|
|
236
|
+
### Platform API Tenders
|
|
237
|
+
|
|
238
|
+
For non-card payments, the simulator uses Platform API tenders:
|
|
135
239
|
- Cash (preferred for orders under $20)
|
|
136
240
|
- Check
|
|
137
241
|
- Gift Card
|
|
@@ -139,7 +243,84 @@ Safe tenders used:
|
|
|
139
243
|
- Mobile Payment
|
|
140
244
|
- Store Credit
|
|
141
245
|
|
|
142
|
-
The simulator uses whatever
|
|
246
|
+
The simulator uses whatever tenders are available in the Clover merchant account.
|
|
247
|
+
|
|
248
|
+
## Tax Rates
|
|
249
|
+
|
|
250
|
+
The simulator supports per-item tax rates based on category:
|
|
251
|
+
|
|
252
|
+
| Category | Tax Rate | Notes |
|
|
253
|
+
|----------|----------|-------|
|
|
254
|
+
| Food Items | 8.25% | Standard sales tax |
|
|
255
|
+
| Alcoholic Beverages | 8.25% + 10% | Sales tax + alcohol tax |
|
|
256
|
+
|
|
257
|
+
Tax rates are automatically assigned to items during setup based on their category.
|
|
258
|
+
|
|
259
|
+
## Service Charges
|
|
260
|
+
|
|
261
|
+
### Auto-Gratuity
|
|
262
|
+
|
|
263
|
+
Large parties (6+ guests) automatically receive an 18% auto-gratuity service charge. This is:
|
|
264
|
+
- Added to the order subtotal before payment
|
|
265
|
+
- Displayed as a separate line item
|
|
266
|
+
- Configurable via the `ServiceChargeService`
|
|
267
|
+
|
|
268
|
+
**Note:** Service charges must be pre-configured in the Clover dashboard for sandbox environments, as the API may not support creating them dynamically.
|
|
269
|
+
|
|
270
|
+
## Order Types
|
|
271
|
+
|
|
272
|
+
The simulator supports multiple order types that affect order flow and reporting:
|
|
273
|
+
|
|
274
|
+
| Order Type | Description |
|
|
275
|
+
|------------|-------------|
|
|
276
|
+
| Dine In | In-restaurant dining |
|
|
277
|
+
| Takeout | Customer pickup |
|
|
278
|
+
| Delivery | Delivery orders |
|
|
279
|
+
| Online | Online/web orders |
|
|
280
|
+
| Catering | Large catering orders |
|
|
281
|
+
|
|
282
|
+
Order types are automatically created during setup if they don't exist.
|
|
283
|
+
|
|
284
|
+
## Shift Management
|
|
285
|
+
|
|
286
|
+
The simulator tracks employee shifts for realistic operations:
|
|
287
|
+
|
|
288
|
+
```ruby
|
|
289
|
+
# Clock in an employee
|
|
290
|
+
services.shift.clock_in(employee_id: "EMP_123")
|
|
291
|
+
|
|
292
|
+
# Clock out an employee
|
|
293
|
+
services.shift.clock_out(employee_id: "EMP_123")
|
|
294
|
+
|
|
295
|
+
# Get active shifts
|
|
296
|
+
services.shift.get_active_shifts
|
|
297
|
+
|
|
298
|
+
# Calculate shift duration
|
|
299
|
+
services.shift.calculate_shift_duration(shift_id: "SHIFT_123")
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
## Cash Drawer Operations
|
|
303
|
+
|
|
304
|
+
Track cash drawer operations for end-of-day reconciliation:
|
|
305
|
+
|
|
306
|
+
```ruby
|
|
307
|
+
# Open cash drawer
|
|
308
|
+
services.cash_event.open_drawer(employee_id: "EMP_123", amount: 10000)
|
|
309
|
+
|
|
310
|
+
# Close cash drawer
|
|
311
|
+
services.cash_event.close_drawer(employee_id: "EMP_123", amount: 15000)
|
|
312
|
+
|
|
313
|
+
# Add cash (e.g., from cash payment)
|
|
314
|
+
services.cash_event.add_cash(employee_id: "EMP_123", amount: 2500, note: "Cash sale")
|
|
315
|
+
|
|
316
|
+
# Remove cash (e.g., cash out)
|
|
317
|
+
services.cash_event.remove_cash(employee_id: "EMP_123", amount: 5000, note: "Bank deposit")
|
|
318
|
+
|
|
319
|
+
# Get drawer total
|
|
320
|
+
services.cash_event.calculate_drawer_total
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
**Note:** Cash event creation may not be fully supported in the Clover sandbox. The simulator handles this gracefully with simulated responses.
|
|
143
324
|
|
|
144
325
|
## Tips
|
|
145
326
|
|
|
@@ -197,31 +378,41 @@ clover_sandbox_simulator/
|
|
|
197
378
|
├── lib/
|
|
198
379
|
│ ├── clover_sandbox_simulator.rb # Gem entry point
|
|
199
380
|
│ └── clover_sandbox_simulator/
|
|
200
|
-
│ ├── configuration.rb #
|
|
381
|
+
│ ├── configuration.rb # Multi-merchant config from .env.json
|
|
382
|
+
│ ├── parallel_executor.rb # Concurrent execution support
|
|
201
383
|
│ ├── services/
|
|
202
|
-
│ │ ├── base_service.rb
|
|
384
|
+
│ │ ├── base_service.rb # HTTP client, error handling helpers
|
|
203
385
|
│ │ └── clover/ # Clover API services
|
|
204
|
-
│ │ ├── inventory_service.rb
|
|
205
|
-
│ │ ├── order_service.rb
|
|
206
|
-
│ │ ├── payment_service.rb
|
|
207
|
-
│ │ ├── tender_service.rb
|
|
208
|
-
│ │ ├── tax_service.rb
|
|
209
|
-
│ │ ├── discount_service.rb
|
|
210
|
-
│ │ ├── employee_service.rb
|
|
211
|
-
│ │ ├── customer_service.rb
|
|
212
|
-
│ │
|
|
386
|
+
│ │ ├── inventory_service.rb # Categories, items, modifier groups
|
|
387
|
+
│ │ ├── order_service.rb # Orders, line items, modifiers
|
|
388
|
+
│ │ ├── payment_service.rb # Payments, splits
|
|
389
|
+
│ │ ├── tender_service.rb # Payment tenders
|
|
390
|
+
│ │ ├── tax_service.rb # Tax rates, per-item taxes
|
|
391
|
+
│ │ ├── discount_service.rb # Discounts, promos, combos
|
|
392
|
+
│ │ ├── employee_service.rb # Employee management
|
|
393
|
+
│ │ ├── customer_service.rb # Customer management
|
|
394
|
+
│ │ ├── ecommerce_service.rb # Card payments via Ecommerce API
|
|
395
|
+
│ │ ├── refund_service.rb # Full/partial refunds
|
|
396
|
+
│ │ ├── gift_card_service.rb # Gift card management
|
|
397
|
+
│ │ ├── service_charge_service.rb # Service charges, auto-gratuity
|
|
398
|
+
│ │ ├── shift_service.rb # Employee shifts, clock in/out
|
|
399
|
+
│ │ ├── order_type_service.rb # Order types (Dine In, Takeout, etc.)
|
|
400
|
+
│ │ ├── cash_event_service.rb # Cash drawer operations
|
|
401
|
+
│ │ ├── oauth_service.rb # Token refresh
|
|
402
|
+
│ │ └── services_manager.rb # Thread-safe service access
|
|
213
403
|
│ ├── generators/
|
|
214
|
-
│ │ ├── data_loader.rb
|
|
215
|
-
│ │ ├── entity_generator.rb
|
|
216
|
-
│ │ └── order_generator.rb
|
|
404
|
+
│ │ ├── data_loader.rb # Load JSON data files
|
|
405
|
+
│ │ ├── entity_generator.rb # Setup entities (idempotent)
|
|
406
|
+
│ │ └── order_generator.rb # Generate realistic orders
|
|
217
407
|
│ └── data/
|
|
218
408
|
│ └── restaurant/ # JSON data files
|
|
219
409
|
│ ├── categories.json
|
|
220
410
|
│ ├── items.json
|
|
221
411
|
│ ├── discounts.json
|
|
222
412
|
│ ├── tenders.json
|
|
223
|
-
│
|
|
224
|
-
└──
|
|
413
|
+
│ ├── modifiers.json
|
|
414
|
+
│ └── tax_rates.json
|
|
415
|
+
└── spec/ # RSpec tests with VCR integration
|
|
225
416
|
```
|
|
226
417
|
|
|
227
418
|
## Development
|
|
@@ -236,6 +427,9 @@ bundle exec rspec --format documentation
|
|
|
236
427
|
# Run specific test file
|
|
237
428
|
bundle exec rspec spec/services/clover/tender_service_spec.rb
|
|
238
429
|
|
|
430
|
+
# Run integration tests (requires .env.json with valid credentials)
|
|
431
|
+
bundle exec rspec spec/integration/
|
|
432
|
+
|
|
239
433
|
# Run linter
|
|
240
434
|
bundle exec rubocop
|
|
241
435
|
|
|
@@ -245,26 +439,33 @@ bundle exec irb -r ./lib/clover_sandbox_simulator
|
|
|
245
439
|
|
|
246
440
|
## Testing
|
|
247
441
|
|
|
248
|
-
The gem includes comprehensive RSpec tests with WebMock for HTTP stubbing.
|
|
442
|
+
The gem includes comprehensive RSpec tests with WebMock for HTTP stubbing and VCR for integration tests.
|
|
249
443
|
|
|
250
444
|
### Test Coverage
|
|
251
445
|
|
|
252
|
-
- **
|
|
446
|
+
- **475 examples, 0 failures, 3 pending**
|
|
253
447
|
- Configuration validation
|
|
254
448
|
- Data loading from JSON files
|
|
255
449
|
- All Clover API services:
|
|
256
|
-
- InventoryService (categories, items)
|
|
257
|
-
- OrderService (create, line items, dining options)
|
|
258
|
-
- PaymentService (single and
|
|
259
|
-
- TenderService (
|
|
260
|
-
- TaxService (rates, calculation)
|
|
261
|
-
- DiscountService (percentage
|
|
262
|
-
- EmployeeService (CRUD,
|
|
450
|
+
- InventoryService (categories, items, modifier groups)
|
|
451
|
+
- OrderService (create, line items, dining options, modifiers)
|
|
452
|
+
- PaymentService (single, split, and card payments)
|
|
453
|
+
- TenderService (tender selection)
|
|
454
|
+
- TaxService (rates, per-item calculation, item associations)
|
|
455
|
+
- DiscountService (percentage, fixed, time-based, loyalty)
|
|
456
|
+
- EmployeeService (CRUD, deterministic setup)
|
|
263
457
|
- CustomerService (CRUD, anonymous orders)
|
|
264
|
-
-
|
|
458
|
+
- RefundService (full/partial refunds, multiple strategies)
|
|
459
|
+
- GiftCardService (create, reload, redeem)
|
|
460
|
+
- ServiceChargeService (auto-gratuity, apply to orders)
|
|
461
|
+
- ShiftService (clock in/out, active shifts)
|
|
462
|
+
- OrderTypeService (CRUD, default setup)
|
|
463
|
+
- CashEventService (drawer operations, simulated responses)
|
|
464
|
+
- ServicesManager (thread-safe memoization, lazy loading)
|
|
265
465
|
- Entity generator idempotency
|
|
266
|
-
- Order generator (meal periods, dining options, tips)
|
|
466
|
+
- Order generator (meal periods, dining options, tips, refunds, modifiers, service charges)
|
|
267
467
|
- Edge cases (nil handling, empty arrays, API errors)
|
|
468
|
+
- VCR integration tests for real API validation
|
|
268
469
|
|
|
269
470
|
### Test Files
|
|
270
471
|
|
|
@@ -275,16 +476,28 @@ spec/
|
|
|
275
476
|
│ ├── data_loader_spec.rb
|
|
276
477
|
│ ├── entity_generator_spec.rb
|
|
277
478
|
│ └── order_generator_spec.rb
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
479
|
+
├── services/clover/
|
|
480
|
+
│ ├── customer_service_spec.rb
|
|
481
|
+
│ ├── discount_service_spec.rb
|
|
482
|
+
│ ├── employee_service_spec.rb
|
|
483
|
+
│ ├── gift_card_service_spec.rb
|
|
484
|
+
│ ├── inventory_service_spec.rb
|
|
485
|
+
│ ├── order_service_spec.rb
|
|
486
|
+
│ ├── payment_service_spec.rb
|
|
487
|
+
│ ├── refund_service_spec.rb
|
|
488
|
+
│ ├── service_charge_service_spec.rb
|
|
489
|
+
│ ├── shift_service_spec.rb
|
|
490
|
+
│ ├── order_type_service_spec.rb
|
|
491
|
+
│ ├── cash_event_service_spec.rb
|
|
492
|
+
│ ├── tax_service_spec.rb
|
|
493
|
+
│ ├── services_manager_spec.rb
|
|
494
|
+
│ └── tender_service_spec.rb
|
|
495
|
+
└── integration/
|
|
496
|
+
├── modifier_groups_spec.rb
|
|
497
|
+
├── service_charges_spec.rb
|
|
498
|
+
├── order_types_spec.rb
|
|
499
|
+
├── cash_events_spec.rb
|
|
500
|
+
└── tax_rates_spec.rb
|
|
288
501
|
```
|
|
289
502
|
|
|
290
503
|
### Idempotency Verification
|
|
@@ -299,11 +512,28 @@ generator.setup_all # Second run: skips existing, returns same results
|
|
|
299
512
|
```
|
|
300
513
|
|
|
301
514
|
The tests verify:
|
|
302
|
-
- Categories are not duplicated
|
|
303
|
-
- Items are not duplicated
|
|
304
|
-
- Discounts are not duplicated
|
|
515
|
+
- Categories are not duplicated (case-insensitive matching)
|
|
516
|
+
- Items are not duplicated (case-insensitive matching)
|
|
517
|
+
- Discounts are not duplicated (case-insensitive matching)
|
|
518
|
+
- Modifier groups AND their child modifiers are not duplicated
|
|
519
|
+
- Tax rates are not duplicated
|
|
520
|
+
- Order types are not duplicated
|
|
305
521
|
- Employees/customers only created if count threshold not met
|
|
306
522
|
|
|
523
|
+
## Sandbox Limitations
|
|
524
|
+
|
|
525
|
+
Some Clover sandbox operations may return errors or behave differently than production:
|
|
526
|
+
|
|
527
|
+
| Feature | Sandbox Support | Notes |
|
|
528
|
+
|---------|-----------------|-------|
|
|
529
|
+
| Service Charge Creation | ❌ Limited | Must pre-configure in dashboard |
|
|
530
|
+
| Cash Event Creation | ❌ Limited | Returns 405, simulated locally |
|
|
531
|
+
| Item Tax Rate Fetch | ❌ Limited | Returns 405, simulated locally |
|
|
532
|
+
| Credit Card Payments | ✅ Full | Via Ecommerce API |
|
|
533
|
+
| Order Creation | ✅ Full | Today's date only |
|
|
534
|
+
|
|
535
|
+
The simulator handles these limitations gracefully with fallback behavior.
|
|
536
|
+
|
|
307
537
|
## Clover API Notes
|
|
308
538
|
|
|
309
539
|
- **Sandbox URL**: `https://sandbox.dev.clover.com/`
|