際際滷

際際滷Share a Scribd company logo
ALTERNATIVE
CHECKOUT FLOW
Yevhen
Sentiabov
MAGENTO ARCHITECT
#MM19PL
#MM19PL
Checkout features
- One-page checkout with support for different shipping carriers
- Multi-address checkout
- Instant Purchase with the ability to place an order from a product page
- Multiple payments integrations like PayPal, Braintree, Authorize.net
- Vault tokenization
- Different security features like 3D-Secure verification, anti-fraud protection
#MM19PL
Roadmap
#MM19PL
Current Checkout
#MM19PL
Current Checkout
#MM19PL
Current Checkout
#MM19PL
Current Checkout
#MM19PL
Current Checkout
#MM19PLREST
- Multiple requests to collect needed data
- No way to limit response data
#MM19PLGraphQL
- All resources are connected
- Declarative data fetching
- Type system and schema definition
- Multiple queries and mutations can be done via one request
#MM19PL
No HTTP caching
No API versioning
Tricky to implement rate limiting
Query complexity
Query in indefinite depth
But
#MM19PL
Checkout layouts
<item name="billing-step" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="children" xsi:type="array">
<item name="payment" xsi:type="array">
<item name="children" xsi:type="array">
<item name="renders" xsi:type="array">
<!-- merge payment method renders here -->
<item name="children" xsi:type="array">
<item name="braintree" xsi:type="array">
<item name="component
xsi:type="string">Magento_Braintree/js/view/payment/braintree</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
#MM19PL
Customization drawbacks
public function importShippingRate(AbstractResult $rate)
{
$this->setCode($rate->getCarrier() . '_' . $rate->getMethod())
->setCarrier($rate->getCarrier())
->setCarrierTitle($rate->getCarrierTitle())
->setMethod($rate->getMethod())
->setMethodTitle($rate->getMethodTitle())
->setMethodDescription($rate->getMethodDescription())
->setPrice($rate->getPrice());
return $this;
}
- Add custom shipping method details
- Expose details via GraphQL API
#MM19PL
Multi-address with Vault
MultishippingModelCheckoutTypeMultishippingPlaceOrderInterface::place
#MM19PL
Checkout dependencies graph
Alternative Checkout
#MM19PL
#MM19PL
Service Isolation
#MM19PL
Checkout Separation
Requirements
- Independent application (installation,
data storage)
- High availability and scalability
- Components replaceability
- No synchronous communication
#MM19PL
Eventual Consistency
#MM19PL
Alternative Data Flow
#MM19PL
Alternative Checkout
b2d6efb2d6ef
#MM19PL
Alternative Checkout
b2d6efb2d6ef
#MM19PL
Alternative Checkout
b2d6efb2d6ef
#MM19PL
Alternative Checkout
b2d6efb2d6ef
#MM19PL
Alternative Checkout
b2d6efb2d6ef
#MM19PL
Checkout dependencies graph
#MM19PL
Checkout improvements
 Better application performance
 Components replaceability
 Improved headless integration experience (GraphQL)
 GraphQL API for building checkout flow via single HTTP query
 Separated API for Cart and Quote
 Multi-address checkout based on multi-quote flow
 API for Requisition List and Negotiable Quote
#MM19PL
Totals Calculation Pipeline
#MM19PL
Totals Calculation Pipeline
#MM19PL
Mutable
- Simpler to create, test and use
- Help to avoid temporal coupling
- Easier to cache
- Do not change the state- Can be updated any time
- Are thread-safe
- Help avoid side effects
- Easier to implement
- Easier to extend
- Cheaper for creation
https://github.com/magento/architecture/pull/207
Immutable
#MM19PL
Totals List
#MM19PL
Totals List
#MM19PL
{
"amount":1002,
"currency":"USD",
"display_currency":"EUR",
"currency_exchange_rate":0.92,
"is_applicable":true,
"code":"totals_list",
"totals": [{
"code":"subtotal",
"amount":1002,
"is_applicable":true
}, {
"code":"discount",
"amount":0,
"is_applicable":false
}, {
"code":"grand_total",
"amount":1002,
"is_applicable":true
}
]
}
#MM19PL
Totals Storage
#MM19PL
Totals Storage (UUID)
#MM19PL
UUID advantages & disadvantages
Unique across applications/tables/databases
Environment independent
A value is known before the entity is saved
A value does not expose the information about the entity
Suitable for distributed systems
Take up more storage space
More difficult for debugging
Less performant than the auto increment
#MM19PL
UUID performance
#MM19PL
Summary
- Performance improvements
- Components replaceability
- Improvements to API customizability and extensibility
- Independent storefront and store management applications
- Clear boundaries between Cart and Quote components
- Unidirectional flow reduces communication between components
- Multi-address checkout out-of-box
- Support of immutable multi-quotes
- A unified interface for totals calculation
- Simplified and unified totals storage
Thank you
for attention!
@isentiabov
#MM19PL

More Related Content

Alternative checkout flow