feat: Add errorCode field to TransakService#8153
Open
imyugioh wants to merge 1 commit intoMetaMask:mainfrom
Open
feat: Add errorCode field to TransakService#8153imyugioh wants to merge 1 commit intoMetaMask:mainfrom
imyugioh wants to merge 1 commit intoMetaMask:mainfrom
Conversation
54c4d9a to
e093f3d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Explanation
This PR adds
errorCodesupport to theTransakDepositOrdertype in@metamask/ramps-controller, enabling Transak error codes to flow through to analytics events.Current state:
TransakDepositOrderhasstatusDescriptionfor failed order messages but no structured error code field.RAMPS_TRANSACTION_FAILEDSegment event logserror_messagebut has no way to distinguish specific failure reasons (e.g., KYC incomplete, duplicate order, fraud detection).errorCodein API error responses (e.g.,4002for KYC required,4005for duplicate order).What changed:
errorCode?: stringtoTransakDepositOrdertype inTransakService.ts.getOrder()method already spreads the full API response into the return object, soerrorCodepasses through automatically when present.errorCodeis passed through when present andundefinedwhen absent.Why this matters:
metamask-mobileto includeerror_codein theRAMPS_TRANSACTION_FAILEDanalytics event.References
Ref: TRAM-3267
Checklist
Note
Low Risk
Low risk type-surface change that only adds an optional field and test coverage; runtime behavior is unchanged aside from allowing the API-provided
errorCodeto be returned to callers.Overview
Adds
errorCodesupport to deposit orders returned byTransakService.TransakDepositOrdernow includes optionalerrorCode?: string, allowing the orders API response field to pass through to consumers.Extends
getOrderunit coverage to asserterrorCodeis preserved when present andundefinedwhen absent.Written by Cursor Bugbot for commit e093f3d. This will update automatically on new commits. Configure here.