Class: Wiq::Commands::Payouts

Inherits:
Base
  • Object
show all
Defined in:
lib/wiq/commands/payouts.rb

Constant Summary collapse

COMMON_STATUSES =

Payout.status is a plain text column mirroring the billing partner's normalized status — no integer-enum translation needed (unlike Charge.status). Common values below; the column is not constrained server-side, so --status stays free-form.

%w[paid in_transit scheduled].freeze
BILLING_PARTNERS =
%w[stripe justifi].freeze
DEFAULT_PER_PAGE =
25

Instance Method Summary collapse

Methods inherited from Base

exit_on_failure?

Instance Method Details

#listObject



60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/wiq/commands/payouts.rb', line 60

def list
  params = build_list_params
  records, total = fetch_index("/api/v1/payouts", params, key: "payouts")
  render_index(
    records, total: total,
    summary: "Listed #{records.size} payouts#{summary_filters_suffix}.",
    breadcrumbs: [
      { "cmd" => "wiq payouts show <id>",
        "description" => "Inspect a single payout" },
      { "cmd" => "wiq charges list --since <date> --until <date> --all",
        "description" => "Charges in a window — each row embeds its payout for reconciliation" }
    ]
  )
end

#show(id) ⇒ Object



86
87
88
89
90
91
92
93
94
95
# File 'lib/wiq/commands/payouts.rb', line 86

def show(id)
  payout = client.get("/api/v1/payouts/#{id}")
  render(payout,
         summary: "Payout #{payout["id"]}#{payout["status"]}, " \
                  "#{format_cents(payout["amount"])} deposited #{payout["deposits_at"]}",
         breadcrumbs: [
           { "cmd" => "wiq charges list --since <date> --until <date> --all",
             "description" => "Find this payout's charges (rows embed payout.id)" }
         ])
end