Skip to content

Instantly share code, notes, and snippets.

@lin-d-hop
Last active July 25, 2019 08:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lin-d-hop/ad18e3568ad25069bd75ea15a32cd3ef to your computer and use it in GitHub Desktop.
Save lin-d-hop/ad18e3568ad25069bd75ea15a32cd3ef to your computer and use it in GitHub Desktop.
Example Order Json from OFN
{
"adjustments": [
{
"adjustable_type": "Spree::Order",
"mandatory": true,
"adjustable_id": 558069,
"originator_type": "EnterpriseFee",
"eligible": true,
"created_at": "2019-05-08T10:11:44+01:00",
"updated_at": "2019-05-08T10:11:44+01:00",
"label": "Carrots (organic, Spain) - sales fee by supplier Stroudco Food Hub / Stroud Farmers' Market",
"source_type": "Spree::LineItem",
"amount": "0.28",
"originator_id": 1,
"source_id": 419904,
"id": 2926279
},
{
"adjustable_type": "Spree::Order",
"mandatory": true,
"adjustable_id": 558069,
"originator_type": "EnterpriseFee",
"eligible": true,
"created_at": "2019-05-08T10:11:45+01:00",
"updated_at": "2019-05-08T10:11:45+01:00",
"label": "Mushrooms, portabellini chestnut - sales fee by supplier Stroudco Food Hub / Stroud Farmers' Market",
"source_type": "Spree::LineItem",
"amount": "0.37",
"originator_id": 1,
"source_id": 419907,
"id": 2926280
},
{
"adjustable_type": "Spree::Order",
"mandatory": true,
"adjustable_id": 558069,
"originator_type": "EnterpriseFee",
"eligible": true,
"created_at": "2019-05-08T10:11:45+01:00",
"updated_at": "2019-05-08T10:11:45+01:00",
"label": "Eggs, Duck (free range) - sales fee by supplier Stroudco Food Hub / Stroud Farmers' Market",
"source_type": "Spree::LineItem",
"amount": "0.75",
"originator_id": 1,
"source_id": 419908,
"id": 2926281
},
{
"adjustable_type": "Spree::Order",
"mandatory": true,
"adjustable_id": 558069,
"originator_type": "EnterpriseFee",
"eligible": true,
"created_at": "2019-05-08T10:11:45+01:00",
"updated_at": "2019-05-08T10:11:45+01:00",
"label": "Bread, Ciabatta - sales fee by supplier Stroudco Food Hub / Stroud Farmers' Market",
"source_type": "Spree::LineItem",
"amount": "1.26",
"originator_id": 1,
"source_id": 419909,
"id": 2926282
},
{
"adjustable_type": "Spree::Order",
"mandatory": true,
"adjustable_id": 558069,
"originator_type": "EnterpriseFee",
"eligible": true,
"created_at": "2019-05-08T10:11:45+01:00",
"updated_at": "2019-05-08T10:11:45+01:00",
"label": "Flapjacks - sales fee by supplier Stroudco Food Hub / Stroud Farmers' Market",
"source_type": "Spree::LineItem",
"amount": "0.53",
"originator_id": 1,
"source_id": 419910,
"id": 2926283
},
{
"adjustable_type": "Spree::Order",
"mandatory": true,
"adjustable_id": 558069,
"originator_type": "EnterpriseFee",
"eligible": true,
"created_at": "2019-05-08T10:11:45+01:00",
"updated_at": "2019-05-08T10:11:45+01:00",
"label": "Dried Fruit (organic, plastic-free) - sales fee by supplier Stroudco Food Hub / Stroud Farmers' Market",
"source_type": "Spree::LineItem",
"amount": "0.8",
"originator_id": 1,
"source_id": 419911,
"id": 2926284
},
{
"adjustable_type": "Spree::Order",
"mandatory": true,
"adjustable_id": 558069,
"originator_type": "EnterpriseFee",
"eligible": true,
"created_at": "2019-05-08T10:11:45+01:00",
"updated_at": "2019-05-08T10:11:45+01:00",
"label": "Dried Fruit (organic, plastic-free) - sales fee by supplier Stroudco Food Hub / Stroud Farmers' Market",
"source_type": "Spree::LineItem",
"amount": "0.3",
"originator_id": 1,
"source_id": 419912,
"id": 2926285
},
{
"adjustable_type": "Spree::Order",
"mandatory": true,
"adjustable_id": 558069,
"originator_type": "EnterpriseFee",
"eligible": true,
"created_at": "2019-05-08T10:11:45+01:00",
"updated_at": "2019-05-08T10:11:45+01:00",
"label": "Dried Fruit (organic, plastic-free) - sales fee by supplier Stroudco Food Hub / Stroud Farmers' Market",
"source_type": "Spree::LineItem",
"amount": "0.63",
"originator_id": 1,
"source_id": 419913,
"id": 2926286
},
{
"adjustable_type": "Spree::Order",
"mandatory": true,
"adjustable_id": 558069,
"originator_type": "EnterpriseFee",
"eligible": true,
"created_at": "2019-05-08T10:11:45+01:00",
"updated_at": "2019-05-08T10:11:45+01:00",
"label": "Grains, flour, pasta (organic, plastic-free) - sales fee by supplier Stroudco Food Hub / Stroud Farmers' Market",
"source_type": "Spree::LineItem",
"amount": "0.76",
"originator_id": 1,
"source_id": 419914,
"id": 2926287
},
{
"adjustable_type": "Spree::Order",
"mandatory": true,
"adjustable_id": 558069,
"originator_type": "EnterpriseFee",
"eligible": true,
"created_at": "2019-05-08T10:11:46+01:00",
"updated_at": "2019-05-08T10:11:46+01:00",
"label": "Nuts & Seeds (organic, plastic-free) - sales fee by supplier Stroudco Food Hub / Stroud Farmers' Market",
"source_type": "Spree::LineItem",
"amount": "0.95",
"originator_id": 1,
"source_id": 419915,
"id": 2926288
},
{
"adjustable_type": "Spree::Order",
"mandatory": true,
"adjustable_id": 558069,
"originator_type": "EnterpriseFee",
"eligible": true,
"created_at": "2019-05-08T10:11:46+01:00",
"updated_at": "2019-05-08T10:11:46+01:00",
"label": "Nuts & Seeds (organic, plastic-free) - sales fee by supplier Stroudco Food Hub / Stroud Farmers' Market",
"source_type": "Spree::LineItem",
"amount": "0.75",
"originator_id": 1,
"source_id": 419916,
"id": 2926289
},
{
"adjustable_type": "Spree::Order",
"mandatory": true,
"adjustable_id": 558069,
"originator_type": "EnterpriseFee",
"eligible": true,
"created_at": "2019-05-08T10:11:46+01:00",
"updated_at": "2019-05-08T10:11:46+01:00",
"label": "Nuts & Seeds (organic, plastic-free) - sales fee by supplier Stroudco Food Hub / Stroud Farmers' Market",
"source_type": "Spree::LineItem",
"amount": "0.63",
"originator_id": 1,
"source_id": 419917,
"id": 2926290
},
{
"adjustable_type": "Spree::Order",
"mandatory": true,
"adjustable_id": 558069,
"originator_type": "EnterpriseFee",
"eligible": true,
"created_at": "2019-05-08T10:11:46+01:00",
"updated_at": "2019-05-08T10:11:46+01:00",
"label": "Tea (loose, plastic-free) - sales fee by supplier Stroudco Food Hub / Stroud Farmers' Market",
"source_type": "Spree::LineItem",
"amount": "0.65",
"originator_id": 1,
"source_id": 419918,
"id": 2926291
},
{
"adjustable_type": "Spree::Order",
"mandatory": true,
"adjustable_id": 558069,
"originator_type": "EnterpriseFee",
"eligible": true,
"created_at": "2019-05-08T10:11:46+01:00",
"updated_at": "2019-05-08T10:11:46+01:00",
"label": "Fatballs - sales fee by supplier Stroudco Food Hub / Stroud Farmers' Market",
"source_type": "Spree::LineItem",
"amount": "0.35",
"originator_id": 1,
"source_id": 419919,
"id": 2926292
},
{
"adjustable_type": "Spree::Order",
"mandatory": true,
"adjustable_id": 558069,
"originator_type": "EnterpriseFee",
"eligible": true,
"created_at": "2019-05-08T10:11:46+01:00",
"updated_at": "2019-05-08T10:11:46+01:00",
"label": "Winstones Ice Cream - sales fee by supplier Stroudco Food Hub / Stroud Farmers' Market",
"source_type": "Spree::LineItem",
"amount": "0.6",
"originator_id": 1,
"source_id": 419921,
"id": 2926293
},
{
"adjustable_type": "Spree::Order",
"mandatory": true,
"adjustable_id": 558069,
"originator_type": "Spree::ShippingMethod",
"eligible": true,
"created_at": "2019-05-08T10:13:25+01:00",
"updated_at": "2019-05-08T10:13:25+01:00",
"label": "Shipping",
"source_type": "Spree::Shipment",
"amount": "2.0",
"originator_id": 200073,
"source_id": 225664,
"id": 2926294
},
{
"adjustable_type": "Spree::Order",
"mandatory": true,
"adjustable_id": 558069,
"originator_type": "Spree::PaymentMethod",
"eligible": true,
"created_at": "2019-05-08T10:13:25+01:00",
"updated_at": "2019-05-08T10:13:25+01:00",
"label": "Transaction fee",
"source_type": "Spree::Payment",
"amount": "0.0",
"originator_id": 200093,
"source_id": 229781,
"id": 2926295
}
],
"updated_at": "2019-05-08T10:13:36+01:00",
"shipment_state": "pending",
"completed_at": "2019-05-08T10:13:35+01:00",
"total": "64.48",
"id": 558069,
"user_id": 13,
"payment_total": "0.0",
"state": "complete",
"credit_cards": [],
"bill_address": {
"city": "Stroud",
"state_name": "Gloucestershire",
"firstname": "Carol & Nick",
"alternative_phone": null,
"lastname": "MATHEWS & WEIR",
"address2": "unused",
"country_id": 44,
"zipcode": "GL5 1HF",
"phone": "840036",
"state": {
"country_id": 44,
"id": 134,
"name": "Gloucestershire",
"abbr": "Glo"
},
"address1": "4 Bisy Road",
"state_id": 134,
"country": {
"name": "United Kingdom",
"iso_name": "UNITED KINGDOM",
"numcode": 826,
"iso3": "GBR",
"iso": "GB",
"id": 44
},
"company": null,
"id": 388016
},
"email": "caol@carews.co.uk",
"shipments": [
{
"tracking": null,
"shipping_method": {
"shipping_category_id": null,
"zone_id": 1,
"name": "Home Delivery - Zones 1 - 3 for orders over £25"
},
"order_id": "R561670153",
"number": "H28426614226",
"shipped_at": null,
"state": "pending",
"cost": "2.0",
"id": 225664
}
],
"ship_address": {
"city": "Stroud",
"state_name": "Gloucestershire",
"firstname": "Carol & Nick",
"alternative_phone": null,
"lastname": "MATHEWS & WEIR",
"address2": "unused",
"country_id": 44,
"zipcode": "GL5 1F",
"phone": "840036",
"state": {
"country_id": 44,
"id": 134,
"name": "Gloucestershire",
"abbr": "Glo"
},
"address1": "44 Bisy Road",
"state_id": 134,
"country": {
"name": "United Kingdom",
"iso_name": "UNITED KINGDOM",
"numcode": 826,
"iso3": "GBR",
"iso": "GB",
"id": 44
},
"company": null,
"id": 388015
},
"line_items": [
{
"price": "1.4",
"variant_id": 201410,
"variant": {
"count_on_hand": 2,
"sku": "Veg Car",
"permalink": "Product_561",
"name": "Carrots (organic, Spain)",
"weight": "0.5",
"price": "1.4",
"height": null,
"width": null,
"depth": null,
"images": [
{
"attachment_url": "https://s3.amazonaws.com/ofn-uk-production/public/spree/products/7850/product/carrot_harvest.jpg?1550589842",
"attachment_width": 1280,
"attachment_updated_at": "2019-02-19T15:24:02+00:00",
"viewable_type": "Spree::Variant",
"attachment_height": 856,
"viewable_id": 201410,
"attachment_content_type": "image/jpeg",
"position": 1,
"alt": "",
"type": "Spree::Image",
"id": 7850,
"attachment_file_name": "carrot_harvest.jpg"
}
],
"is_master": false,
"product_id": 636,
"id": 201410,
"cost_price": "0.0"
},
"id": 419904,
"quantity": 1
},
{
"price": "1.83",
"variant_id": 214926,
"variant": {
"count_on_hand": 0,
"sku": "",
"permalink": "mushrooms-3",
"name": "Mushrooms, portabellini chestnut",
"weight": "0.35",
"price": "1.83",
"height": null,
"width": null,
"depth": null,
"images": [],
"is_master": false,
"product_id": 205266,
"id": 214926,
"cost_price": null
},
"id": 419907,
"quantity": 1
},
{
"price": "1.23",
"variant_id": 205088,
"variant": {
"count_on_hand": 4,
"sku": "",
"permalink": "free-range-duck-eggs-photo-compares-to-hen-eggs",
"name": "Eggs, Duck (free range)",
"weight": null,
"price": "1.23",
"height": null,
"width": null,
"depth": null,
"images": [],
"is_master": false,
"product_id": 200964,
"id": 205088,
"cost_price": null
},
"id": 419908,
"quantity": 3
},
{
"price": "2.08",
"variant_id": 207418,
"variant": {
"count_on_hand": 0,
"sku": "",
"permalink": "bread-ciabatta",
"name": "Bread, Ciabatta",
"weight": "0.4",
"price": "2.08",
"height": null,
"width": null,
"depth": null,
"images": [],
"is_master": false,
"product_id": 201934,
"id": 207418,
"cost_price": null
},
"id": 419909,
"quantity": 3
},
{
"price": "2.63",
"variant_id": 206204,
"variant": {
"count_on_hand": 0,
"sku": "",
"permalink": "Product_1268",
"name": "Flapjacks",
"weight": null,
"price": "2.63",
"height": null,
"width": null,
"depth": null,
"images": [],
"is_master": false,
"product_id": 1320,
"id": 206204,
"cost_price": null
},
"id": 419910,
"quantity": 1
},
{
"price": "4.0",
"variant_id": 215991,
"variant": {
"count_on_hand": 0,
"sku": "",
"permalink": "dried-fruit-organic-plastic-free",
"name": "Dried Fruit (organic, plastic-free)",
"weight": "0.5",
"price": "4.0",
"height": null,
"width": null,
"depth": null,
"images": [],
"is_master": false,
"product_id": 205665,
"id": 215991,
"cost_price": null
},
"id": 419911,
"quantity": 1
},
{
"price": "1.5",
"variant_id": 215990,
"variant": {
"count_on_hand": 0,
"sku": "",
"permalink": "dried-fruit-organic-plastic-free",
"name": "Dried Fruit (organic, plastic-free)",
"weight": "0.2",
"price": "1.5",
"height": null,
"width": null,
"depth": null,
"images": [],
"is_master": false,
"product_id": 205665,
"id": 215990,
"cost_price": null
},
"id": 419912,
"quantity": 1
},
{
"price": "3.13",
"variant_id": 216309,
"variant": {
"count_on_hand": 0,
"sku": "",
"permalink": "dried-fruit-organic-plastic-free",
"name": "Dried Fruit (organic, plastic-free)",
"weight": "0.25",
"price": "3.13",
"height": null,
"width": null,
"depth": null,
"images": [],
"is_master": false,
"product_id": 205665,
"id": 216309,
"cost_price": null
},
"id": 419913,
"quantity": 1
},
{
"price": "1.9",
"variant_id": 216884,
"variant": {
"count_on_hand": 0,
"sku": "",
"permalink": "grains-organic-plastic-free",
"name": "Grains, flour, pasta (organic, plastic-free)",
"weight": "0.5",
"price": "1.9",
"height": null,
"width": null,
"depth": null,
"images": [],
"is_master": false,
"product_id": 205663,
"id": 216884,
"cost_price": null
},
"id": 419914,
"quantity": 2
},
{
"price": "4.75",
"variant_id": 216499,
"variant": {
"count_on_hand": 0,
"sku": "",
"permalink": "nuts-and-seeds-organic-plastic-free",
"name": "Nuts & Seeds (organic, plastic-free)",
"weight": "0.25",
"price": "4.75",
"height": null,
"width": null,
"depth": null,
"images": [],
"is_master": false,
"product_id": 205664,
"id": 216499,
"cost_price": null
},
"id": 419915,
"quantity": 1
},
{
"price": "3.75",
"variant_id": 215983,
"variant": {
"count_on_hand": 0,
"sku": "",
"permalink": "nuts-and-seeds-organic-plastic-free",
"name": "Nuts & Seeds (organic, plastic-free)",
"weight": "0.25",
"price": "3.75",
"height": null,
"width": null,
"depth": null,
"images": [],
"is_master": false,
"product_id": 205664,
"id": 215983,
"cost_price": null
},
"id": 419916,
"quantity": 1
},
{
"price": "3.15",
"variant_id": 215988,
"variant": {
"count_on_hand": 0,
"sku": "",
"permalink": "nuts-and-seeds-organic-plastic-free",
"name": "Nuts & Seeds (organic, plastic-free)",
"weight": "0.15",
"price": "3.15",
"height": null,
"width": null,
"depth": null,
"images": [],
"is_master": false,
"product_id": 205664,
"id": 215988,
"cost_price": null
},
"id": 419917,
"quantity": 1
},
{
"price": "3.25",
"variant_id": 221547,
"variant": {
"count_on_hand": 0,
"sku": "",
"permalink": "tea-english-breakfast-loose-plastic-free",
"name": "Tea (loose, plastic-free)",
"weight": "0.1",
"price": "3.25",
"height": null,
"width": null,
"depth": null,
"images": [],
"is_master": false,
"product_id": 205667,
"id": 221547,
"cost_price": null
},
"id": 419918,
"quantity": 1
},
{
"price": "0.35",
"variant_id": 201851,
"variant": {
"count_on_hand": 37,
"sku": "SVP3",
"permalink": "Product_1038",
"name": "Fatballs",
"weight": "0.09",
"price": "0.35",
"height": null,
"width": null,
"depth": null,
"images": [],
"is_master": false,
"product_id": 1113,
"id": 201851,
"cost_price": "0.0"
},
"id": 419919,
"quantity": 5
},
{
"price": "5.0",
"variant_id": 207328,
"variant": {
"count_on_hand": 0,
"sku": "",
"permalink": "donation-for-food-bank",
"name": "Donation for Food Bank ",
"weight": null,
"price": "5.0",
"height": null,
"width": null,
"depth": null,
"images": [],
"is_master": false,
"product_id": 201889,
"id": 207328,
"cost_price": null
},
"id": 419920,
"quantity": 1
},
{
"price": "3.0",
"variant_id": 2886,
"variant": {
"count_on_hand": 1,
"sku": "",
"permalink": "Product_1813",
"name": "Winstones Ice Cream",
"weight": null,
"price": "3.0",
"height": null,
"width": null,
"depth": null,
"images": [],
"is_master": false,
"product_id": 1792,
"id": 2886,
"cost_price": null
},
"id": 419921,
"quantity": 1
}
],
"number": "R561670153",
"adjustment_total": "11.61",
"special_instructions": null,
"item_total": "52.87",
"payment_state": "balance_due",
"created_at": "2019-05-08T09:51:15+01:00",
"payments": [
{
"payment_method": {
"environment": "production",
"id": 200093,
"name": "Invoice (existing customers)"
},
"amount": "64.48",
"payment_method_id": 200093,
"id": 229781,
"state": "checkout"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment