Skip to content

Refactor Stripe V3 Intents, Elements and cart checkout JS code#31

Merged
spaghetticode merged 3 commits into
solidusio:masterfrom
spaghetticode:v3-js-refactoring
Mar 11, 2020
Merged

Refactor Stripe V3 Intents, Elements and cart checkout JS code#31
spaghetticode merged 3 commits into
solidusio:masterfrom
spaghetticode:v3-js-refactoring

Conversation

@spaghetticode

Copy link
Copy Markdown
Member

The code has been encapsulated in proper constructor objects by separating common code as necessary.

Code shared among all the Stripe V3 API checkout procedures is now contained in the Spree.StripePayment constructor.

SolidusStripe.Elements inherits directly from SolidusStripe.Payment, same goes for SolidusStripe.CartPageCheckout.

SolidusStripe.PaymentIntents inherits from SolidusStripe.Elements, as it basically extends the Elements functionality by adding the 3D secure feature.

Both SolidusStripe.CartPageCheckout and SolidusStripe.PaymentIntents allow to pay with Apple Pay/Google Pay, so they include shared methods from PaymentRequestButtonShared.

All functions are defined on the different classes prototype, this will allow to easily customize those functions according to needs by just overriding them on the proper prototype object.

The code has been encapsulated in proper constructor objects by
separating common code as necessary.

Code shared among all the Stripe V3 API checkout procedures is
now contained in the `Spree.StripePayment` constructor.

`SolidusStripe.Elements` inherits directly from `SolidusStripe.Payment`,
same goes for `SolidusStripe.CartPageCheckout`.

`SolidusStripe.PaymentIntents` inherits from `SolidusStripe.Elements`,
as it basically extends the Elements functionality by adding the 3D
secure feature.

Both `SolidusStripe.CartPageCheckout` and `SolidusStripe.PaymentIntents`
allow to pay with Apple Pay/Google Pay, so they include shared methods
from `PaymentRequestButtonShared`.

All functions are defined on the different classes prototype, this will
allow to easily customize those functions according to needs by just
overriding them on the proper prototype object.
@spaghetticode spaghetticode force-pushed the v3-js-refactoring branch 2 times, most recently from a6d87e4 to 7c161ce Compare March 10, 2020 12:52
Since solidusio/solidus#3524 was merged,
we need to verify if we're using the single "Name" field or the
previous first/last name combination.

@kennyadsl kennyadsl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, @spaghetticode!

@spaghetticode spaghetticode merged commit 7eb5c1a into solidusio:master Mar 11, 2020
@spaghetticode spaghetticode deleted the v3-js-refactoring branch March 11, 2020 09:20
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