clover_sandbox_simulator 1.1.0 → 1.2.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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 15537c1595b19f0f0c351e4650b65ac23316538b7fbc5e3b55bb71c798cba25a
|
|
4
|
+
data.tar.gz: 6205e71eb9af6a625e5b95024156e2579fe8a687c274178f7a3aa255dc4a13ae
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2c3407b953637dc1ddf428f5795befc91969b8c0fb99c67b86c15e93cc6c02a7a9567367991135724e4920426cbd1cd0dcf4c65227aef0fa9600e9510246c838
|
|
7
|
+
data.tar.gz: 6602102b44527baa4aca0181174d5732407c207bb6139588b010f0c06775b61c80421b31bf0ea6b4b089e1cfa1f74379a151effcc76d384c2fd6d51ec5678729
|
data/bin/simulate
CHANGED
|
@@ -9,6 +9,32 @@ module CloverSandboxSimulator
|
|
|
9
9
|
# Command-line interface for Clover Sandbox Simulator
|
|
10
10
|
class CLI < Thor
|
|
11
11
|
class_option :verbose, type: :boolean, aliases: "-v", desc: "Enable verbose logging"
|
|
12
|
+
class_option :merchant, type: :string, aliases: "-m", desc: "Merchant ID to use (from .env.json)"
|
|
13
|
+
class_option :merchant_index, type: :numeric, aliases: "-i", desc: "Merchant index to use (0-based, from .env.json)"
|
|
14
|
+
|
|
15
|
+
desc "merchants", "List available merchants from .env.json"
|
|
16
|
+
def merchants
|
|
17
|
+
puts "🍽️ Clover Sandbox Simulator - Available Merchants"
|
|
18
|
+
puts "=" * 60
|
|
19
|
+
|
|
20
|
+
config = CloverSandboxSimulator.configuration
|
|
21
|
+
merchants = config.available_merchants
|
|
22
|
+
|
|
23
|
+
if merchants.empty?
|
|
24
|
+
puts "No merchants found in .env.json"
|
|
25
|
+
return
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
puts "\n#{'Index'.ljust(6)} #{'Merchant ID'.ljust(16)} #{'Name'.ljust(25)} #{'eComm'}"
|
|
29
|
+
puts "-" * 60
|
|
30
|
+
|
|
31
|
+
merchants.each_with_index do |m, idx|
|
|
32
|
+
ecomm = m[:has_ecommerce] ? "✓" : "-"
|
|
33
|
+
puts "#{idx.to_s.ljust(6)} #{m[:id].ljust(16)} #{m[:name][0..23].ljust(25)} #{ecomm}"
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
puts "\nUse: simulate <command> -i <index> or -m <merchant_id>"
|
|
37
|
+
end
|
|
12
38
|
|
|
13
39
|
desc "setup", "Set up restaurant entities (categories, items, discounts, employees, customers)"
|
|
14
40
|
option :business_type, type: :string, default: "restaurant", desc: "Business type (restaurant, retail, salon)"
|
|
@@ -43,7 +69,7 @@ module CloverSandboxSimulator
|
|
|
43
69
|
end
|
|
44
70
|
|
|
45
71
|
desc "day", "Generate a realistic full day of restaurant operations"
|
|
46
|
-
option :multiplier, type: :numeric, aliases: "-
|
|
72
|
+
option :multiplier, type: :numeric, aliases: "-x", default: 1.0, desc: "Order multiplier (0.5 = slow day, 2.0 = busy day)"
|
|
47
73
|
option :refund_percentage, type: :numeric, aliases: "-r", default: 5,
|
|
48
74
|
desc: "Percentage of orders to refund (0-100, default 5)"
|
|
49
75
|
def day
|
|
@@ -413,11 +439,22 @@ module CloverSandboxSimulator
|
|
|
413
439
|
end
|
|
414
440
|
|
|
415
441
|
def configure_logging
|
|
442
|
+
config = CloverSandboxSimulator.configuration
|
|
443
|
+
|
|
416
444
|
if options[:verbose]
|
|
417
|
-
|
|
445
|
+
config.logger.level = Logger::DEBUG
|
|
418
446
|
else
|
|
419
|
-
|
|
447
|
+
config.logger.level = Logger::INFO
|
|
420
448
|
end
|
|
449
|
+
|
|
450
|
+
# Load specific merchant if specified
|
|
451
|
+
if options[:merchant]
|
|
452
|
+
config.load_merchant(merchant_id: options[:merchant])
|
|
453
|
+
elsif options[:merchant_index]
|
|
454
|
+
config.load_merchant(index: options[:merchant_index])
|
|
455
|
+
end
|
|
456
|
+
|
|
457
|
+
puts "Using merchant: #{config.merchant_name} (#{config.merchant_id})"
|
|
421
458
|
end
|
|
422
459
|
|
|
423
460
|
def print_order_summary(orders)
|
|
@@ -146,7 +146,14 @@ module CloverSandboxSimulator
|
|
|
146
146
|
def apply_merchant_config(merchant)
|
|
147
147
|
@merchant_id = merchant["CLOVER_MERCHANT_ID"]
|
|
148
148
|
@merchant_name = merchant["CLOVER_MERCHANT_NAME"]
|
|
149
|
-
|
|
149
|
+
# CLOVER_API_TOKEN = static API token (never expires)
|
|
150
|
+
# CLOVER_ACCESS_TOKEN = OAuth JWT token (expires, can be refreshed)
|
|
151
|
+
# Prefer static API token if available, fall back to OAuth token
|
|
152
|
+
if merchant["CLOVER_API_TOKEN"].to_s.length > 10
|
|
153
|
+
@api_token = merchant["CLOVER_API_TOKEN"]
|
|
154
|
+
elsif merchant["CLOVER_ACCESS_TOKEN"].to_s.length > 10
|
|
155
|
+
@api_token = merchant["CLOVER_ACCESS_TOKEN"]
|
|
156
|
+
end
|
|
150
157
|
@refresh_token = merchant["CLOVER_REFRESH_TOKEN"] if merchant["CLOVER_REFRESH_TOKEN"].to_s.length > 10
|
|
151
158
|
@public_token = merchant["PUBLIC_TOKEN"] unless merchant["PUBLIC_TOKEN"].to_s.empty?
|
|
152
159
|
@private_token = merchant["PRIVATE_TOKEN"] unless merchant["PRIVATE_TOKEN"].to_s.empty?
|