Skip to content

fix: reject payment when recipient trusts wrong issuer - #149

Merged
udoyechinenyevictoria merged 3 commits into
Esureorg:mainfrom
Raydev-tech:feat/issue-106-scenarios-reject-a-payment-when-the-recipient
Oct 23, 2026
Merged

udoyechinenyevictoria merged 3 commits into
Esureorg:mainfrom
Raydev-tech:feat/issue-106-scenarios-reject-a-payment-when-the-recipient

Conversation

@Raydev-tech

Copy link
Copy Markdown
Contributor

Overview

This PR makes issued-asset payment scenarios issuer-aware. Previously a payment could appear valid because the asset code matched, even when the recipient's trustline belonged to a different issuer. The scenario now defines two same-code assets with distinct issuers, pays using the untrusted issuer, and asserts the precise missing-trustline failure for that issuer while confirming the existing trustline and its balance are untouched.

Related Issue

Changes

🔍 Issuer-Aware Scenario Validation

  • [MODIFY] esure-backend/src/stellar-gateway.ts

    • Resolve and carry issuer references per asset so same-code assets are not conflated.
    • Surface the actual issuer on payment failures instead of matching on asset code alone.
  • [MODIFY] esure-backend/src/stellar-error-interpreter.ts

    • Interpret missing-trustline failures against the specific issuer, so a code-only match does not mask the error.
  • [MODIFY] esure-backend/src/scenario-schema.ts

    • Validate that the two asset definitions carry distinct issuer references and that the payment targets the untrusted issuer.

📄 Scenario Definitions

  • [MODIFY] esure-backend/scenarios/issued-asset-payment.json

    • Two same-code issued assets with distinct issuer references; recipient trustline only to the first.
  • [MODIFY] esure-backend/scenarios/missing-trustline.yaml

    • Payment uses the second (untrusted) issuer and expects the precise missing-trustline failure for that issuer.
    • Asserts the existing trustline remains present with an unchanged balance.
    • Description explains the issuer identity mismatch.

📚 Docs & Tests

  • [MODIFY] esure-docs/SCENARIOS.md

    • Document the issuer identity mismatch case and the expected failure.
  • [MODIFY] esure-backend/test/scenario-schema.test.ts

    • Regression coverage for distinct issuer references and issuer-aware failure matching.

Verification Results

cd esure-backend
npm run check
npm run build
Acceptance Criteria Status
The two asset definitions have distinct issuer references ✅ Enforced in scenario schema and covered by tests
The payment expects the precise missing-trustline failure for the actual issuer ✅ Error interpreter matches on issuer, not code alone
Assert the existing trustline remains present and its balance unchanged ✅ Asserted in missing-trustline.yaml
Explain the issuer identity mismatch in the scenario description ✅ Added to scenario description and SCENARIOS.md

Closes #106

@drips-wave

drips-wave Bot commented Oct 19, 2026

Copy link
Copy Markdown

@Raydev-tech 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

@vercel

vercel Bot commented Oct 19, 2026

Copy link
Copy Markdown

@Raydev-tech is attempting to deploy a commit to the Favour Chigozirim's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Raydev-tech
Raydev-tech force-pushed the feat/issue-106-scenarios-reject-a-payment-when-the-recipient branch from 09f0902 to 3c0d0f5 Compare October 22, 2026 01:37
@udoyechinenyevictoria
udoyechinenyevictoria merged commit 084c2b3 into Esureorg:main Oct 23, 2026
1 check failed
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.

Scenarios: reject a payment when the recipient trusts the wrong issuer

2 participants