Skip to content

feat(payment): PI-5431 [SPIKE] [FE] Surcharging (Bluesnap, Adyen) - PoC [do not merge] - #3156

Draft
bc-ania wants to merge 1 commit into
masterfrom
PI-5431
Draft

feat(payment): PI-5431 [SPIKE] [FE] Surcharging (Bluesnap, Adyen) - PoC [do not merge]#3156
bc-ania wants to merge 1 commit into
masterfrom
PI-5431

Conversation

@bc-ania

@bc-ania bc-ania commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

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 named corporate_card_surcharge out of Checkout.fees and 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 in outstandingBalance (withRedeemable documents the same assumption).

On Payment, handleCartTotalChange receives checkout state from the grand-total subscription. If the aggregate surcharge fee amount changed, it updates a ref and skips loadPaymentMethods so 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.

@bc-ania
bc-ania marked this pull request as ready for review July 14, 2026 12:35
@bc-ania
bc-ania requested a review from a team as a code owner July 14, 2026 12:35
@bc-ania bc-ania changed the title feat(payment): PI-5431 [SPIKE] [FE] Surcharging (Bluesnap, Adyen) - do not merge feat(payment): PI-5431 [SPIKE] [FE] Surcharging (Bluesnap, Adyen) - PoC [do not merge] Jul 14, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 4f96f53. Configure here.

@bc-wpietrzak
bc-wpietrzak marked this pull request as draft September 2, 2026 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant