Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Spree Commerce hub - technical summary

Brian Quinn
September 17, 2013
190

Spree Commerce hub - technical summary

Brian Quinn

September 17, 2013
Tweet

Transcript

  1. Spree Commerce store front Spree Commerce hub Mandrill NetSuite Shipwire

    Custom SendGrid Xero Amazon Custom So Ne E Cu Overview
  2. Store front hub orders updated since (timestamp) updated orders Mandrill

    Endpoint send order confirmation email detect new orders confirmation Overview
  3. Store front hub orders updated since (timestamp) updated orders send

    shipment to fulfillment detect ready shipments confirmation Shipwire Endpoint Overview
  4. Store front hub poll for shipments (bookmark) dispatched shipments Shipwire

    Endpoint update shipment state + tracking confirmation Overview
  5. Store front hub poll for shipments (bookmark) dispatched shipments Shipwire

    Endpoint update shipment state + tracking confirmation Overview
  6. hub poll for shipments (bookmark) dispatched shipments Shipwire Endpoint +

    tracking Mandrill Endpoint send shipment notification email Overview
  7. hub poll for shipments (bookmark) dispatched shipments Shipwire Endpoint +

    tracking Mandrill Endpoint send shipment notification email confirmation Overview
  8. 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 }
  9. 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 }
  10. 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 }
  11. Order New order:new Order Updated order:updated Order Cancelled order:cancelled Shipment

    Confirmation shipment:confirm Shipment Ready shipment:ready
  12. 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
  13. 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
  14. 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
  15. order:new 1 x order:new order:new - Mandrill - NetSuite -

    MixPanel MSG Incoming Queue Router Consumer Registry Accepted Queue Message Flow
  16. 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
  17. Accepted Queue Dispatcher Mandrill order:new 1 MixPanel order:new 3 NetSuite

    order:new 2 3 x order:new - Mandrill - NetSuite - MixPanel Message Flow
  18. 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
  19. 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
  20. 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
  21. 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
  22. 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
  23. Order V1 parent: null Order V2 parent: V1 update new

    send order confirmation email Versioning
  24. Order V1 parent: null Order V2 parent: V1 update new

    send order confirmation email capture payment Versioning
  25. Order V1 parent: null Order V2 parent: V1 update new

    Order V3 parent: V2 update send order confirmation email capture payment Versioning
  26. 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
  27. 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
  28. 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
  29. 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 }
  30. 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 }
  31. 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
  32. 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
  33. 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
  34. Example: Endpoint Base 1 class SimpleEndpoint < EndpointBase 2 post

    '/' do 3 process_result 200, {'message_id' => @message['message_id'] } 4 end 5 end
  35. 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
  36. 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
  37. 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
  38. 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