Repository navigation
fix: handle crash and error message for buy dash above withdrawal limit - #902
HashEngineering merged 5 commits into
Conversation
- display appropriate error message for input amount greater than withdrawal limit - handle crash caused by ArithmeticException after user input amount to be sent
…input amount greater than withdrawal limit - reproduce implementation for Convert-Crypto flow
- remove unused test files from explore-dash module plus duplicate CoinBaseRepositoryTest.kt
…to bugfix-coinbase-error-handling
| _transactionCompleted.value = TransactionState(true, null) | ||
| } | ||
| else -> _transactionCompleted.value = false | ||
| 400 -> { |
There was a problem hiding this comment.
For Coinbase's 40x responses, it appears the safeApiCall()sometimes sends ResponseResource of type Success, with an appropriate error body (if any) which is mainly why we couldn't see the api error message sent by coinbase
| _transactionCompleted.value = TransactionState(true, null) | ||
| } | ||
| else -> _transactionCompleted.value = false | ||
| 400 -> { |
There was a problem hiding this comment.
We needed to replicate this behavior for the Buy Swap flow since the end result expected its the same when transferring dash to wallet
Syn-McJ
left a comment
There was a problem hiding this comment.
Looks good. I have left a comment on return types to consider.
| suspend fun placeBuyOrder(placeBuyOrderParams: PlaceBuyOrderParams): ResponseResource<PlaceBuyOrderUIModel> | ||
| suspend fun commitBuyOrder(buyOrderId: String): ResponseResource<CommitBuyOrderUIModel> | ||
| suspend fun sendFundsToWallet(sendTransactionToWalletParams: SendTransactionToWalletParams): ResponseResource<Int> | ||
| suspend fun sendFundsToWallet(sendTransactionToWalletParams: SendTransactionToWalletParams): ResponseResource<Response<SendTransactionToWalletResponse?>> |
There was a problem hiding this comment.
The response type of this method seems somewhat convoluted. There are 3 nested "Responses" of some kind.
When you have a suspend method, there isn't really a reason to use a class like ResponseResource in my opinion. The exception is propagated, so you have response/error functionality already, just need to try/catch it. Loading object isn't used in Coinbase right now, and the loading state can be implemented in other ways.
Issue being fixed or feature implemented
This is an improvement for NMA-1165
Besides the crash found during testing, there has been an update in the AC: we need to provide the exact error message the Coinbase API sends in case the dash purchased could not be successfully sent to a wallet. Here is an example of the error message :
Cannot send this amount without going over application limit (limit 5.00 USD, 0.19 USD remaining)Related PR's and Dependencies
Screenshots / Videos
How Has This Been Tested?
Checklist: