@garuhq/cli 0.8.0 → 0.10.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,62 @@
3
3
  All notable changes to `@garuhq/cli` are documented in this file. Format:
4
4
  [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). Versioning: [SemVer](https://semver.org/).
5
5
 
6
+ ## [0.10.0] — 2026-08-22
7
+
8
+ ### Added
9
+
10
+ - **`garu customers` — manage your customer base.** `create`, `list`, `get`,
11
+ `update`, `set-billing-email`, `clear-billing-email`, `delete`. Backed by
12
+ the new `/api/v1/customers`, keyed on `uuid`.
13
+
14
+ ### Changed
15
+
16
+ - **`@garuhq/node` bumped to `2.0.0`.** Breaking for `garu.customers.*` (see
17
+ that package's changelog); does not affect any other `garu-cli` command —
18
+ `customers` is a new command group in this release, so nothing here
19
+ changes behavior.
20
+
21
+ ## [0.9.0] — 2026-08-21
22
+
23
+ ### Added
24
+
25
+ - **`garu installment-plans` — boleto parcelado (carnê).** Sell a product as
26
+ 2–12 monthly bank slips: `create`, `list`, `get`, `reissue`, `postpone`,
27
+ `mark-paid`, `cancel`, `request-refund`.
28
+ - **`garu refund-requests` — refunds Garu cannot make for you.** A boleto
29
+ cannot be reversed and Celcoin exposes no Pix devolução, so this records the
30
+ request and waits for you to confirm the transfer: `list`, `get`, `confirm`,
31
+ `reject`.
32
+
33
+ ### Changed
34
+
35
+ - **`@garuhq/node` bumped to `1.1.0`.**
36
+
37
+ ### Breaking
38
+
39
+ - **`charges` commands now use the versioned `/api/v1/charges` API**, via
40
+ `@garuhq/node@1.0.0`+.
41
+ - `garu charges get <id>` and `garu charges refund <id>` now take the
42
+ charge's **uuid**, not the old numeric id.
43
+ - `garu charges refund --amount` is now **decimal BRL / reais** (e.g.
44
+ `10.00`), not centavos. The `--idempotency-key` flag on `refund` is
45
+ removed — the v1 refund route doesn't take one.
46
+ - `garu charges create --type credit_card` keeps its flag spelling; the
47
+ underlying SDK call now sends `creditCard` and a `card` object (was
48
+ `cardInfo`) — no CLI-facing change beyond the `--card-*` flags already in
49
+ use.
50
+ - `garu charges list --payment-method` now takes `credit_card` (was
51
+ `creditcard`, undocumented and unvalidated); `--status` is validated
52
+ against the new friendly status set (`pending`, `authorized`, `paid`,
53
+ `failed`, `expired`, `canceled`, `refund_pending`, `refunded`,
54
+ `chargeback`).
55
+ - `garu charges get`/`list` output: `charge.uuid` (was `.id`),
56
+ `charge.paymentMethod` (was `.paymentMethodId`), `charge.createdAt` /
57
+ `.expiresAt` (was `.date` / `.deadline`), and a new `charge.chargedTotal`
58
+ field (what was actually charged, vs. `.amount`, the product's base
59
+ price). `charges list`'s response shape is now `{ data, count, totalCount,
60
+ totalPages }` (was `{ data, meta }`).
61
+
6
62
  ## [0.8.0] — 2026-07-18
7
63
 
8
64
  ### Changed
package/README.md CHANGED
@@ -156,13 +156,13 @@ garu charges list --status paid --limit 50
156
156
  garu charges list --search "Maria" --payment-method pix
157
157
  ```
158
158
 
159
- | Flag | Description |
160
- | --------------------------- | ------------------------------------------- |
161
- | `--page <n>` | Page number (1-based) |
162
- | `--limit <n>` | Items per page (1-100) |
163
- | `--status <status>` | Filter by status (e.g. `paid`, `pending`) |
164
- | `--search <query>` | Search by customer name, email, or document |
165
- | `--payment-method <method>` | Filter: `pix`, `creditcard`, `boleto` |
159
+ | Flag | Description |
160
+ | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
161
+ | `--page <n>` | Page number (1-based) |
162
+ | `--limit <n>` | Items per page (1-100) |
163
+ | `--status <status>` | Filter by status: `pending`, `authorized`, `paid`, `failed`, `expired`, `canceled`, `refund_pending`, `refunded`, `chargeback` |
164
+ | `--search <query>` | Search by customer name, email, or document |
165
+ | `--payment-method <method>` | Filter: `pix`, `credit_card`, `boleto` |
166
166
 
167
167
  ---
168
168
 
@@ -211,32 +211,31 @@ garu charges create --type credit_card --product-id prod-uuid \
211
211
 
212
212
  ### `garu charges get`
213
213
 
214
- Fetch a single charge by ID.
214
+ Fetch a single charge by its uuid.
215
215
 
216
216
  ```bash
217
- garu charges get 4472
218
- garu charges get 4472 --json | jq '.status'
217
+ garu charges get 6f1c9b2e-4a7d-4f0b-9a3e-1d2c3b4a5e6f
218
+ garu charges get 6f1c9b2e-4a7d-4f0b-9a3e-1d2c3b4a5e6f --json | jq '.status'
219
219
  ```
220
220
 
221
221
  ---
222
222
 
223
223
  ### `garu charges refund`
224
224
 
225
- Refund a charge (full or partial).
225
+ Refund a charge by its uuid (full or partial).
226
226
 
227
227
  ```bash
228
228
  # Full refund
229
- garu charges refund 4472
229
+ garu charges refund 6f1c9b2e-4a7d-4f0b-9a3e-1d2c3b4a5e6f
230
230
 
231
- # Partial refund (1000 centavos = R$10.00)
232
- garu charges refund 4472 --amount 1000 --reason "customer_request"
231
+ # Partial refund, in decimal BRL / reais
232
+ garu charges refund 6f1c9b2e-4a7d-4f0b-9a3e-1d2c3b4a5e6f --amount 10.00 --reason "customer_request"
233
233
  ```
234
234
 
235
- | Flag | Description |
236
- | ------------------------- | ------------------------------------------------- |
237
- | `--amount <centavos>` | Partial refund amount in centavos (omit for full) |
238
- | `--reason <text>` | Optional refund reason |
239
- | `--idempotency-key <key>` | Idempotency key (auto-generated if omitted) |
235
+ | Flag | Description |
236
+ | ------------------ | ------------------------------------------------------------------ |
237
+ | `--amount <reais>` | Partial refund amount in decimal BRL, e.g. `10.00` (omit for full) |
238
+ | `--reason <text>` | Optional refund reason |
240
239
 
241
240
  ---
242
241
 
@@ -328,6 +327,118 @@ The process **exits non-zero** when:
328
327
 
329
328
  ---
330
329
 
330
+ ### `garu installment-plans create`
331
+
332
+ Sell a product as **boleto parcelado (carnê)** — a purchase split into 2–12
333
+ monthly bank slips. This is seller-financed consumer credit: nobody guarantees
334
+ a boleto, so Garu never advances funds and carries none of the default risk.
335
+ Only the first slip is registered at creation; the rest are emitted month by
336
+ month once parcela 1 compensates.
337
+
338
+ ```bash
339
+ garu installment-plans create \
340
+ --product-id 40381e8e-6ee7-4b8e-9393-766a6e2109d2 \
341
+ --customer-id 4821 --installments 12
342
+
343
+ # Attribute the sale to an affiliate (fixed for the whole carnê) and pick
344
+ # the first due date
345
+ garu installment-plans create \
346
+ --product-id 40381e8e-6ee7-4b8e-9393-766a6e2109d2 \
347
+ --customer-id 4821 --installments 6 \
348
+ --first-due-date 2026-10-05 --affiliate-id 5
349
+ ```
350
+
351
+ | Flag | Description |
352
+ | ------------------------- | --------------------------------------------------------------- |
353
+ | `--product-id <uuid>` | Product uuid (must have boleto parcelado enabled) — required |
354
+ | `--customer-id <n>` | Customer id — required |
355
+ | `--installments <n>` | 2–12 installments — required |
356
+ | `--first-due-date <date>` | First installment due date (default: today) |
357
+ | `--affiliate-id <n>` | Attribute the sale to this affiliate (fixed for the whole plan) |
358
+ | `--idempotency-key <key>` | Idempotency key (auto-generated if omitted) |
359
+
360
+ ---
361
+
362
+ ### `garu installment-plans` — other subcommands
363
+
364
+ | Command | Description |
365
+ | --------------------------------------------------------------- | ------------------------------------------------------------------------ |
366
+ | `list [--page --limit --customer-id --product-id --status ...]` | List carnês (`--status` repeatable; `--due-from/--due-to`) |
367
+ | `get <uuid>` | Fetch a carnê with every installment: due date, status, barcode and PDF |
368
+ | `reissue <uuid> <number>` | Issue a segunda via for one installment once its slip has expired |
369
+ | `postpone <uuid> <number> --new-due-date <date>` | Move one installment to a later date (its siblings keep theirs) |
370
+ | `mark-paid <uuid> <number>` | Record an installment as paid when the webhook never arrived |
371
+ | `cancel <uuid> [--note]` | Cancel the carnê — stops emission/reminders, cancels open provider slips |
372
+ | `request-refund <uuid> [--amount --reason]` | Ask for the carnê to be refunded (see `garu refund-requests` below) |
373
+
374
+ ---
375
+
376
+ ### `garu refund-requests`
377
+
378
+ Garu cannot reverse a boleto, and Celcoin exposes no Pix devolução, so a
379
+ refund on either rail is a request-and-notify flow: you transfer the money
380
+ back yourself, then tell Garu it happened. Card charges keep their automated
381
+ reversal via `garu charges refund`.
382
+
383
+ ```bash
384
+ # See everything you still owe a buyer
385
+ garu refund-requests list --status pending
386
+
387
+ # After you've transferred the money back
388
+ garu refund-requests confirm a1b2c3d4-e5f6-7890-abcd-ef1234567890 \
389
+ --note "Pix devolvido em 14/08, e2e E12345678"
390
+
391
+ # Decline instead — the carnê or charge is left untouched
392
+ garu refund-requests reject a1b2c3d4-e5f6-7890-abcd-ef1234567890 \
393
+ --note "Produto entregue e retirado na loja"
394
+ ```
395
+
396
+ | Command | Description |
397
+ | ------------------------------------------------------ | ------------------------------------------------------------ |
398
+ | `list [--page --limit --status --plan-id --charge-id]` | List refund requests (`--status` repeatable) |
399
+ | `get <uuid>` | Fetch a single refund request |
400
+ | `confirm <uuid> [--note]` | Record that you returned the money — call AFTER the transfer |
401
+ | `reject <uuid> [--note]` | Decline the request — the carnê or charge is untouched |
402
+
403
+ ---
404
+
405
+ ### `garu customers create`
406
+
407
+ Register a customer for the current seller. Registering the same `document`
408
+ twice attaches your profile to the existing global customer instead of
409
+ erroring — safe to call once per seller per person.
410
+
411
+ ```bash
412
+ garu customers create \
413
+ --name "Maria Silva" --email maria@exemplo.com.br \
414
+ --document 12345678909 --phone 11987654321 \
415
+ --person-type fisica
416
+ ```
417
+
418
+ | Flag | Description |
419
+ | ----------------------- | ---------------------------------------------- |
420
+ | `--name <name>` | Customer name (required) |
421
+ | `--email <email>` | Customer email (required) |
422
+ | `--document <document>` | CPF (11 digits) or CNPJ (14 digits) (required) |
423
+ | `--phone <phone>` | Phone with area code, 10-11 digits (required) |
424
+ | `--person-type <type>` | `fisica` or `juridica` (required) |
425
+ | `--zip-code <cep>` etc. | Address fields (all optional) |
426
+
427
+ ---
428
+
429
+ ### `garu customers` — other subcommands
430
+
431
+ | Command | Description |
432
+ | ------------------------------------------ | ---------------------------------------------------------------- |
433
+ | `list [--page --limit --search --status]` | List customers (`--status overdue` filters to at-risk customers) |
434
+ | `get <uuid>` | Fetch a single customer |
435
+ | `update <uuid> [...]` | Partial update — same flags as `create`, all optional |
436
+ | `set-billing-email <uuid> --email <email>` | Set the sticky per-seller billing-email override |
437
+ | `clear-billing-email <uuid>` | Clear the override, falling back to the last-used email |
438
+ | `delete <uuid>` | Unlink the customer from the current seller |
439
+
440
+ ---
441
+
331
442
  ### `garu doctor`
332
443
 
333
444
  Run environment diagnostics. Verifies your CLI version, API connectivity, credentials, and detects AI agent integrations.