Skip to content

fix: expose rejected incoming payment requests - #721

Open
ovitrif wants to merge 7 commits into
masterfrom
codex/714-payment-request-errors
Open

fix: expose rejected incoming payment requests#721
ovitrif wants to merge 7 commits into
masterfrom
codex/714-payment-request-errors

Conversation

@ovitrif

@ovitrif ovitrif commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Fixes #714

Expose rejected incoming payment requests through privacy-safe diagnostics and terminal user feedback while preserving automatic recovery.

Description

  • Classify malformed incoming requests with stable parse reason codes and log only the redacted counterparty.
  • Classify endpoint-resolution and payment-target failures without logging request contents or raw errors.
  • Keep automatic presentation retries running every 120 seconds after the initial retry window.
  • End an explicit Pay attempt after fifteen failures with the localized Payment Request unavailable toast while leaving the request actionable.
  • Preserve requested expirations across suspended resolution and retry backoff, then show the localized expired toast exactly once.
  • Document the failure contract and add the simulator journey identifiers.

Linked Issues/Tasks

Preview

pr721-payment-request-unavailable-2x.mp4

QA Notes

Manual Tests

  • 1. iPhone 17 simulator on iOS 26.5/regtest → pair with an iPhone Air Paykit peer: both apps can exchange private Paykit data.
  • 2. Create profiles on both simulators → save each profile as a contact on the other → send a 1 sat incoming payment request: the request appears on the payer.
  • 3. Peer contact-payment settings → disable payment endpoints → payer Payment Requests → tap Pay: explicit resolution retries begin.
  • 4. Payment Requests → wait through fifteen explicit attempts: logs show category=resolution reason=no_supported_endpoint and redact the counterparty.
  • 5. Fifteenth failed attempt → inspect terminal feedback: PaymentRequestUnavailableToast shows Payment Request and The payment request is no longer available.
  • 6. Dismiss terminal feedback → inspect PaymentRequestRow-7abfa801-a3bd-4d74-b75a-18be91d2ddbf: PaymentRequestPay-7abfa801-a3bd-4d74-b75a-18be91d2ddbf remains enabled for another attempt.

Automated Checks

  • Focused simulator tests: 73 passed, 0 failed, 0 skipped across PaykitPaymentRequestServiceTests and PublicPaykitServiceTests.
  • Simulator build-and-run: passed on iPhone 17.
  • SwiftFormat lint: all changed Swift files pass.
  • Translation validation: 0 errors.
  • Journey XML validation: passed.
  • GitHub Actions: unit, integration, validation, local/staging builds, local E2E, multi-address staging E2E, and Paykit staging E2E pass on the final SHA.
  • Full-scheme attempt: canceled at 47 of 1050 tests after two failures in the staging-backed integration block; cancellation did not produce a result bundle.

@ovitrif
ovitrif requested a review from ben-kaufman September 2, 2026 00:17
@greptile-apps

greptile-apps Bot commented Sep 2, 2026

Copy link
Copy Markdown

Greptile Summary

The PR adds privacy-safe diagnostics and terminal feedback for incoming payment-request failures while retaining automatic retries.

  • Classifies parsing, endpoint-resolution, and payment-target failures with stable reason codes.
  • Preserves requested expiration state across resolution, refresh, and retry backoff.
  • Ends explicit presentation retries with unavailable feedback while leaving requests actionable.
  • Adds focused tests, simulator journey identifiers, and failure-contract documentation.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains; current code distinguishes requested expiration from retry exhaustion, records the expiration before clearing presentation state, and maps it to the localized expired feedback.

Important Files Changed

Filename Overview
Bitkit/Services/PaykitPaymentRequestService.swift Adds stable parse diagnostics and explicit presentation-deferral outcomes, including queued expiration handling that resolves the previously reported expiry misclassification.
Bitkit/AppScene.swift Maps presentation outcomes to redacted diagnostics and localized terminal feedback, consuming requested expirations separately from retry exhaustion.
Bitkit/Services/PrivatePaykitService+Payments.swift Classifies private payment-request resolution failures without exposing request contents or raw errors.
Bitkit/Services/PublicPaykitService.swift Adds stable failure reasons for endpoint-resolution and payment-target failures.
BitkitTests/PaykitPaymentRequestServiceTests.swift Covers retry exhaustion and expiration during suspended resolution and retry backoff.
BitkitTests/PublicPaykitServiceTests.swift Verifies failure-reason and presentation-feedback mappings.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Incoming payment request] --> B{Request valid and unexpired?}
    B -->|No: expired explicit request| C[Record expiration]
    C --> D[Show expired toast once]
    B -->|Yes| E[Resolve payment target]
    E -->|Success| F[Open send flow]
    E -->|Failure| G{Explicit retry limit reached?}
    G -->|No| H[Schedule retry]
    H --> E
    G -->|Yes| I[Show unavailable toast]
    I --> J[Keep request actionable]
Loading

Reviews (3): Last reviewed commit: "fix: preserve requested expiry feedback ..." | Re-trigger Greptile

Comment thread Bitkit/Services/PaykitPaymentRequestService.swift
@ovitrif
ovitrif marked this pull request as draft September 2, 2026 09:49
@ovitrif
ovitrif marked this pull request as ready for review September 2, 2026 10:06
@ovitrif
ovitrif force-pushed the codex/714-payment-request-errors branch from 70cd263 to ac81ad1 Compare September 2, 2026 12:05
@ovitrif

ovitrif commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator Author

@greptileai

@ovitrif ovitrif left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rewritten head preserves the earlier expiry fix. I found two non-blocking coverage and journey-documentation gaps.

Comment thread Bitkit/AppScene.swift Outdated
Comment thread journeys/payment-requests/README.md
Comment thread Bitkit/AppScene.swift Outdated
@ovitrif
ovitrif force-pushed the codex/714-payment-request-errors branch from ac81ad1 to 8172d6d Compare September 2, 2026 21:43
@ovitrif
ovitrif requested a review from ben-kaufman September 2, 2026 21:44
Comment thread Bitkit/AppScene.swift
@ovitrif ovitrif changed the title fix: expose payment request failures fix: expose rejected incoming payment requests Sep 3, 2026
@ovitrif
ovitrif force-pushed the codex/714-payment-request-errors branch from 8172d6d to 1f75bfd Compare September 3, 2026 21:50
@ovitrif
ovitrif requested a review from ben-kaufman September 3, 2026 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: expose rejected incoming payment requests

2 participants