Issue:
fix(payments_list): handle same payment/attempt IDs for different merchants

The query planner was applying the merchant_id filter before the join operation, which caused incorrect results when different merchants had the same payment_id or attempt_id. This prematurely filtered out valid rows from the payment_attempt table that had matching payment_id or attempt_id but a different merchant_id.

Resolution:
<think>
PR Context:
- Title: fix(payments_list): handle same payment/attempt ids for different merchants
- Merged: 2024-12-24T13:29:37Z
- Files changed: 1 files
- Commits: 4 commits

Implementation approach:
## Type of Change
<!-- Put an `x` in the boxes that apply -->

- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD

## Description
Changed the query to apply the merchant_id filter after the join. This ensures valid rows aren’t excluded too early and fixes an issue where **payments with the same IDs but different merchants** were being handled incorrectly.

### Additional Changes

- [ ] This PR modifies the A
</think>

To implement this, you'll need to modify:


**Detailed Implementation:**


**Commit 1:** fix(payments_list): handle same payment/attempt ids for different merchants (#6917)
Files to modify:


**crates/storage_impl/src/payments/payment_intent.rs**
  Modify existing code