Add Razorpay gateway support in payment gateway#137
Add Razorpay gateway support in payment gateway#137damianlegawiec merged 1 commit intospree:mainfrom
Conversation
|
@umeshravani is attempting to deploy a commit to the Spree Commerce Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughA new gateway identifier mapping was added to the payment gateway registry, enabling the Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/lib/utils/payment-gateway.ts (1)
18-31: Usesatisfiesfor the gateway map object literal.The GATEWAY_TYPE_MAP contains only non-"unknown" gateway values; switching to
satisfies Record<string, Exclude<GatewayId, "unknown">>enforces this stricter typing while allowing literal type inference. This aligns with the TypeScript guideline to usesatisfiesfor object literals and provides better type safety.♻️ Proposed refactor
-const GATEWAY_TYPE_MAP: Record<string, GatewayId> = { +const GATEWAY_TYPE_MAP = { // Stripe (spree_stripe gem) "SpreeStripe::Gateway": "stripe", "Spree::Gateway::StripeGateway": "stripe", // Adyen (spree_adyen gem) "SpreeAdyen::Gateway": "adyen", "Spree::Gateway::AdyenGateway": "adyen", // PayPal (spree_paypal_checkout gem) "SpreePaypalCheckout::Gateway": "paypal", "Spree::Gateway::PayPalExpress": "paypal", // Razorpay (spree_razorpay_checkout gem) "SpreeRazorpayCheckout::Gateway": "razorpay", "Spree::Gateway::RazorpayGateway": "razorpay", -}; +} satisfies Record<string, Exclude<GatewayId, "unknown">>;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/lib/utils/payment-gateway.ts` around lines 18 - 31, The GATEWAY_TYPE_MAP object is currently typed as Record<string, GatewayId> but should be constrained to exclude "unknown"; change its annotation to use TypeScript's satisfies operator with Record<string, Exclude<GatewayId, "unknown">> so the literal keys infer narrow gateway values while still ensuring no "unknown" can be assigned — update the GATEWAY_TYPE_MAP declaration (symbol: GATEWAY_TYPE_MAP) to use "satisfies Record<string, Exclude<GatewayId, 'unknown'>>" and leave the object literal as-is to preserve inference.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/lib/utils/payment-gateway.ts`:
- Around line 18-31: The GATEWAY_TYPE_MAP object is currently typed as
Record<string, GatewayId> but should be constrained to exclude "unknown"; change
its annotation to use TypeScript's satisfies operator with Record<string,
Exclude<GatewayId, "unknown">> so the literal keys infer narrow gateway values
while still ensuring no "unknown" can be assigned — update the GATEWAY_TYPE_MAP
declaration (symbol: GATEWAY_TYPE_MAP) to use "satisfies Record<string,
Exclude<GatewayId, 'unknown'>>" and leave the object literal as-is to preserve
inference.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 0876eb58-b3f8-416d-b58b-00ebb57f4f69
📒 Files selected for processing (1)
src/lib/utils/payment-gateway.ts
Summary by CodeRabbit