Skip to content

✨ server: show friendly decline reasons#1141

Draft
aguxez wants to merge 2 commits into
mainfrom
notifications
Draft

✨ server: show friendly decline reasons#1141
aguxez wants to merge 2 commits into
mainfrom
notifications

Conversation

@aguxez

@aguxez aguxez commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features
    • Added friendlier, more specific decline messages across additional card/payment failure cases (including merchant not accepted, canceled/inactive cards, invalid PIN, and too many PIN attempts).
    • Expanded localized decline-related translations in Spanish and Portuguese.
  • Bug Fixes
    • Improved declined transaction reason handling to consistently show normalized, user-friendly reason text and aligned push-notification messaging.
    • Reduced duplicate decline notifications by only sending alerts when a newly recorded declined transaction is created.

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: bcabc9ad-78a9-41c4-84f3-c8d21e7235e3

📥 Commits

Reviewing files that changed from the base of the PR and between 1c53e77 and 5e2e44a.

📒 Files selected for processing (9)
  • .changeset/calm-wolves-translate.md
  • .changeset/tall-geese-share.md
  • cspell.json
  • server/hooks/panda.ts
  • server/i18n/es.json
  • server/i18n/pt.json
  • server/test/hooks/panda.test.ts
  • src/i18n/es.json
  • src/i18n/pt.json

Walkthrough

This PR expands Panda decline-reason handling with normalized friendly mappings, merchant fallback behavior, conditional notifications, localized server and client translations, parameterized tests, and patch changesets for the affected packages.

Changes

Friendly Decline Reasons

Layer / File(s) Summary
Decline reason mapping and notification trigger
server/hooks/panda.ts
Normalizes decline inputs, adds expanded mappings and an mcc fallback, and sends notifications only for new records with a mapped reason.
Server-side decline reason tests
server/test/hooks/panda.test.ts
Covers normalized stored reasons, push-notification translation keys, existing transaction expectations, and randomized transaction IDs.
Decline reason translations
server/i18n/*.json, src/i18n/*.json
Adds Spanish and Portuguese translations for card, PIN, merchant, and transaction decline states.
Package release metadata
.changeset/*.md
Adds patch changesets for @exactly/server and @exactly/mobile.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PandaWebhook
  participant Reject
  participant TransactionStore
  participant DeclinedNotification
  PandaWebhook->>Reject: declineReason
  Reject->>Reject: normalize and resolve reason
  Reject->>TransactionStore: upsert declined transaction
  TransactionStore-->>Reject: isNew
  Reject->>DeclinedNotification: send mapped push reason when eligible
Loading

Possibly related PRs

  • exactly/exa#622: Modifies related Panda card-decline handling, notification logic, and tests.

Suggested reviewers: nfmelendez, cruzdanilo

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: server-side friendly decline reason handling and messaging.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch notifications
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch notifications

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request expands the transaction decline reasons in the Panda webhook hook, normalizing the reasons to lowercase and introducing a pushReason property for customized push notifications. It also adds corresponding translations in Spanish and Portuguese, along with comprehensive test coverage. The review feedback suggests sorting the newly added translation keys alphabetically across all modified translation files to maintain consistency and avoid future merge conflicts.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread server/i18n/es.json Outdated
Comment thread server/i18n/pt.json Outdated
Comment thread src/i18n/es.json
Comment thread src/i18n/pt.json
Comment thread src/i18n/es.json
Comment thread src/i18n/pt.json
Comment thread src/i18n/es.json
Comment thread src/i18n/pt.json

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 6291fb3f-2f5c-4a79-a30a-64e1f0121a1c

📥 Commits

Reviewing files that changed from the base of the PR and between f0f3659 and f8e112c.

📒 Files selected for processing (7)
  • .changeset/tall-geese-share.md
  • server/hooks/panda.ts
  • server/i18n/es.json
  • server/i18n/pt.json
  • server/test/hooks/panda.test.ts
  • src/i18n/es.json
  • src/i18n/pt.json

Comment thread server/hooks/panda.ts Outdated
Comment thread server/test/hooks/panda.test.ts
@changeset-bot

changeset-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5e2e44a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@exactly/mobile Patch
@exactly/server Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

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.

1 participant