You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(deposit): implement user limits fetch before proceeding with an order (#21174)
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->
## **Description**
<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->
Implement user deposit limits validation (daily/monthly/yearly) in the
authenticated deposit flow.
Checks limits after KYC approval using the user's actual KYC type, and
displays clear error messages when deposit amount including fees would
exceed remaining limits.
## **Changelog**
<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`
If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`
(This helps the Release Engineer do their job more quickly and
accurately)
-->
CHANGELOG entry: Added Deposit limits
## **Related issues**
Fixes:
https://consensyssoftware.atlassian.net/browse/TRAM-2669?atlOrigin=eyJpIjoiNWVhOWFiMzA1Yzg4NDAxY2IzZjBkZWMzYThjMzRhZDYiLCJwIjoiaiJ9
## **Manual testing steps**
```gherkin
Feature: Deposit Limits Validation
Scenario: User exceeds daily/monthly/yearly deposit limit
Given user is authenticated and KYC approved
And user has $100 daily/monthly/yearly limit remaining
And user has selected USD as currency
When user enters $200 deposit amount
And user clicks Continue
Then error message should display "This deposit would exceed your daily/monthly/yearly limit. Your deposit including fees must be $100 USD or less."
And user should remain on build quote screen
Scenario: User successfully deposits within daily limit
Given user is authenticated and KYC approved
And user has $300 daily limit remaining
And user has selected USD as currency
When user enters $100 deposit amount
And user clicks Continue
Then deposit should proceed to payment screen
And no error message should be displayed
```
## **Screenshots/Recordings**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
<!-- [screenshots/recordings] -->
No limits check.
### **After**
<!-- [screenshots/recordings] -->
<img width="301" height="655" alt="Simulator Screenshot - iPhone 16 Pro
- 2025-10-15 at 15 03 28"
src="https://github.com/user-attachments/assets/3070cf38-8a01-48ae-8d7b-e9f121b20c46"
/>
<img width="301" height="655" alt="Simulator Screenshot - iPhone 16 Pro
- 2025-10-15 at 14 54 53"
src="https://github.com/user-attachments/assets/88c33ae1-714d-444d-b0c7-0dbb22bc6059"
/>
## **Pre-merge author checklist**
- [x] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
## **Pre-merge reviewer checklist**
- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Integrates `getUserLimits` into the authenticated deposit flow to
block deposits exceeding daily/monthly/yearly limits, with new i18n
messages and tests; bumps native ramps SDK.
>
> - **Deposit flow**:
> - Add `getUserLimits` via `useDepositSdkMethod` and new
`checkUserLimits(quote, kycType)` to enforce daily/monthly/yearly
remaining limits before creating orders or generating payment URLs.
> - Pass actual KYC type to limits check; use region currency in
messages.
> - **UX/i18n**:
> - Add strings `deposit.buildQuote.limitExceeded` and
`deposit.buildQuote.limitError` for clear limit errors.
> - **Tests**:
> - Extend `useDepositRouting.test.ts` with cases for within-limits,
daily/monthly/yearly exceed, null/undefined limits, and correct KYC type
propagation.
> - **Dependencies**:
> - Bump `@consensys/native-ramps-sdk` to `2.1.5`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
e56b064. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
0 commit comments