Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 4f96f53. Configure here.
| lastSurchargeTotalRef.current = surchargeTotal; | ||
|
|
||
| return; | ||
| } |
There was a problem hiding this comment.
Reload skipped on cart changes
High Severity
handleCartTotalChange skips loadPaymentMethods whenever the summed corporate_card_surcharge fee amount differs from the last seen value. That also happens when coupons, shipping, or other cart updates change the surcharge while the total moves, so payment methods may not reload and hosted card flows can keep a stale payable amount.
Reviewed by Cursor Bugbot for commit 4f96f53. Configure here.


What/Why?
Displays the card surcharge as a dedicated line in the order summary, and prevents the payment step from re-initialising the hosted (iframe) card fields when the surcharge changes the total - so the shopper's entered card is not cleared.
Order summary (OrderSummarySubtotals.tsx + coupon/NewOrderSummarySubtotals.tsx): render a dedicated "Surcharge" row (from Checkout.fees, detected by name 'corporate_card_surcharge'), alongside shipping/handling; other fees keep the existing generic loop.
Payment.tsx: handleCartTotalChange now receives checkout state and skips loadPaymentMethods when the total change is caused by the surcharge fee. This avoids re-initialising the Adyen/Bluesnap hosted fields (which would wipe the card). A real cart change (coupon/shipping) still reloads as before.
Locale: cart.surcharge_text ("Surcharge").
Rollout/Rollback
This is just POC, do not merge
Testing
video_1280.mp4
Note
Medium Risk
Payment-step behavior on total changes is security- and conversion-sensitive; skipping payment-method reload when only surcharge fees change could miss updates if totals shift for other reasons at the same time, though the POC is gated on backend fees not yet shipped.
Overview
POC for corporate card surcharging (Adyen/Bluesnap): surfaces the fee in the cart and stops payment from tearing down hosted card iframes when only the surcharge total moves.
Order summary components (
OrderSummarySubtotals,NewOrderSummarySubtotals) now pull the fee namedcorporate_card_surchargeout ofCheckout.feesand render a dedicated Surcharge row (cart.surcharge_text); remaining fees still use the generic fee loop. Comments note the row stays hidden until the backend Fees API supplies that fee and includes it inoutstandingBalance(withRedeemabledocuments the same assumption).On Payment,
handleCartTotalChangereceives checkout state from the grand-total subscription. If the aggregate surcharge fee amount changed, it updates a ref and skipsloadPaymentMethodsso Adyen/Bluesnap hosted fields are not re-initialized and the shopper’s card entry is preserved. Coupon/shipping-driven total changes still reload payment methods as before.Reviewed by Cursor Bugbot for commit 4f96f53. Bugbot is set up for automated code reviews on this repo. Configure here.