Skip to content

fix: respect showStatusMessage for payment cancelled view in dc#268

Open
jakubjasinsky wants to merge 2 commits into
masterfrom
jakub-hide-cancelled-status-message
Open

fix: respect showStatusMessage for payment cancelled view in dc#268
jakubjasinsky wants to merge 2 commits into
masterfrom
jakub-hide-cancelled-status-message

Conversation

@jakubjasinsky

@jakubjasinsky jakubjasinsky commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

showStatusMessage: false hides the success/error/pending views, but the payment cancelled view was still shown unconditionally. This gates it on the same flag.

Changes

  • Wrap DynamicCheckoutPaymentCancelledView in an if (showStatusMessage) check at all 5 call sites (apm.ts, saved-apm.ts, saved-card.ts)
  • dispatchPaymentCancelledEvent still fires regardless, so merchants handling their own UI keep getting the event

Additional Context

  • Follows the pending-view gating style rather than the success/error one, which falls back to DynamicCheckoutPaymentInfoView ("We are processing your payment…") — misleading after a cancellation, so nothing is rendered instead

Copilot AI review requested due to automatic review settings July 13, 2026 08:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates Dynamic Checkout payment flows to respect the paymentConfig.showStatusMessage flag when handling customer-cancelled payments, so the “payment cancelled” status view is not rendered when status messages are disabled.

Changes:

  • Gate rendering of DynamicCheckoutPaymentCancelledView behind paymentConfig.showStatusMessage for saved card payments.
  • Apply the same gating for saved APM payments (both action-handler and generic error paths).
  • Apply the same gating for APM payments (both relevant cancel handlers).

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.

File Description
src/dynamic-checkout/payment-methods/saved-card.ts Stop rendering the cancelled status view when showStatusMessage is disabled (saved card flow).
src/dynamic-checkout/payment-methods/saved-apm.ts Stop rendering the cancelled status view when showStatusMessage is disabled (saved APM flows).
src/dynamic-checkout/payment-methods/apm.ts Stop rendering the cancelled status view when showStatusMessage is disabled (APM flows).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +111 to +116
if (this.paymentConfig.showStatusMessage) {
this.resetContainerHtml().appendChild(
new DynamicCheckoutPaymentCancelledView(this.processOutInstance, this.paymentConfig)
.element,
)
}
Comment on lines +165 to +172
if (this.paymentConfig.showStatusMessage) {
this.resetContainerHtml().appendChild(
new DynamicCheckoutPaymentCancelledView(
this.processOutInstance,
this.paymentConfig,
).element,
)
}
Comment on lines +261 to +266
if (this.paymentConfig.showStatusMessage) {
this.resetContainerHtml().appendChild(
new DynamicCheckoutPaymentCancelledView(this.processOutInstance, this.paymentConfig)
.element,
)
}
Comment on lines +180 to +185
if (this.paymentConfig.showStatusMessage) {
this.resetContainerHtml().appendChild(
new DynamicCheckoutPaymentCancelledView(this.processOutInstance, this.paymentConfig)
.element,
)
}
Comment on lines +370 to +377
if (this.paymentConfig.showStatusMessage) {
this.resetContainerHtml().appendChild(
new DynamicCheckoutPaymentCancelledView(
this.processOutInstance,
this.paymentConfig,
).element,
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants