wiq-cli 0.4.0 → 0.5.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: ee99cfc6ad08abdf7e1318883bcfa3ecc45635d2d521de150ed1622d867b0ebc
4
- data.tar.gz: d9b6f3d18c731b4ddfe1060a03a40310e4d58b940d1f00f97dd3ef480f22dd74
3
+ metadata.gz: eb99112754a10af0b80b20d71425f95e864fb28a3db78a1c3d0e7d75340ebf8f
4
+ data.tar.gz: ee12d73a7e5053dd48540c73c35e4327bb3f4456998f3182725b2a1d40a99403
5
5
  SHA512:
6
- metadata.gz: 89f8f34ae2184fab2069c8a0d51eaf53936dcb69e538e2fd7c0f659900e1be6ea3ee2f43101726ecb25bcd933a77beb20b2b954af4facbbfb248f4f0e40ae914
7
- data.tar.gz: b63afbb5f6755e1821f268d0a797fc1d1f12d97148f790aa340ad0ec55bdf86df91ee649d003caaabe33351e91a25f848217fd6e26da09c3cf6dcc136b173d15
6
+ metadata.gz: 92e5c6842312a60ad606f711b5c6893c2a2c761e181b0c999dcf0fcb6bb1e92f8cc3b25dadd6c365656b91f7b242666b43131e5680ec440036c67868f04eb794
7
+ data.tar.gz: a4e06d43acf373996c31593b6a736555ab9b5aa71a4d7c0baf606f8dc76fa090f3ae7519820ec04ed6ca1167375b977261d12312bca2fe07b70de86f902430e6
data/lib/wiq/cli.rb CHANGED
@@ -91,5 +91,8 @@ module Wiq
91
91
 
92
92
  desc "billing_profiles SUBCOMMAND", "Look up a parent or coach's billing profile (admin only)"
93
93
  subcommand "billing_profiles", Wiq::Commands::BillingProfiles
94
+
95
+ desc "payouts SUBCOMMAND", "Bank payouts / deposits — list and show (admin only)"
96
+ subcommand "payouts", Wiq::Commands::Payouts
94
97
  end
95
98
  end
@@ -0,0 +1,124 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Wiq
4
+ module Commands
5
+ class Payouts < Base
6
+ # Payout.status is a plain text column mirroring the billing
7
+ # partner's normalized status — no integer-enum translation needed
8
+ # (unlike Charge.status). Common values below; the column is not
9
+ # constrained server-side, so --status stays free-form.
10
+ COMMON_STATUSES = %w[paid in_transit scheduled].freeze
11
+ BILLING_PARTNERS = %w[stripe justifi].freeze
12
+ DEFAULT_PER_PAGE = 25
13
+
14
+ desc "list", "List bank payouts / deposits (finance: admin coach only)"
15
+ long_desc <<~DESC
16
+ Returns payouts — the batched deposits Stripe or Justifi (WIQ
17
+ Payments) sends to the club's bank account. Useful for "when does
18
+ our money arrive?", "what landed in the bank last week?", and
19
+ reconciling a bank statement line against WIQ charges.
20
+
21
+ Auth: admin-only (Pundit scope filters non-admin coach PATs to
22
+ empty results; parent/wrestler PATs return 403).
23
+
24
+ Filters translate to Ransack server-side (allowlist: deposits_at,
25
+ status, billing_partner, amount, created_at):
26
+ --status <str> q[status_eq]. Common values: paid,
27
+ in_transit, scheduled. Free-form —
28
+ the column mirrors the billing
29
+ partner's status strings.
30
+ --billing-partner <str> q[billing_partner_eq] — stripe | justifi
31
+ (justifi is branded "WIQ Payments").
32
+ --since <YYYY-MM-DD> q[deposits_at_gteq]
33
+ --until <YYYY-MM-DD> q[deposits_at_lteq]
34
+
35
+ --since/--until filter on deposits_at (when the money reaches the
36
+ bank), not created_at — that's the date a treasurer reconciling a
37
+ bank statement cares about. Rows come back newest-deposit first.
38
+
39
+ Money fields are integer cents. Each row: amount (net deposit),
40
+ payments_count/payments_total, refunds_count/refunds_total,
41
+ fees_total, status, deposits_at, billing_partner, description,
42
+ and destination (bank name + last4). Payouts accrue slowly (a
43
+ few per week), so default page size is #{DEFAULT_PER_PAGE}; pass
44
+ --all with --since to bound an exhaustive scan.
45
+
46
+ To see which individual charges landed in a payout, go through
47
+ the charges side: each `wiq charges list` row embeds its payout,
48
+ so filter charges by date window and group on payout.id.
49
+ DESC
50
+ method_option :status, type: :string,
51
+ desc: "Filter by status (common: #{COMMON_STATUSES.join(", ")})"
52
+ method_option :billing_partner, type: :string, enum: BILLING_PARTNERS,
53
+ desc: "Filter by billing partner (stripe | justifi)"
54
+ method_option :since, type: :string, desc: "Earliest deposits_at (YYYY-MM-DD)"
55
+ method_option :until, type: :string, desc: "Latest deposits_at (YYYY-MM-DD)"
56
+ method_option :per_page, type: :numeric, default: DEFAULT_PER_PAGE,
57
+ desc: "Page size (default #{DEFAULT_PER_PAGE})"
58
+ method_option :all, type: :boolean, default: false,
59
+ desc: "Follow pagination until exhausted"
60
+ def list
61
+ params = build_list_params
62
+ records, total = fetch_index("/api/v1/payouts", params, key: "payouts")
63
+ render_index(
64
+ records, total: total,
65
+ summary: "Listed #{records.size} payouts#{summary_filters_suffix}.",
66
+ breadcrumbs: [
67
+ { "cmd" => "wiq payouts show <id>",
68
+ "description" => "Inspect a single payout" },
69
+ { "cmd" => "wiq charges list --since <date> --until <date> --all",
70
+ "description" => "Charges in a window — each row embeds its payout for reconciliation" }
71
+ ]
72
+ )
73
+ end
74
+
75
+ desc "show ID", "Fetch a single payout"
76
+ long_desc <<~DESC
77
+ Full payout payload: amount, currency, status, deposits_at,
78
+ payments_count/payments_total, refunds_count/refunds_total,
79
+ fees_total, billing_partner (+ billing_partner_id, the Stripe/
80
+ Justifi payout id like po_...), delivery_method, description, and
81
+ destination bank account (holder name, bank name, last4,
82
+ account type). Money fields are integer cents.
83
+
84
+ Auth: admin-only; a payout outside the PAT's team returns 403.
85
+ DESC
86
+ def show(id)
87
+ payout = client.get("/api/v1/payouts/#{id}")
88
+ render(payout,
89
+ summary: "Payout #{payout["id"]} — #{payout["status"]}, " \
90
+ "#{format_cents(payout["amount"])} deposited #{payout["deposits_at"]}",
91
+ breadcrumbs: [
92
+ { "cmd" => "wiq charges list --since <date> --until <date> --all",
93
+ "description" => "Find this payout's charges (rows embed payout.id)" }
94
+ ])
95
+ end
96
+
97
+ no_commands do
98
+ def build_list_params
99
+ params = { "per_page" => options[:per_page] || DEFAULT_PER_PAGE }
100
+ params["q[status_eq]"] = options[:status] if options[:status]
101
+ params["q[billing_partner_eq]"] = options[:billing_partner] if options[:billing_partner]
102
+ params["q[deposits_at_gteq]"] = options[:since] if options[:since]
103
+ params["q[deposits_at_lteq]"] = options[:until] if options[:until]
104
+ params
105
+ end
106
+
107
+ def summary_filters_suffix
108
+ bits = []
109
+ bits << "status=#{options[:status]}" if options[:status]
110
+ bits << "billing_partner=#{options[:billing_partner]}" if options[:billing_partner]
111
+ bits << "since=#{options[:since]}" if options[:since]
112
+ bits << "until=#{options[:until]}" if options[:until]
113
+ bits.empty? ? "" : " (#{bits.join(", ")})"
114
+ end
115
+
116
+ def format_cents(cents)
117
+ return "?" unless cents.is_a?(Numeric)
118
+
119
+ format("$%.2f", cents / 100.0)
120
+ end
121
+ end
122
+ end
123
+ end
124
+ end
data/lib/wiq/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Wiq
4
- VERSION = "0.4.0"
4
+ VERSION = "0.5.0"
5
5
  end
