feat(cli): add partial payment support and preview to iln pay command…#307
Open
BernardOnuh wants to merge 1 commit into
Open
feat(cli): add partial payment support and preview to iln pay command…#307BernardOnuh wants to merge 1 commit into
BernardOnuh wants to merge 1 commit into
Conversation
…Invoice-Liquidity-Network#232) - Add cli/src/commands/pay-types.ts PayOptions, InvoicePayState, PayResult - Add cli/src/commands/pay.ts - makePayCommand(prompter, fetcher, executor) — injected-deps pattern - Full payment: iln pay --id X (uses remaining amount) - Partial payment: iln pay --id X --amount 50 - Payment preview before signing with LP earnings note - Confirmation prompt (skipped with --yes) - printSettlementReceipt: full breakdown with LP earnings and tx hash - printPartialProgress: 'Paid X USDC. Y USDC remaining.' - Amount validation: rejects amounts exceeding remaining balance - Add cli/tests/e2e/pay.test.ts (14 tests) Full payment, partial payment, preview, confirmation, cancellation, receipt printers, amount validation Closes Invoice-Liquidity-Network#232
|
@BernardOnuh Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
Implements the
iln paycommand with partial payment mode and a payment preview before signing — resolving the two missing features called out in #232.Usage
User-facing output
Preview (shown before signing):
Paying 50 USDC of 100 USDC remaining on Invoice #INV-100 (Payer earns LP: 0.25 USDC)
Partial progress:
Paid 50 USDC. 50 USDC remaining.
Settlement receipt (full payment):
── Settlement Receipt ──────────────────────────────
Invoice: INV-100
Paid: 100 USDC
Remaining: 0 USDC
LP earned: 0.5 USDC
Tx hash: TX_ABC123
Status: FULLY PAID ✓
────────────────────────────────────────────────────
Files changed
cli/src/commands/pay-types.tsPayOptions,InvoicePayState,PayResulttypescli/src/commands/pay.tscli/tests/e2e/pay.test.tscli/src/index.tsmakePayCommandinto the CLITest coverage
--amountvalue--yes--yesCloses #232