feat(onramp): adding onramp buy options endpoint #499
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adds the new endpoint for getting buy options for the onramp payments from the CB payment options endpoint.
/v1/onramp/buy/options
GET parameters:projectId
- project IDcountry
- ISO 3166-1 two-digit country code string representing the purchasing user’s country of residence, e.g., US.subdivision
(optional) - ISO 3166-2 two-digit country subdivision code representing the purchasing user’s subdivision of residence within their country, e.g. NY. Required if the country=“US” because certain states (e.g., NY) have state specific asset restrictions.The new endpoint response object contains the following fields:
paymentCurrencies
- List of supported fiat currencies that can be exchanged for crypto on CBPay in the given location. Each currency contains a list of available payment methods, withmin
andmax
transaction limits for that currencyid
.purchaseCurrencies
- List of available crypto assets that can be bought on CBPay in the given location.Context of this requirement: https://walletconnect.slack.com/archives/C03SCF66K2T/p1706780083868789?thread_ts=1706744422.369399&cid=C03SCF66K2T
How Has This Been Tested?
New integration test included with this PR.
Manual.
cargo run
.curl -v 'http://localhost:3000/v1/onramp/buy/options?projectId=xxx&country=US' | jq .
Due Diligence