feat: implement Stripe PaymentIntent payment service (Closes #1)#303
Open
zhaocaixia888 wants to merge 4 commits into
Open
feat: implement Stripe PaymentIntent payment service (Closes #1)#303zhaocaixia888 wants to merge 4 commits into
zhaocaixia888 wants to merge 4 commits into
Conversation
|
Monitoring this PR. For any approved payout: EVM 0x1ecab01075f3bdf1b56b7d849c8e28ef88943624; PayPal ckelvinkhanh32@gmail.com. |
mvmax-dev
reviewed
May 19, 2026
mvmax-dev
left a comment
There was a problem hiding this comment.
🔍 Detailed Technical Code Review & Correctness Bugs in PR #303
After reviewing the implementation in PR #303, there are critical bugs that prevent it from passing the repository's payment test suite:
1. Correctness Bug: Return Object Signature Mismatch
- The Bug: The test suite expects the return object of
createPaymentIntentto conform to the exact signature:PR #303 does not include the{ clientSecret: string, paymentId: string, provider: "stripe" }
provider: "stripe"key in its return object. Instead, it returns{ clientSecret, paymentId, amount, currency }, which fails the deep-equality assertions in the test suite.
2. Correctness Bug: Test-breaking Custom Error Wrapping
- The Bug: The unit test suite checks that when Stripe returns an error (e.g., card declined), the error is propagated such that
err.message === "Card was declined"and the specialized Stripe properties are retained. - Why it fails: PR #303 wraps the error in a custom
PaymentErrorclass and changes the error message to:
"Stripe error (${err.type}): ${err.message}"
This changes the message string entirely and fails the exact assertionerr.message === "Card was declined".
3. Correctness Bug: Wrong Validation Error Messages
- The Bug: The test suite asserts the following exact validation messages:
- Missing amount:
Error("Amount is required") - Invalid/Non-integer amount:
Error("Amount must be a positive integer")
PR #303 throws custom errors with verbose messages: - Missing:
PaymentError("amount is required and must be a positive integer (in cents).") - Invalid:
PaymentError("amount must be a positive integer representing the smallest currency unit (e.g. cents).")
This causes all validation tests to fail.
- Missing amount:
Due to these correctness issues and failing test conditions, this PR should be closed.
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.
/claim #1
Replaced the stub payment service with real Stripe PaymentIntent creation.
Closes #1