Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Spree Commerce hub - technical summary
Search
Brian Quinn
September 17, 2013
210
1
Share
Spree Commerce hub - technical summary
Brian Quinn
September 17, 2013
More Decks by Brian Quinn
See All by Brian Quinn
Backend Integrations & the Spree Commerce Hub
bdq
3
480
SpreeConf DC 2013: Introducing the Spree Integrator
bdq
2
550
E-commerce Ireland: Introduction to Spree Commerce
bdq
1
270
SpreeConf Europe: Backbone.js & Spree
bdq
4
1k
SpreeConf 2012: Spree themes with Deface
bdq
9
5.4k
SpreeConf 2012: Spree's Hidden Gems
bdq
3
830
Featured
See All Featured
The Cost Of JavaScript in 2023
addyosmani
55
9.8k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
160
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
340
Designing for humans not robots
tammielis
254
26k
Optimizing for Happiness
mojombo
378
71k
Deep Space Network (abreviated)
tonyrice
0
110
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
240
What's in a price? How to price your products and services
michaelherold
247
13k
Technical Leadership for Architectural Decision Making
baasie
3
320
Paper Plane (Part 1)
katiecoart
PRO
0
6.6k
Designing for Performance
lara
611
70k
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
680
Transcript
Spree Commerce hub
Spree Commerce hub Overview
Spree Commerce store front Spree Commerce hub Overview
Spree Commerce store front Spree Commerce hub Overview
Spree Commerce store front Spree Commerce hub Mandrill NetSuite Shipwire
Custom Overview
Spree Commerce store front Spree Commerce hub Mandrill NetSuite Shipwire
Custom SendGrid Xero Amazon Custom So Ne E Cu Overview
Store front hub Mandrill Endpoint Overview
Store front hub orders updated since (timestamp) updated orders Mandrill
Endpoint Overview
Store front hub orders updated since (timestamp) updated orders Mandrill
Endpoint detect new orders Overview
Store front hub orders updated since (timestamp) updated orders Mandrill
Endpoint send order confirmation email detect new orders confirmation Overview
Store front hub orders updated since (timestamp) updated orders confirmation
Overview
Store front hub orders updated since (timestamp) updated orders send
shipment to fulfillment detect ready shipments confirmation Shipwire Endpoint Overview
Store front hub Shipwire Endpoint Overview
Store front hub poll for shipments (bookmark) dispatched shipments Shipwire
Endpoint Overview
Store front hub poll for shipments (bookmark) dispatched shipments Shipwire
Endpoint update shipment state + tracking confirmation Overview
Store front hub poll for shipments (bookmark) dispatched shipments Shipwire
Endpoint update shipment state + tracking confirmation Overview
hub poll for shipments (bookmark) dispatched shipments Shipwire Endpoint +
tracking Mandrill Endpoint Overview
hub poll for shipments (bookmark) dispatched shipments Shipwire Endpoint +
tracking Mandrill Endpoint Overview
hub poll for shipments (bookmark) dispatched shipments Shipwire Endpoint +
tracking Mandrill Endpoint send shipment notification email Overview
hub poll for shipments (bookmark) dispatched shipments Shipwire Endpoint +
tracking Mandrill Endpoint send shipment notification email confirmation Overview
Message Basics
JSON
Message: Overview 1 { 2 "message": "payment:ready", 3 "payload": {
4 "payment": { 5 "id": 15913, 6 "amount": "129.57", 7 "state": "pending", 8 "payment_method": { 9 "id": 931422127, 10 "name": "Credit Card", 11 "environment": "production" 12 } 13 } 14 } 15 }
Message: Overview 1 { 2 "message": "payment:ready", 3 "payload": {
4 "payment": { 5 "id": 15913, 6 "amount": "129.57", 7 "state": "pending", 8 "payment_method": { 9 "id": 931422127, 10 "name": "Credit Card", 11 "environment": "production" 12 } 13 } 14 } 15 }
Message: Overview 1 { 2 "message": "payment:ready", 3 "payload": {
4 "payment": { 5 "id": 15913, 6 "amount": "129.57", 7 "state": "pending", 8 "payment_method": { 9 "id": 931422127, 10 "name": "Credit Card", 11 "environment": "production" 12 } 13 } 14 } 15 }
message:
Order New order:new Order Updated order:updated Order Cancelled order:cancelled
Order New order:new Order Updated order:updated Order Cancelled order:cancelled Shipment
Confirmation shipment:confirm Shipment Ready shipment:ready
Order New order:new Order Updated order:updated Order Cancelled order:cancelled Payment
Ready payment:ready Shipment Confirmation shipment:confirm Shipment Ready shipment:ready Payment Captured payment:captured Payment Declined payment:declined
1 { 2 "message_id": "518783ac7575e46507000001", 3 "message": "payment:ready", 4 "payload":
{ ... }, 5 "parameters": [ 6 { 7 "name": "quickbooks.user_name", 8 "value": "iQ55k..." 9 }, 10 { 11 "name": "quickbooks.password", 12 "value": "YQoQS..." 13 } 14 ] 15 } Message: Parameters
1 { 2 "message_id": "518783ac7575e46507000001", 3 "message": "payment:ready", 4 "payload":
{ ... }, 5 "parameters": [ 6 { 7 "name": "quickbooks.user_name", 8 "value": "iQ55k..." 9 }, 10 { 11 "name": "quickbooks.password", 12 "value": "YQoQS..." 13 } 14 ] 15 } Message: Parameters
Message Flow
MSG Message Flow
MSG Incoming Queue Message Flow
MSG Incoming Queue Router Message Flow
MSG Incoming Queue Router Message Flow
MSG Incoming Queue Router Consumer Registry Message Flow
MSG Incoming Queue Router Consumer Registry Accepted Queue Message Flow
order:new MSG Incoming Queue Router Consumer Registry Accepted Queue Message
Flow
order:new 1 x order:new MSG Incoming Queue Router Consumer Registry
Accepted Queue Message Flow
order:new 1 x order:new order:new - Mandrill - NetSuite -
MixPanel MSG Incoming Queue Router Consumer Registry Accepted Queue Message Flow
order:new 1 x order:new order:new - Mandrill - NetSuite -
MixPanel 3 x order:new - Mandrill - NetSuite - MixPanel MSG Incoming Queue Router Consumer Registry Accepted Queue Message Flow
Accepted Queue 3 x order:new - Mandrill - NetSuite -
MixPanel Message Flow
Accepted Queue Dispatcher 3 x order:new - Mandrill - NetSuite
- MixPanel Message Flow
Accepted Queue Dispatcher 3 x order:new - Mandrill - NetSuite
- MixPanel Message Flow
Accepted Queue Dispatcher Mandrill order:new 1 MixPanel order:new 3 NetSuite
order:new 2 3 x order:new - Mandrill - NetSuite - MixPanel Message Flow
Accepted Queue Dispatcher Mandrill order:new 1 MixPanel order:new 3 NetSuite
order:new 2 200: success 200: success 3 x order:new - Mandrill - NetSuite - MixPanel Message Flow
Accepted Queue Dispatcher Mandrill order:new 1 MixPanel order:new 3 NetSuite
order:new 2 200: success 200: success 3 x order:new - Mandrill - NetSuite - MixPanel Message Flow
Accepted Queue Dispatcher Mandrill order:new 1 MixPanel order:new 3 NetSuite
order:new 2 200: success 200: success 500: fail! 3 x order:new - Mandrill - NetSuite - MixPanel Message Flow
Accepted Queue Dispatcher NetSuite 1 x order:new - NetSuite Message
Flow
Accepted Queue Dispatcher NetSuite order:new 2 500: fail! 1 x
order:new - NetSuite order:new 2 500: fail! order:new 2 500: fail! order:new 2 200: success Message Flow
Accepted Queue Dispatcher NetSuite order:new 2 500: fail! 1 x
order:new - NetSuite order:new 2 500: fail! order:new 2 500: fail! order:new 2 200: success Message Flow
Benefits
Versioned
Order V1 parent: null new Versioning
Order V1 parent: null new send order confirmation email Versioning
Order V1 parent: null Order V2 parent: V1 update new
send order confirmation email Versioning
Order V1 parent: null Order V2 parent: V1 update new
send order confirmation email capture payment Versioning
Order V1 parent: null Order V2 parent: V1 update new
Order V3 parent: V2 update send order confirmation email capture payment Versioning
Order V1 parent: null Order V2 parent: V1 update new
Order V3 parent: V2 update send order confirmation email capture payment send shipment to fulfillment Versioning
Order V1 parent: null Order V2 parent: V1 update new
Order V3 parent: V2 update update Order V4 parent: V3 send order confirmation email capture payment send shipment to fulfillment Versioning
Order V1 parent: null Order V2 parent: V1 update new
Order V3 parent: V2 update update Order V4 parent: V3 send order confirmation email capture payment send shipment to fulfillment send shipment confirmation Versioning
Versioning Implying events
Order V1 state: complete Versioning
Order V1 state: complete update Order V2 state: canceled Versioning
Order V1 state: complete update Order V2 state: canceled push
message order:update Versioning
Order V1 state: complete update Order V2 state: canceled order:canceled
push message order:update Versioning
Logged
Messages (8)
Messages (10)
Managed
Custom Endpoints
HTTP
Message: message_id 1 { 2 "message_id": "518783ac7575e46507000001", 3 "message": "payment:ready",
4 "payload": { 5 "payment": { 6 "id": 15913, 7 "amount": "129.57", 8 "state": "pending", 9 "payment_method": { 10 "id": 931422127, 11 "name": "Credit Card", 12 "environment": "production" 13 } 14 } 15 } 16 }
Message: message_id 1 { 2 "message_id": "518783ac7575e46507000001", 3 "message": "payment:ready",
4 "payload": { 5 "payment": { 6 "id": 15913, 7 "amount": "129.57", 8 "state": "pending", 9 "payment_method": { 10 "id": 931422127, 11 "name": "Credit Card", 12 "environment": "production" 13 } 14 } 15 } 16 }
Dispatcher Endpoint order:new
Dispatcher Endpoint POST JSON { ... } order:new
Dispatcher Endpoint {message_id: x} HTTP: 200 POST JSON { ...
} order:new
Dispatcher Endpoint {message_id: x} HTTP: 200 POST JSON { ...
} order:new --------------- ✓
Response: Basic 1 { 2 "message_id": "518783ac7575e46507000001" 3 }
Endpoint: Sinatra 1 require 'sinatra' 2 require 'sinatra/json' 3 4
class SimpleEndpoint < Sinatra::Base 5 helpers Sinatra::JSON 6 7 post '/' do 8 message = JSON.parse(request.body.read) 9 10 json 'message_id' => message['message_id'] 11 end 12 end
Endpoint: Sinatra 1 require 'sinatra' 2 require 'sinatra/json' 3 4
class SimpleEndpoint < Sinatra::Base 5 helpers Sinatra::JSON 6 7 post '/' do 8 message = JSON.parse(request.body.read) 9 10 json 'message_id' => message['message_id'] 11 end 12 end
Endpoint: Sinatra 1 require 'sinatra' 2 require 'sinatra/json' 3 4
class SimpleEndpoint < Sinatra::Base 5 helpers Sinatra::JSON 6 7 post '/' do 8 message = JSON.parse(request.body.read) 9 10 json 'message_id' => message['message_id'] 11 end 12 end <- DO INTERESTING THINGS HERE
Endpoint Base https://github.com/spree/endpoint_base
Example: Endpoint Base 1 class SimpleEndpoint < EndpointBase 2 post
'/' do 3 process_result 200, {'message_id' => @message['message_id'] } 4 end 5 end
1 { 2 "message_id": "518783ac7575e46507000001", 3 "notifications": [ 4 {
"level": "info", 5 "subject": "Shipment accepted", 6 "description": "Shipment H123456 was accepted by 3PL" 7 } 8 ], 9 } Response: Notifications
1 { 2 "message_id": "518783ac7575e46507000001", 3 "notifications": [ 4 {
"level": "info", 5 "subject": "Shipment accepted", 6 "description": "Shipment H123456 was accepted by 3PL" 7 } 8 ], 9 } Response: Notifications
None
1 { 2 "message_id": "518783ac7575e46507000001", 3 "notifications": [{"level": "info", "subject":
"it happened"}], 4 "messages": [ 5 { 6 "message": "payment:captured", 7 "payload": { 8 “amount": 129.99, 9 } 10 } 11 ] 12 } Response: Messages
1 { 2 "message_id": "518783ac7575e46507000001", 3 "notifications": [{"level": "info", "subject":
"it happened"}], 4 "messages": [ 5 { 6 "message": "payment:captured", 7 "payload": { 8 “amount": 129.99, 9 } 10 } 11 ] 12 } Response: Messages
None