data/lib/wiq.rb CHANGED
@@ -29,4 +29,5 @@ require "wiq/commands/wrestlers"
29
29
  require "wiq/commands/parents"
30
30
  require "wiq/commands/charges"
31
31
  require "wiq/commands/billing_profiles"
32
+ require "wiq/commands/payouts"
32
33
  require "wiq/cli"
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: wiq
3
- description: Use this skill when the user asks about their WrestlingIQ data — rosters, attendance, check-ins, paid sessions and registrations, the prospects/leads pipeline, financial metrics, reports, USAW/AAU memberships, fundraising, online store orders, or per-location/site breakdowns for multi-gym clubs. The `wiq` CLI provides read-only access to /api/v1 via personal access tokens. Recognize phrasings like "how is our pipeline?", "who came to practice this week?", "show me the roster", "what's our MRR?", "which kids need USAW renewal?", "how is the Eastside gym doing?", or anything that maps to a wrestling club's admin workflows.
3
+ description: Use this skill when the user asks about their WrestlingIQ data — rosters, attendance, check-ins, paid sessions and registrations, the prospects/leads pipeline, financial metrics, payouts/bank deposits, reports, USAW/AAU memberships, fundraising, online store orders, or per-location/site breakdowns for multi-gym clubs. The `wiq` CLI provides read-only access to /api/v1 via personal access tokens. Recognize phrasings like "how is our pipeline?", "who came to practice this week?", "show me the roster", "what's our MRR?", "which kids need USAW renewal?", "how is the Eastside gym doing?", or anything that maps to a wrestling club's admin workflows.
4
4
  ---
5
5
 
6
6
  # WrestlingIQ CLI Skill
@@ -284,6 +284,25 @@ charge for the same `(billing_profile_id, chargeable_id,
284
284
  chargeable_type)` tuple exists AFTER the failure's `created_at`. The
285
285
  canonical pattern is in `wiq workflows show failed-payments-recent`.
286
286
 
287
+ ### Payouts (bank deposits)
288
+
289
+ For "when does our money hit the bank?" / "what deposited last week?" /
290
+ bank-statement reconciliation — use the payouts surface (admin PAT only):
291
+
292
+ ```bash
293
+ wiq payouts list --since 2026-08-01 --until 2026-08-18 # deposits in a window
294
+ wiq payouts list --status in_transit # money on the way
295
+ wiq payouts show <id> # one deposit's detail
296
+ ```
297
+
298
+ `--since/--until` filter on `deposits_at` (bank arrival date), not
299
+ `created_at`. `Payout.status` is a plain string column (paid,
300
+ in_transit, scheduled, ...) — no integer-enum translation, unlike
301
+ charges. All
302
+ money fields are integer cents. To see which charges make up a payout,
303
+ go through charges: each `wiq charges list` row embeds its `payout`,
304
+ so pull charges for the date window and group by `payout.id`.
305
+
287
306
  To go from a wrestler name to a billing_profile_id:
288
307
 
289
308
  ```bash
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wiq-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - WrestlingIQ
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-08-08 00:00:00.000000000 Z
11
+ date: 2026-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -94,6 +94,7 @@ files:
94
94
  - lib/wiq/commands/metrics.rb
95
95
  - lib/wiq/commands/paid_sessions.rb
96
96
  - lib/wiq/commands/parents.rb
97
+ - lib/wiq/commands/payouts.rb
97
98
  - lib/wiq/commands/prospect_families.rb
98
99
  - lib/wiq/commands/prospects.rb
99
100
  - lib/wiq/commands/registrations.rb