Skip to content

feat(payment): PAYPAL-6352 implemented server side shipping callbacks logic#3237

Merged
andriiVitvitskyi1990 merged 2 commits into
masterfrom
PAYPAL-6352_PR
May 19, 2026
Merged

feat(payment): PAYPAL-6352 implemented server side shipping callbacks logic#3237
andriiVitvitskyi1990 merged 2 commits into
masterfrom
PAYPAL-6352_PR

Conversation

@andriiVitvitskyi1990

@andriiVitvitskyi1990 andriiVitvitskyi1990 commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

What/Why?

Implemented server side shipping callbacks logic for BCP

Rollout/Rollback

Revert PR

Testing

Unit tests


Note

Medium Risk
Changes the PayPal hosted-checkout approval and order-update flow, conditionally skipping client-side shipping callbacks and altering the updateOrder payload; mistakes could impact shipping selection/address syncing and order submission timing.

Overview
Adds a new isServerSideShippingCallbacksEnabled flag to BigCommerce Payments initialization data and wires it through PayPal button/customer hosted-checkout flows.

When enabled, the strategies stop registering PayPal onShippingAddressChange/onShippingOptionsChange callbacks, adjust the approve path to avoid actions.order.get()/address updates, force an updateOrder call with empty shipping options + selectedShippingOption: null, and reload checkout before submitting order/payment. App-switch rendering/resume logic (and related tests/mocks) is removed, and PayPalUpdateOrderRequestBody.selectedShippingOption now allows null.

Reviewed by Cursor Bugbot for commit ad70400. Bugbot is set up for automated code reviews on this repo. Configure here.

@andriiVitvitskyi1990 andriiVitvitskyi1990 marked this pull request as ready for review April 30, 2026 14:45
@andriiVitvitskyi1990 andriiVitvitskyi1990 requested a review from a team as a code owner April 30, 2026 14:45
@andriiVitvitskyi1990 andriiVitvitskyi1990 force-pushed the PAYPAL-6352_PR branch 2 times, most recently from 0107bfd to 3672197 Compare April 30, 2026 15:13

if (this.paypalButton.hasReturned?.() && this.isAppSwitchEnabled(methodId)) {
if (
this.paypalButton.hasReturned?.() &&

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.

As you mentioned before hasReturned should be removed since we do not need it anymore. Is there a reason to leave it as it is here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes, i did not change this PR yet

const quoteShippingAddress = consignment.shippingAddress;
shippingAddress = {
...quoteShippingAddress,
...this.bigCommercePaymentsIntegrationService.getShippingAddressFromOrderDetails(

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.

Was this part aligned with the back-end part of work? I remember we discussed it and it is something you need to clarify with @alstarodubtcev

@andriiVitvitskyi1990 andriiVitvitskyi1990 force-pushed the PAYPAL-6352_PR branch 2 times, most recently from 3672197 to 421dc35 Compare May 4, 2026 14:58
shouldRunAcceleratedCheckout?: boolean;
paymentButtonStyles?: Record<string, PayPalButtonStyleOptions>;
isAppSwitchEnabled?: boolean;
isServerSideShippingCallbacksEnabled?: boolean;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Dead hasReturned and resume type members after removal

Low Severity

The hasReturned and resume optional methods on the BigCommercePaymentsButtons interface are now dead code. This PR removed every call site for both methods (from the button, customer, and payment strategies), but the type definitions remain. The reviewer already flagged hasReturned specifically. Keeping unused members in an SDK interface can mislead future developers into thinking these are still part of the integration contract.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 5862f51. Configure here.

@andriiVitvitskyi1990 andriiVitvitskyi1990 force-pushed the PAYPAL-6352_PR branch 2 times, most recently from dc2209e to 34116fa Compare May 18, 2026 10:03
}

async updateOrder(): Promise<void> {
async updateOrder(isServerSideShippingCallbacksEnabled?: boolean): Promise<void> {

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.

It would be better and safer to add a test for this new logic

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

added

@andriiVitvitskyi1990 andriiVitvitskyi1990 force-pushed the PAYPAL-6352_PR branch 2 times, most recently from 5a4af00 to 3d92bc5 Compare May 18, 2026 14:37
@andriiVitvitskyi1990 andriiVitvitskyi1990 force-pushed the PAYPAL-6352_PR branch 2 times, most recently from 669bbc3 to 03f6932 Compare May 18, 2026 14:53

@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.

There are 2 total unresolved issues (including 1 from previous review).

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 03f6932. Configure here.

@andriiVitvitskyi1990 andriiVitvitskyi1990 merged commit 0b8e392 into master May 19, 2026
9 checks passed
@andriiVitvitskyi1990 andriiVitvitskyi1990 deleted the PAYPAL-6352_PR branch May 19, 2026 08:52
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