Skip to content

✨ app: display activity entry for declined card purchases#1046

Open
dieguezguille wants to merge 3 commits into
fixesfrom
declined
Open

✨ app: display activity entry for declined card purchases#1046
dieguezguille wants to merge 3 commits into
fixesfrom
declined

Conversation

@dieguezguille
Copy link
Copy Markdown
Member

@dieguezguille dieguezguille commented May 26, 2026

closes #636

Summary by CodeRabbit

  • New Features

    • Added a detailed “Declined” activity view with localized decline reason, merchant location, and copyable operation ID with success confirmation.
    • Country names in activity screens are now localized; declined amounts show strike-through and neutral color.
  • Bug Fixes / Behavior Changes

    • Declined activities are now returned and shown in lists; declined items are excluded from processing totals and weekly purchase counts.
    • Clipboard toasts/alerts now appear only after the copy succeeds.

Review Change Stack

@dieguezguille dieguezguille self-assigned this May 26, 2026
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 26, 2026

🦋 Changeset detected

Latest commit: 2096113

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

This PR includes changesets to release 1 package
Name Type
@exactly/mobile 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

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 26, 2026

Warning

Review limit reached

@dieguezguille, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 46 minutes and 44 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 308e149d-345e-4441-9d0d-958ca98a3116

📥 Commits

Reviewing files that changed from the base of the PR and between 35563cc and 2096113.

📒 Files selected for processing (19)
  • .changeset/cuddly-beds-stick.md
  • .changeset/goofy-candles-move.md
  • .changeset/warm-words-eat.md
  • src/components/activity/ActivityItem.tsx
  • src/components/activity/details/ActivityDetails.tsx
  • src/components/activity/details/DeclinedActivity.tsx
  • src/components/activity/details/OperationDetails.tsx
  • src/components/activity/details/PurchaseDetails.tsx
  • src/components/activity/details/TransactionDetails.tsx
  • src/components/add-funds/AddCrypto.tsx
  • src/components/card/Card.tsx
  • src/components/card/CardDetails.tsx
  • src/components/send-funds/Contact.tsx
  • src/components/settings/Settings.tsx
  • src/components/shared/ProfileHeader.tsx
  • src/i18n/es.json
  • src/i18n/pt.json
  • src/utils/isProcessing.ts
  • src/utils/server.ts

Walkthrough

Server now surfaces declined activity items. The activity list marks declined panda purchases (struck-through amount, adjusted processing logic). Declined items route to a new DeclinedActivity detail view that shows reason, amount, copyable transaction ID, and timestamp. Spanish/Portuguese translations and changesets added.

Changes

Declined Card Activity Display

