Skip to content

Fix: 3 issues (#873, #874, #875) - #950

Open
Mosimi25 wants to merge 1 commit into
Stellar-split:mainfrom
Mosimi25:simple/873-874-875
Open

Mosimi25 wants to merge 1 commit into
Stellar-split:mainfrom
Mosimi25:simple/873-874-875

Conversation

@Mosimi25

Copy link
Copy Markdown

Closes #873
Closes #874
Closes #875

Issues

#873 Implement recurring invoice templates with customizable schedules

Overview

Add ability for creators to set up recurring invoices with daily, weekly, monthly, or custom interval schedules.

Requirements

  • Design recurring schedule interface
  • Implement schedule validation and conflict detection
  • Add template management (create, edit, delete)
  • Integrate with payment processing
  • Add schedule preview before confirmation
  • Track recurring invoice history

Acceptance Criteria

[ ] Recurring invoices can be created and scheduled
[ ] Schedule conflicts are detected and prevented
[ ] Templates persist correctly
[ ] Payments process on schedule automatically
[ ] Schedule can be paused/resumed/cancelled

Definition of Done

All CI checks must pass before the PR is reviewed.

#874 Add multi-currency invoice support with automatic conversion

Overview

Enable creators to issue invoices in multiple currencies with automatic XLM conversion at current market rates.

Requirements

  • Integrate currency exchange rate API
  • Add currency selector to invoice creation
  • Implement real-time rate updates
  • Display converted amounts in UI
  • Handle rate lock for payments
  • Add currency history tracking

Acceptance Criteria

[ ] Invoices can be created in multiple currencies
[ ] Exchange rates are current and accurate
[ ] Conversion shown in payment preview
[ ] Rate locked during payment window
[ ] Currency history available

Definition of Done

All CI checks must pass before the PR is reviewed.

#875 Add invoice bundling for batch operations

Overview

Allow creators to bundle multiple invoices and send them as a group with unified payment options.

Requirements

  • Design bundle creation workflow
  • Implement batch selection and validation
  • Add bundle summary and preview
  • Enable unified payment collection
  • Track bundle completion status
  • Add bundle analytics

Acceptance Criteria

[ ] Multiple invoices can be bundled
[ ] Bundle preview shows all items
[ ] Unified payment collection works
[ ] Bundle status tracked correctly
[ ] Analytics available per bundle

Definition of Done

All CI checks must pass before the PR is reviewed.

Summary

This is a large multi-feature change. Implement shared domain models first (types, services) before UI wiring so components consume stable APIs. Reuse existing localStorage persistence patterns (subscriptions, templates, payment schedules) for schedules and bundles, and keep the existing single-currency and non-bundle code paths working to avoid regressions. Rate locks must be persisted with an expiry and validated at submission time; currency history should be appended on payment success. Bundle unified payment should reuse PaymentAggregator and the existing payWithNonce flow. Add tests alongside each service and run lint/typecheck/test before opening the PR.

Changes

  • Define the shared domain types for all three features: RecurringSchedule (frequency daily/weekly/monthly/custom, interval, start/end, timezone, status active/paused/cancelled, nextRunDate, history entries), CurrencyRate/RateLock/CurrencyHistoryEntry, and Bundle (id, invoiceIds, status, totals, timestamps, analytics). Extend the existing Subscription types where they overlap so the new models compose with the current subscription code. (src/types/subscription.ts)
  • Add a recurring-schedule service: create/edit/delete templates, validate interval bounds and date ordering, detect conflicts against existing schedules, compute next-run dates, and implement pause/resume/cancel transitions plus history recording. Reuse the existing load/persist helpers in this file and export the new schedule API alongside the current subscription helpers. (src/lib/subscriptions.ts)
  • Add date helpers needed by recurring schedules and bundles: computeNextRun(frequency, interval, from), addInterval, isSameDay, and a helper to detect overlapping schedule windows. Keep existing getRelativeAge intact. (src/lib/dateUtils.ts)
  • Create a currency service that fetches exchange rates from the rate API, caches them with TTL, exposes conversion helpers (convertToXlm/convertFromXlm), captures and validates rate locks with expiry, and persists per-invoice currency history snapshots. Include unit-testable pure functions for conversion and lock expiry. (src/lib/currencyService.ts)
  • Extend the fiat rate hook to also expose the full multi-currency rate map, a refresh function, and a subscription for live updates so invoice creation and payment previews can display converted amounts and react to rate changes. Preserve the existing single-currency API used elsewhere. (src/hooks/useFiatRate.ts)
  • Add a useCurrencyRates hook (or extend useXlmUsdcRate) that wraps the currency service, polls for live rate updates, and exposes per-currency conversion plus a lockRate(currency, amount) helper that returns a persisted rate lock for the payment window. (src/hooks/useXlmUsdcRate.ts)
  • Extend the invoice form hook to support selecting an invoice currency, storing the currency on the invoice meta, and validating that the selected currency is supported. Expose the selected currency and converted XLM preview value to consumers. (src/hooks/useInvoiceForm.ts)
  • Create a bundle service: create/validate bundles (eligibility, duplicates, currency consistency), compute summary totals, transition bundle status (draft/collecting/completed/cancelled), update per-item status, and compute analytics (counts, totals, completion rate). Reuse PaymentAggregator for totals where useful. (src/lib/bundleService.ts)
  • Extend batch utilities with bundle-aware validation helpers: detect duplicate invoices across a bundle, verify all invoices share a compatible currency, and compute bundle eligibility from invoice status. Keep findBatchDuplicates intact. (src/lib/batchUtils.ts)
  • Extend PaymentAggregator with a static/helper method to aggregate totals across multiple invoices for a bundle (sum funded, total, per-invoice progress) so unified bundle payment collection can reuse the existing aggregation logic. (src/lib/PaymentAggregator.ts)
  • Update the payment submission hook to accept an optional rate lock and bundle context: validate the rate lock has not expired before submitting, and on success record the payment against the bundle (updating bundle status) and append a currency history entry. Keep the existing simulation flow. (src/hooks/usePaymentSubmission.ts)
  • Add API client helpers for the new endpoints: recurring schedule CRUD, currency rates and rate-lock creation, and bundle create/update/analytics. Use apiFetch from apiClient so CSRF is attached to mutating calls, and keep existing exports unchanged. (src/lib/api.ts)
  • Extend the invoice list hook to expose bundle membership and recurring-schedule linkage for each invoice (e.g. bundleId, scheduleId) so the table and cards can show bundle/schedule badges and filter by them. Preserve cache-then-network behaviour. (src/hooks/useInvoices.ts)
  • Update RecurringWizard to collect the full schedule (frequency daily/weekly/monthly/custom, interval, start/end, timezone), validate input, show conflict errors from the schedule service, and render a schedule preview before confirmation. Wire the confirm handler to the recurring-schedule service create/update API. (src/components/RecurringWizard.tsx)
  • Extend TemplateManager to support recurring-schedule templates: create/edit/delete templates that include a schedule config, show schedule summary and next-run dates, and expose pause/resume/cancel controls for templates that are active. Reuse the existing versioning and preview modals. (src/components/TemplateManager.tsx)
  • Update PaymentScheduler to read due recurring schedules from the schedule service, trigger payment submission for due invoices, record history entries, and surface pause/resume/cancel actions. Ensure the scheduler respects schedule status and conflict-free next-run computation. (src/components/PaymentScheduler.tsx)
  • Update the calendar preview to accept the new schedule shape (frequency/interval/start/end) and render upcoming recurring invoice dates from the schedule service, including paused/cancelled state indication. (src/components/SubscriptionCalendarPreview.tsx)
  • Update PayModal to show the invoice currency, the converted XLM amount using live rates, and to capture a rate lock when the user initiates payment. Pass the rate lock through to payment submission and display a lock-expiry warning if the window elapses. (src/components/PayModal.tsx)
  • Update PaymentBreakdownModal to display the invoice currency, the converted XLM amount, the applied exchange rate, and the rate-lock status/expiry so users see the conversion before confirming. (src/components/PaymentBreakdownModal.tsx)
  • Update InvoiceDetail to show the invoice currency, the converted XLM equivalent using live rates, and a currency-history section listing rate snapshots recorded for the invoice. (src/components/InvoiceDetail.tsx)
  • Update BatchPayModal to support bundle mode: accept a bundle, show the bundle summary/preview (all items, totals, currency), collect a single unified payment via PaymentAggregator, and update bundle status on completion. Keep the existing per-invoice amount flow for non-bundle use. (src/components/BatchPayModal.tsx)
  • Update BatchPayQueue to render bundle items with bundle status badges and per-item completion state, and to show the bundle running total and completion progress when used inside a bundle workflow. (src/components/BatchPayQueue.tsx)
  • Add bundle selection to InvoiceTable: multi-select checkboxes that feed a bundle creation workflow, validation feedback for ineligible/duplicate invoices, and a 'Create bundle' action that opens the bundle preview. Show bundle membership badges per row. (src/components/InvoiceTable.tsx)
  • Add bundle and recurring-schedule badges to InvoiceCard (bundle id/status, schedule id/status) and a selection checkbox for bundle creation, consistent with the existing compare checkbox pattern. (src/components/InvoiceCard.tsx)
  • Create a BundleCreationModal component that implements the bundle creation workflow: batch selection review, validation errors, bundle summary/preview with totals and currency, and confirm action that persists the bundle via the bundle service and opens unified payment. (src/components/BundleCreationModal.tsx)
  • Create a BundleAnalyticsPanel component that displays per-bundle analytics (invoice count, total amount, paid amount, completion rate, status breakdown) sourced from the bundle service. (src/components/BundleAnalyticsPanel.tsx)
  • Add unit tests covering recurring schedule validation, conflict detection, next-run computation, and pause/resume/cancel transitions; currency conversion, rate-lock expiry, and history recording; and bundle validation, status transitions, and aggregation. Ensure lint/typecheck/test CI passes. (src/lib/tests/recurringCurrencyBundle.test.ts)

Co-authored-by: Simple Agent <agent@simple.dev>
@vercel

vercel Bot commented Oct 17, 2026

Copy link
Copy Markdown

@Mosimi25 is attempting to deploy a commit to the kingsman-99's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Oct 17, 2026

Copy link
Copy Markdown

@Mosimi25 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! 🚀

Learn more about application limits

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant