Skip to content

Conversation

@bc-yaroslav-zhmutskyi
Copy link
Contributor

What/Why?

To test app switch changes

Rollout/Rollback

Revert

Testing

Manual

@bc-yaroslav-zhmutskyi bc-yaroslav-zhmutskyi requested a review from a team as a code owner November 3, 2025 18:52
Comment on lines +115 to +118
...(!isBuyNowFlow &&
this.isPaypalCommerceAppSwitchEnabled(methodId) && {
appSwitchWhenAvailable: true,
}),
Copy link

Choose a reason for hiding this comment

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

Bug: The isBuyNowFlow parameter is not passed to renderButton(), causing it to be undefined and incorrectly enabling app switch for buy now flows.
Severity: CRITICAL | Confidence: 0.95

🔍 Detailed Analysis

The isBuyNowFlow parameter is calculated in the initialize method but not passed to the renderButton method. As a result, isBuyNowFlow is undefined within renderButton(). This causes the condition !isBuyNowFlow to evaluate to true, leading to appSwitchWhenAvailable: true being incorrectly included in the button options for buy now flows. This can result in unintended app switch behavior during buy now checkout flows, breaking the feature.

💡 Suggested Fix

Pass the isBuyNowFlow parameter from the initialize method to the renderButton method when calling it, similar to the PayPalCommerceButtonStrategy implementation.

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location:
packages/bigcommerce-payments-integration/src/bigcommerce-payments/bigcommerce-payments-button-strategy.ts#L115-L118

Potential issue: The `isBuyNowFlow` parameter is calculated in the `initialize` method
but not passed to the `renderButton` method. As a result, `isBuyNowFlow` is `undefined`
within `renderButton()`. This causes the condition `!isBuyNowFlow` to evaluate to
`true`, leading to `appSwitchWhenAvailable: true` being incorrectly included in the
button options for buy now flows. This can result in unintended app switch behavior
during buy now checkout flows, breaking the feature.

Did we get this right? 👍 / 👎 to inform future reviews.

@bc-yaroslav-zhmutskyi bc-yaroslav-zhmutskyi marked this pull request as draft November 3, 2025 22:59
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.

2 participants