-
Notifications
You must be signed in to change notification settings - Fork 24
(WIP) Migration to CheckoutKit 4.0 #303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
tiagocandido
wants to merge
5
commits into
main
Choose a base branch
from
ts/partner-authentication
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7dfe1b3
to
27ca4c8
Compare
116945a
to
f131897
Compare
tiagocandido
commented
Jun 25, 2025
tiagocandido
commented
Jun 25, 2025
f56a6ea
to
20b8c8e
Compare
This commit introduces the complete data model infrastructure for embedded checkout functionality using the Schema 2025-04 specification. Key additions: - CheckoutStatePayload, CheckoutCompletePayload, WebPixelsPayload for event handling - Complete embedded checkout data types with 'Embedded' prefixes to avoid naming conflicts - CheckoutOptions and AppAuthentication for configuration - AnyCodable helper for handling arbitrary JSON payloads - Error payload models for embedded checkout error handling All types are prefixed with 'Embedded' to avoid conflicts with existing types in the codebase. This maintains backward compatibility while enabling new embedded checkout functionality.
This commit extends the CheckoutBridge with embedded checkout functionality while maintaining backward compatibility with existing checkout flows. Key additions: - embedParams() method to generate authentication and configuration parameters - Support for embedded checkout authentication tokens - Protocol version 2025-04 for embedded checkout specification - Color scheme and platform parameter generation The existing CheckoutBridge enum interface is preserved, with new functionality added as static methods. This ensures no breaking changes to current integrations.
This commit extends CheckoutWebView with comprehensive embedded checkout functionality while maintaining backward compatibility. Key additions: - Extended CheckoutWebViewDelegate with embedded checkout event methods - checkoutOptions property to configure embedded checkout authentication - buildCheckoutURL() method to add embed query parameters with authentication tokens - Enhanced message handler supporting both legacy and embedded checkout events - Comprehensive event decoders for embedded checkout payloads: - CheckoutStatePayload for state change events - CheckoutCompletePayload for completion events - ErrorPayload array for error handling - WebPixelsPayload for web pixel events The implementation prioritizes embedded checkout event handling while gracefully falling back to legacy CheckoutBridge decoding for existing checkout flows. This ensures full backward compatibility.
…utDelegate This commit integrates embedded checkout functionality into the view controller layer and delegate protocol while maintaining backward compatibility. CheckoutWebViewController changes: - Added CheckoutOptions parameter to initializer for embedded checkout configuration - Implemented embedded checkout delegate methods: - checkoutViewDidChangeState() for state change events - checkoutViewDidComplete() for completion with embedded payload - checkoutViewDidFail() for error handling with embedded error payloads - checkoutViewDidEmitWebPixelEvent() for embedded web pixel events - Enhanced error recovery logic for embedded checkout error types CheckoutDelegate changes: - Extended protocol with embedded checkout event methods - Added default implementations for all new methods to maintain compatibility - Documented embedded checkout methods with Schema 2025-04 specification All changes are backward compatible - existing implementations continue to work unchanged while new embedded checkout functionality is available for apps that need it.
This commit updates the test infrastructure to support the new embedded checkout interfaces while maintaining compatibility with existing tests. CheckoutViewControllerTests changes: - Updated MockCheckoutWebViewController initializations to include new parameters - Added createEmptyCheckoutCompletedPayload() helper for embedded checkout tests - Maintained backward compatibility with existing test methods MockCheckoutWebViewDelegate changes: - Added embedded checkout delegate method implementations - Added properties to capture embedded checkout event payloads - Added XCTestExpectation properties for embedded checkout event testing - Maintained all existing legacy delegate method functionality All existing tests continue to pass while new embedded checkout functionality can be tested using the extended mock interfaces.
bc2e2b0
to
7d9c9f6
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changes are you making?
This PR adds embedded checkout support using Schema 2025-04 specification. The implementation includes:
Data Models: Added
CheckoutStatePayload
,CheckoutCompletePayload
,WebPixelsPayload
, andErrorPayload
types for embedded checkout events. AddedCheckoutOptions
andAppAuthentication
for partner authentication configuration.CheckoutBridge: Extended with
embedParams()
method to generate authentication tokens and configuration parameters for embedded checkout URLs.CheckoutWebView: Enhanced message handling to process both legacy and embedded checkout events. Added URL building logic to include embed parameters when
CheckoutOptions
is provided.CheckoutWebViewController: Added
options
parameter to initializer and implemented embedded checkout delegate methods with error recovery logic.CheckoutDelegate: Extended protocol with embedded checkout event methods (
checkoutDidChangeState
,checkoutDidComplete
,checkoutDidFail
,checkoutDidEmitWebPixelEvent
) with default no-op implementations for backward compatibility.Test Infrastructure: Updated mocks and test helpers to support embedded checkout functionality.
All changes maintain backward compatibility - existing checkout flows continue to work unchanged.
How to test
Before you merge
[!IMPORTANT]
[!TIP]
See the https://github.com/shopify/checkout-sheet-kit-swift/blob/main/.github/CONTRIBUTING.md#releasing-a-new-version for instructions on how to publish a new version of the library.