Layer / File(s) Summary
API: Enable declined activity items in getActivity
src/utils/server.ts
getActivity no longer filters out activity items with "declined" status; declined items are returned to the client.
Activity list: locale registration, declined flag, and styling
src/components/activity/ActivityItem.tsx
Register en/es/pt locales statically, introduce declined boolean for panda items, require !declined for processing, render explicit declined/refund/processing caption branches, and apply strikethrough + neutral color to declined amounts.
Activity detail: Route declined items to DeclinedActivity component
src/components/activity/details/ActivityDetails.tsx
Import and render DeclinedActivity when panda item.status === "declined", otherwise render CardActivity.
DeclinedActivity detail component
src/components/activity/details/DeclinedActivity.tsx
New component displays failed label, merchant branding/location, localized USD amount, error callout with item.reason (or fallback), and purchase details including shortened transaction ID with copy-to-clipboard and formatted date/time.
Balance/totals: exclude declined from weekly and processing
src/components/card/Card.tsx, src/utils/isProcessing.ts
Exclude declined "panda" purchases from weekly totals and from selectBalance processing inclusion.
Clipboard copy: show success only after promise resolves
src/components/*
Refactor multiple copy-to-clipboard handlers (OperationDetails, PurchaseDetails, TransactionDetails, AddCrypto, CardDetails, Contact, Settings, ProfileHeader) to show success alerts/toasts only after setStringAsync resolves and route failures to reportError.
Internationalization: Decline reasons and error messages
src/i18n/es.json, src/i18n/pt.json
Add Spanish and Portuguese keys: frozen card, insufficient funds, merchant blocked, Payment failed, parameterized processing error with {{reason}}, transaction declined, and webhook declined.
Release metadata: Changesets for patch bumps
.changeset/*.md
Adds multiple Changeset entries documenting patch version bumps for @exactly/mobile and notes including declined activity and copy-toast fix.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • exactly/exa#1022: Both PRs modify src/utils/server.ts’s getActivity handling of "declined" items (main PR stops filtering them out, while PR #1022 adds filtering to exclude them).
  • exactly/exa#622: The main PR makes the app consume and display declined activities (adds DeclinedActivity and removes client-side filtering of status === "declined"), which directly aligns with the retrieved PR’s server-side work to generate/persist declined activity records and include decline reason data for notifications.

Suggested reviewers

  • franm91
  • cruzdanilo
🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning Multiple clipboard-copy promise chaining changes appear out of scope; they affect unrelated components (AddCrypto, CardDetails, Contact, etc.) and are not directly tied to displaying declined card activity. Move clipboard copy promise refactoring changes to a separate PR focused on that improvement to maintain PR scope clarity.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly summarizes the main change: adding display of activity entries for declined card purchases, which aligns with the primary objectives of the changeset.
Linked Issues check ✅ Passed The PR implements the core requirement from #636 by adding activity display for declined card purchases through new DeclinedActivity component, status tracking, and UI updates.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch declined
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch declined

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 and usage tips.

Copy link
Copy Markdown

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

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 implements the display of activity entries for declined card purchases. It updates the activity list item to visually indicate declined transactions, introduces a new DeclinedActivity component to show detailed failure reasons, adds corresponding localization strings, and stops filtering out declined transactions from the server response. The reviewer identified a critical runtime issue in DeclinedActivity.tsx where item.timestamp (which is a string at runtime) is passed directly to the date-fns format function, which will throw a RangeError. Wrapping item.timestamp in new Date() is recommended for both the date and time formatting fields.

Comment thread src/components/activity/details/DeclinedActivity.tsx
Comment thread src/components/activity/details/DeclinedActivity.tsx
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4722552f38

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/utils/server.ts
@sentry
Copy link
Copy Markdown

sentry Bot commented May 26, 2026

Codecov Report

❌ Patch coverage is 37.50000% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.47%. Comparing base (ecc36c0) to head (2096113).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/components/activity/ActivityItem.tsx 60.00% 6 Missing ⚠️
src/components/card/CardDetails.tsx 0.00% 3 Missing ⚠️
src/components/send-funds/Contact.tsx 0.00% 3 Missing ⚠️
src/components/settings/Settings.tsx 0.00% 3 Missing ⚠️
src/components/shared/ProfileHeader.tsx 0.00% 3 Missing ⚠️
src/components/card/Card.tsx 0.00% 1 Missing ⚠️
src/utils/isProcessing.ts 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            fixes    #1046      +/-   ##
==========================================
- Coverage   73.48%   73.47%   -0.02%     
==========================================
  Files         243      243              
  Lines       10627    10638      +11     
  Branches     3555     3560       +5     
==========================================
+ Hits         7809     7816       +7     
- Misses       2505     2508       +3     
- Partials      313      314       +1     
Flag Coverage Δ
e2e 72.29% <37.50%> (-1.19%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: c61d193c-0392-417a-9e62-5dcbf6fbaaac

📥 Commits

Reviewing files that changed from the base of the PR and between 4722552 and 1dd7181.

📒 Files selected for processing (9)
  • .changeset/warm-words-eat.md
  • src/components/activity/ActivityItem.tsx
  • src/components/activity/details/ActivityDetails.tsx
  • src/components/activity/details/DeclinedActivity.tsx
  • src/components/card/Card.tsx
  • src/i18n/es.json
  • src/i18n/pt.json
  • src/utils/isProcessing.ts
  • src/utils/server.ts

Comment thread src/components/activity/details/DeclinedActivity.tsx Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7ec29eccfb

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/utils/server.ts
t,
i18n: { language },
} = useTranslation();
const amount = `$${Math.abs(item.usdAmount).toLocaleString(language, { style: "decimal", minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Display the declined authorization amount

When Panda sends a pending created authorization and later appends a declined created event for the same transaction, the stored payload contains both bodies (see server/test/hooks/panda.test.ts's merge case), and PandaActivity currently sums every non-requested operation into item.usdAmount in server/api/activity.ts. This new declined screen displays that aggregate directly, so those common declined purchases can show double the attempted amount; use the declined operation/details amount instead of the aggregate before rendering it.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

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: 96f9703d-42a0-43a4-bf26-950773789ca4

📥 Commits

Reviewing files that changed from the base of the PR and between 7ec29ec and 35563cc.

📒 Files selected for processing (19)
  • .changeset/cuddly-beds-stick.md
  • .changeset/goofy-candles-move.md
  • .changeset/warm-words-eat.md
  • src/components/activity/ActivityItem.tsx
  • src/components/activity/details/ActivityDetails.tsx
  • src/components/activity/details/DeclinedActivity.tsx
  • src/components/activity/details/OperationDetails.tsx
  • src/components/activity/details/PurchaseDetails.tsx
  • src/components/activity/details/TransactionDetails.tsx
  • src/components/add-funds/AddCrypto.tsx
  • src/components/card/Card.tsx
  • src/components/card/CardDetails.tsx
  • src/components/send-funds/Contact.tsx
  • src/components/settings/Settings.tsx
  • src/components/shared/ProfileHeader.tsx
  • src/i18n/es.json
  • src/i18n/pt.json
  • src/utils/isProcessing.ts
  • src/utils/server.ts

Comment thread src/i18n/es.json
Comment thread src/i18n/pt.json
@dieguezguille dieguezguille changed the base branch from main to fixes May 29, 2026 13:27
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.

app: activity for card purchase rejected/declined

1 participant