vend 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. data/.gitignore +6 -0
  2. data/.travis.yml +4 -0
  3. data/Gemfile +6 -0
  4. data/README.rdoc +8 -0
  5. data/Rakefile +18 -0
  6. data/example.rb +51 -0
  7. data/lib/vend.rb +24 -0
  8. data/lib/vend/base.rb +200 -0
  9. data/lib/vend/base_factory.rb +34 -0
  10. data/lib/vend/client.rb +82 -0
  11. data/lib/vend/exception.rb +35 -0
  12. data/lib/vend/http_client.rb +119 -0
  13. data/lib/vend/logable.rb +9 -0
  14. data/lib/vend/null_logger.rb +9 -0
  15. data/lib/vend/pagination_info.rb +30 -0
  16. data/lib/vend/resource/customer.rb +11 -0
  17. data/lib/vend/resource/outlet.rb +7 -0
  18. data/lib/vend/resource/payment_type.rb +7 -0
  19. data/lib/vend/resource/product.rb +12 -0
  20. data/lib/vend/resource/register.rb +7 -0
  21. data/lib/vend/resource/register_sale.rb +19 -0
  22. data/lib/vend/resource/register_sale_product.rb +21 -0
  23. data/lib/vend/resource/tax.rb +7 -0
  24. data/lib/vend/resource/user.rb +7 -0
  25. data/lib/vend/resource_collection.rb +132 -0
  26. data/lib/vend/scope.rb +27 -0
  27. data/lib/vend/version.rb +3 -0
  28. data/spec/integration/customer_spec.rb +33 -0
  29. data/spec/integration/outlet_spec.rb +15 -0
  30. data/spec/integration/payment_types_spec.rb +15 -0
  31. data/spec/integration/product_spec.rb +76 -0
  32. data/spec/integration/register_sale_spec.rb +35 -0
  33. data/spec/integration/register_spec.rb +16 -0
  34. data/spec/integration/tax_spec.rb +16 -0
  35. data/spec/integration/user_spec.rb +16 -0
  36. data/spec/mock_responses/customers.find_by_email.json +44 -0
  37. data/spec/mock_responses/customers.json +20 -0
  38. data/spec/mock_responses/outlets.json +14 -0
  39. data/spec/mock_responses/payment_types.json +7 -0
  40. data/spec/mock_responses/products.active.since.json +184 -0
  41. data/spec/mock_responses/products.json +115 -0
  42. data/spec/mock_responses/products/page/1.json +130 -0
  43. data/spec/mock_responses/products/page/2.json +130 -0
  44. data/spec/mock_responses/register_sales.find_by_state.json +324 -0
  45. data/spec/mock_responses/register_sales.json +158 -0
  46. data/spec/mock_responses/register_sales/2e658bce-9627-bc27-d77d-6c9ba2e8216e.json +158 -0
  47. data/spec/mock_responses/registers.json +32 -0
  48. data/spec/mock_responses/taxes.json +7 -0
  49. data/spec/mock_responses/users.json +17 -0
  50. data/spec/spec_helper.rb +16 -0
  51. data/spec/support/matchers/have_attributes.rb +11 -0
  52. data/spec/support/shared_examples/integration.rb +79 -0
  53. data/spec/support/shared_examples/logger.rb +25 -0
  54. data/spec/vend/base_factory_spec.rb +48 -0
  55. data/spec/vend/base_spec.rb +348 -0
  56. data/spec/vend/client_spec.rb +93 -0
  57. data/spec/vend/http_client_spec.rb +129 -0
  58. data/spec/vend/null_logger_spec.rb +5 -0
  59. data/spec/vend/pagination_info_spec.rb +48 -0
  60. data/spec/vend/resource/register_sale_product_spec.rb +27 -0
  61. data/spec/vend/resource/register_sale_spec.rb +24 -0
  62. data/spec/vend/resource_collection_spec.rb +312 -0
  63. data/spec/vend/scope_spec.rb +41 -0
  64. data/vend.gemspec +26 -0
  65. metadata +179 -0
@@ -0,0 +1,115 @@
1
+ {
2
+ "products" : [ {
3
+ "id": "6cc53042-3d5f-11e0-8697-4040f540b50a",
4
+ "source_id": "",
5
+ "variant_source_id": "",
6
+ "handle": "tshirt",
7
+ "type": "",
8
+ "variant_parent_id": "",
9
+ "variant_option_one_name": "",
10
+ "variant_option_one_value": "",
11
+ "variant_option_two_name": "",
12
+ "variant_option_two_value": "",
13
+ "variant_option_three_name": "",
14
+ "variant_option_three_value": "",
15
+ "active": true,
16
+ "name": "T-shirt (Demo)",
17
+ "description": "T-shirt, white. BTW, you can delete this once you have some other products setup",
18
+ "image": "https:\/\/trineodev.vendhq.com\/images\/no-image.png",
19
+ "image_large": "https:\/\/trineodev.vendhq.com\/images\/no-image.png",
20
+ "sku": "tshirt-white",
21
+ "tags": "General",
22
+ "brand_name": "Generic Brand",
23
+ "supplier_name": "Trineo Dev Account",
24
+ "supplier_code": "",
25
+ "supply_price": "2.00",
26
+ "account_code_purchase": "",
27
+ "account_code_sales": "",
28
+ "inventory": [],
29
+ "price_book_entries": [ {
30
+ "id" : "6cd31874-3d5f-11e0-8697-4040f540b50a",
31
+ "product_id" : "6cc53042-3d5f-11e0-8697-4040f540b50a",
32
+ "price_book_id" : "6cc0a162-3d5f-11e0-8697-4040f540b50a",
33
+ "price_book_name" : "General price book (All)",
34
+ "type" : "BASE",
35
+ "outlet_name" : "",
36
+ "outlet_id" : "",
37
+ "customer_group_name" : "All Customers",
38
+ "customer_group_id" : "6cbee822-3d5f-11e0-8697-4040f540b50a",
39
+ "price" : 4.3,
40
+ "tax" : 0.65,
41
+ "tax_id" : "53b3501c-887c-102d-8a4b-a9cf13f17faa",
42
+ "tax_rate" : "0.15",
43
+ "tax_name" : "NZ GST",
44
+ "display_retail_price_tax_inclusive" : "1",
45
+ "min_units" : "",
46
+ "max_units" : "",
47
+ "valid_from" : "",
48
+ "valid_to" : ""
49
+ }],
50
+ "price": 4.3,
51
+ "tax": 0.65,
52
+ "tax_id": "53b3501c-887c-102d-8a4b-a9cf13f17faa",
53
+ "tax_rate" : 0.15,
54
+ "tax_name" : "NZ GST",
55
+ "display_retail_price_tax_inclusive" : "1",
56
+ "updated_at": "2011-02-21 02:08:07",
57
+ "deleted_at": ""
58
+ }, {
59
+ "id": "6cd62cbc-3d5f-11e0-8697-4040f540b50a",
60
+ "source_id": "",
61
+ "variant_source_id": "",
62
+ "handle": "coffee",
63
+ "type": "",
64
+ "variant_parent_id": "",
65
+ "variant_option_one_name": "",
66
+ "variant_option_one_value": "",
67
+ "variant_option_two_name": "",
68
+ "variant_option_two_value": "",
69
+ "variant_option_three_name": "",
70
+ "variant_option_three_value": "",
71
+ "active": true,
72
+ "name": "Coffee (Demo)",
73
+ "description": "A cup of Coffee. BTW, you can delete this once you have some other products setup",
74
+ "image": "https:\/\/trineodev.vendhq.com\/images\/no-image.png",
75
+ "image_large": "https:\/\/trineodev.vendhq.com\/images\/no-image.png",
76
+ "sku": "coffee-hot",
77
+ "tags": "General",
78
+ "brand_name": "Generic Brand",
79
+ "supplier_name": "Trineo Dev Account",
80
+ "supplier_code": "",
81
+ "supply_price": "0.00",
82
+ "account_code_purchase": "",
83
+ "account_code_sales": "",
84
+ "inventory": [],
85
+ "price_book_entries": [ {
86
+ "id" : "6cdb465c-3d5f-11e0-8697-4040f540b50a",
87
+ "product_id" : "6cd62cbc-3d5f-11e0-8697-4040f540b50a",
88
+ "price_book_id" : "6cc0a162-3d5f-11e0-8697-4040f540b50a",
89
+ "price_book_name" : "General price book (All)",
90
+ "type" : "BASE",
91
+ "outlet_name" : "",
92
+ "outlet_id" : "",
93
+ "customer_group_name" : "All Customers",
94
+ "customer_group_id" : "6cbee822-3d5f-11e0-8697-4040f540b50a",
95
+ "price" : 2.61,
96
+ "tax" : 0.39,
97
+ "tax_id" : "53b3501c-887c-102d-8a4b-a9cf13f17faa",
98
+ "tax_rate" : "0.15",
99
+ "tax_name" : "NZ GST",
100
+ "display_retail_price_tax_inclusive" : "1",
101
+ "min_units" : "",
102
+ "max_units" : "",
103
+ "valid_from" : "",
104
+ "valid_to" : ""
105
+ }],
106
+ "price": 2.61,
107
+ "tax": 0.39,
108
+ "tax_id": "53b3501c-887c-102d-8a4b-a9cf13f17faa",
109
+ "tax_rate" : 0.15,
110
+ "tax_name" : "NZ GST",
111
+ "display_retail_price_tax_inclusive" : "1",
112
+ "updated_at": "2011-02-21 02:08:07",
113
+ "deleted_at": ""
114
+ } ]
115
+ }
@@ -0,0 +1,130 @@
1
+ {
2
+ "pagination": {
3
+ "results": 4,
4
+ "page": 1,
5
+ "page_size": 2,
6
+ "pages": 2
7
+ },
8
+ "products" : [
9
+ {
10
+ "variant_option_three_value" : "",
11
+ "variant_option_three_name" : "",
12
+ "account_code_purchase" : "",
13
+ "id" : "4ac27543-94b2-11e1-9ffa-4040dde94e2e",
14
+ "variant_source_id" : "",
15
+ "variant_option_two_value" : "",
16
+ "image_large" : "https://trineodev.vendhq.com/images/placeholder/product/no-image-white-original.png",
17
+ "source_id" : "",
18
+ "brand_name" : "",
19
+ "active" : true,
20
+ "name" : "6 Pack Coffee",
21
+ "description" : "",
22
+ "price_book_entries" : [
23
+ {
24
+ "valid_from" : "",
25
+ "max_units" : "",
26
+ "product_id" : "4ac27543-94b2-11e1-9ffa-4040dde94e2e",
27
+ "customer_group_id" : "6cbee822-3d5f-11e0-8697-4040f540b50a",
28
+ "id" : "4ae383cd-94b2-11e1-9ffa-4040dde94e2e",
29
+ "valid_to" : "",
30
+ "outlet_id" : "",
31
+ "display_retail_price_tax_inclusive" : "1",
32
+ "price_book_name" : "General price book (All)",
33
+ "tax" : 2.35,
34
+ "outlet_name" : "",
35
+ "customer_group_name" : "All Customers",
36
+ "tax_rate" : "0.15",
37
+ "price_book_id" : "6cc0a162-3d5f-11e0-8697-4040f540b50a",
38
+ "tax_id" : "53b3501c-887c-102d-8a4b-a9cf13f17faa",
39
+ "type" : "BASE",
40
+ "price" : 15.65,
41
+ "tax_name" : "NZ GST",
42
+ "min_units" : ""
43
+ }
44
+ ],
45
+ "tax_rate" : 0.15,
46
+ "handle" : "6PackCoffee",
47
+ "updated_at" : "2012-05-02 23:55:10",
48
+ "price" : 15.65,
49
+ "type" : "",
50
+ "account_code_sales" : "",
51
+ "sku" : "10002",
52
+ "brand_id" : "",
53
+ "variant_option_one_name" : "",
54
+ "supplier_code" : "",
55
+ "inventory" : [],
56
+ "supply_price" : "0.00",
57
+ "display_retail_price_tax_inclusive" : "1",
58
+ "tax" : 2.35,
59
+ "tags" : "",
60
+ "image" : "https://trineodev.vendhq.com/images/placeholder/product/no-image-white-thumb.png",
61
+ "variant_option_one_value" : "",
62
+ "supplier_name" : "",
63
+ "deleted_at" : "",
64
+ "variant_parent_id" : "",
65
+ "tax_id" : "53b3501c-887c-102d-8a4b-a9cf13f17faa",
66
+ "tax_name" : "NZ GST",
67
+ "variant_option_two_name" : ""
68
+ },
69
+ {
70
+ "variant_option_three_value" : "Red",
71
+ "variant_option_three_name" : "Colour",
72
+ "account_code_purchase" : "",
73
+ "id" : "4b44588b-94b2-11e1-9ffa-4040dde94e2e",
74
+ "variant_source_id" : "",
75
+ "variant_option_two_value" : "",
76
+ "image_large" : "https://trineodev.vendhq.com/images/placeholder/product/no-image-white-original.png",
77
+ "source_id" : "",
78
+ "brand_name" : "My Coffee Shop",
79
+ "active" : true,
80
+ "name" : "Bacon and Eggs / Large / Red",
81
+ "description" : "<p>Middle bacon with 2 freerange eggs cooked in your style on multi grain bread</p>",
82
+ "price_book_entries" : [
83
+ {
84
+ "valid_from" : "",
85
+ "max_units" : "",
86
+ "product_id" : "4b44588b-94b2-11e1-9ffa-4040dde94e2e",
87
+ "customer_group_id" : "6cbee822-3d5f-11e0-8697-4040f540b50a",
88
+ "id" : "4b6eb246-94b2-11e1-9ffa-4040dde94e2e",
89
+ "valid_to" : "",
90
+ "outlet_id" : "",
91
+ "display_retail_price_tax_inclusive" : "1",
92
+ "price_book_name" : "General price book (All)",
93
+ "tax" : 3.85,
94
+ "outlet_name" : "",
95
+ "customer_group_name" : "All Customers",
96
+ "tax_rate" : "0.15",
97
+ "price_book_id" : "6cc0a162-3d5f-11e0-8697-4040f540b50a",
98
+ "tax_id" : "53b3501c-887c-102d-8a4b-a9cf13f17faa",
99
+ "type" : "BASE",
100
+ "price" : 25.69,
101
+ "tax_name" : "NZ GST",
102
+ "min_units" : ""
103
+ }
104
+ ],
105
+ "tax_rate" : 0.15,
106
+ "handle" : "1204",
107
+ "updated_at" : "2012-05-02 23:55:11",
108
+ "price" : 25.69,
109
+ "type" : "General",
110
+ "account_code_sales" : "",
111
+ "sku" : "1204",
112
+ "brand_id" : "4b2cb818-94b2-11e1-9ffa-4040dde94e2e",
113
+ "variant_option_one_name" : "Color",
114
+ "supplier_code" : "BDVT",
115
+ "inventory" : [],
116
+ "supply_price" : "0.00",
117
+ "display_retail_price_tax_inclusive" : "1",
118
+ "tax" : 3.85,
119
+ "tags" : "Brunch, Breakfast, Cabinet, Bacon and Eggs",
120
+ "image" : "https://trineodev.vendhq.com/images/placeholder/product/no-image-white-thumb.png",
121
+ "variant_option_one_value" : "Large",
122
+ "supplier_name" : "Bidvest",
123
+ "deleted_at" : "",
124
+ "variant_parent_id" : "",
125
+ "tax_id" : "53b3501c-887c-102d-8a4b-a9cf13f17faa",
126
+ "tax_name" : "NZ GST",
127
+ "variant_option_two_name" : ""
128
+ }
129
+ ]
130
+ }
@@ -0,0 +1,130 @@
1
+ {
2
+ "pagination": {
3
+ "results": 4,
4
+ "page": 2,
5
+ "page_size": 2,
6
+ "pages": 2
7
+ },
8
+ "products" : [
9
+ {
10
+ "variant_option_three_value" : "Red",
11
+ "variant_option_three_name" : "Colour",
12
+ "account_code_purchase" : "",
13
+ "id" : "4b7edbf7-94b2-11e1-9ffa-4040dde94e2e",
14
+ "variant_source_id" : "",
15
+ "variant_option_two_value" : "",
16
+ "image_large" : "https://trineodev.vendhq.com/images/placeholder/product/no-image-white-original.png",
17
+ "source_id" : "",
18
+ "brand_name" : "My Coffee Shop",
19
+ "active" : true,
20
+ "name" : "Bacon and Eggs / Large / Red",
21
+ "description" : "<p>Middle bacon with 2 freerange eggs cooked in your style on multi grain bread</p>",
22
+ "price_book_entries" : [
23
+ {
24
+ "valid_from" : "",
25
+ "max_units" : "",
26
+ "product_id" : "4b7edbf7-94b2-11e1-9ffa-4040dde94e2e",
27
+ "customer_group_id" : "6cbee822-3d5f-11e0-8697-4040f540b50a",
28
+ "id" : "4b8ac949-94b2-11e1-9ffa-4040dde94e2e",
29
+ "valid_to" : "",
30
+ "outlet_id" : "",
31
+ "display_retail_price_tax_inclusive" : "1",
32
+ "price_book_name" : "General price book (All)",
33
+ "tax" : 3.85,
34
+ "outlet_name" : "",
35
+ "customer_group_name" : "All Customers",
36
+ "tax_rate" : "0.15",
37
+ "price_book_id" : "6cc0a162-3d5f-11e0-8697-4040f540b50a",
38
+ "tax_id" : "53b3501c-887c-102d-8a4b-a9cf13f17faa",
39
+ "type" : "BASE",
40
+ "price" : 25.69,
41
+ "tax_name" : "NZ GST",
42
+ "min_units" : ""
43
+ }
44
+ ],
45
+ "tax_rate" : 0.15,
46
+ "handle" : "1204",
47
+ "updated_at" : "2012-05-02 23:55:11",
48
+ "price" : 25.69,
49
+ "type" : "General",
50
+ "account_code_sales" : "",
51
+ "sku" : "1204s",
52
+ "brand_id" : "4b2cb818-94b2-11e1-9ffa-4040dde94e2e",
53
+ "variant_option_one_name" : "Color",
54
+ "supplier_code" : "",
55
+ "inventory" : [],
56
+ "supply_price" : "0.00",
57
+ "display_retail_price_tax_inclusive" : "1",
58
+ "tax" : 3.85,
59
+ "tags" : "",
60
+ "image" : "https://trineodev.vendhq.com/images/placeholder/product/no-image-white-thumb.png",
61
+ "variant_option_one_value" : "Large",
62
+ "supplier_name" : "Bidvest",
63
+ "deleted_at" : "",
64
+ "variant_parent_id" : "4b44588b-94b2-11e1-9ffa-4040dde94e2e",
65
+ "tax_id" : "53b3501c-887c-102d-8a4b-a9cf13f17faa",
66
+ "tax_name" : "NZ GST",
67
+ "variant_option_two_name" : ""
68
+ },
69
+ {
70
+ "variant_option_three_value" : "Purple",
71
+ "variant_option_three_name" : "Colour",
72
+ "account_code_purchase" : "",
73
+ "id" : "4b9c5b95-94b2-11e1-9ffa-4040dde94e2e",
74
+ "variant_source_id" : "",
75
+ "variant_option_two_value" : "",
76
+ "image_large" : "https://trineodev.vendhq.com/images/placeholder/product/no-image-white-original.png",
77
+ "source_id" : "",
78
+ "brand_name" : "My Coffee Shop",
79
+ "active" : true,
80
+ "name" : "Bacon and Eggs / XLarge / Purple",
81
+ "description" : "<p>Middle bacon with 2 freerange eggs cooked in your style on multi grain bread</p>",
82
+ "price_book_entries" : [
83
+ {
84
+ "valid_from" : "",
85
+ "max_units" : "",
86
+ "product_id" : "4b9c5b95-94b2-11e1-9ffa-4040dde94e2e",
87
+ "customer_group_id" : "6cbee822-3d5f-11e0-8697-4040f540b50a",
88
+ "id" : "4babd1c8-94b2-11e1-9ffa-4040dde94e2e",
89
+ "valid_to" : "",
90
+ "outlet_id" : "",
91
+ "display_retail_price_tax_inclusive" : "1",
92
+ "price_book_name" : "General price book (All)",
93
+ "tax" : 3.85,
94
+ "outlet_name" : "",
95
+ "customer_group_name" : "All Customers",
96
+ "tax_rate" : "0.15",
97
+ "price_book_id" : "6cc0a162-3d5f-11e0-8697-4040f540b50a",
98
+ "tax_id" : "53b3501c-887c-102d-8a4b-a9cf13f17faa",
99
+ "type" : "BASE",
100
+ "price" : 25.69,
101
+ "tax_name" : "NZ GST",
102
+ "min_units" : ""
103
+ }
104
+ ],
105
+ "tax_rate" : 0.15,
106
+ "handle" : "1204",
107
+ "updated_at" : "2012-05-02 23:55:11",
108
+ "price" : 25.69,
109
+ "type" : "General",
110
+ "account_code_sales" : "",
111
+ "sku" : "1204-XLarge-Purple",
112
+ "brand_id" : "4b2cb818-94b2-11e1-9ffa-4040dde94e2e",
113
+ "variant_option_one_name" : "Color",
114
+ "supplier_code" : "",
115
+ "inventory" : [],
116
+ "supply_price" : "0.00",
117
+ "display_retail_price_tax_inclusive" : "1",
118
+ "tax" : 3.85,
119
+ "tags" : "",
120
+ "image" : "https://trineodev.vendhq.com/images/placeholder/product/no-image-white-thumb.png",
121
+ "variant_option_one_value" : "XLarge",
122
+ "supplier_name" : "Bidvest",
123
+ "deleted_at" : "",
124
+ "variant_parent_id" : "4b44588b-94b2-11e1-9ffa-4040dde94e2e",
125
+ "tax_id" : "53b3501c-887c-102d-8a4b-a9cf13f17faa",
126
+ "tax_name" : "NZ GST",
127
+ "variant_option_two_name" : ""
128
+ }
129
+ ]
130
+ }
@@ -0,0 +1,324 @@
1
+ {
2
+ "register_sales" : [ { "id": "8dd57077-c158-f7db-d582-6785f43c9d72",
3
+ "register_id": "6cbe2342-3d5f-11e0-8697-4040f540b50a",
4
+ "market_id": "1",
5
+ "customer_id": "6cbfbc20-3d5f-11e0-8697-4040f540b50a",
6
+ "customer_name": "",
7
+ "customer": {
8
+ "id": "6cbfbc20-3d5f-11e0-8697-4040f540b50a",
9
+ "name": "",
10
+ "customer_code": "WALKIN",
11
+ "customer_group_id": "6cbee822-3d5f-11e0-8697-4040f540b50a",
12
+ "customer_group_name": "All Customers",
13
+ "updated_at": "2012-02-24 00:25:56",
14
+ "deleted_at": "",
15
+ "balance": "0.000",
16
+ "year_to_date": "41.70000",
17
+ "points": "0",
18
+ "custom_field_1": "",
19
+ "custom_field_2": "",
20
+ "custom_field_3": "",
21
+ "custom_field_4": "",
22
+ "contact": {
23
+ }
24
+ },
25
+ "user_id": "85b7853a-52cd-11e1-8cd4-4040dde94e2e",
26
+ "user_name": "greg.signal@trineo.co.nz",
27
+ "sale_date": "2012-02-24 00:25:52",
28
+ "created_at": "2012-02-24 00:25:55",
29
+ "updated_at": "2012-02-24 00:25:55",
30
+ "total_price": 8.6,
31
+ "total_tax": 1.3,
32
+ "tax_name": "NZ GST",
33
+ "note": "",
34
+ "status": "CLOSED",
35
+ "short_code": "w6645",
36
+ "invoice_number": "3",
37
+ "register_sale_products": [ {
38
+ "id" :"e2cddc09-995a-ce74-777f-b5641837dc1f",
39
+ "product_id" :"6cc53042-3d5f-11e0-8697-4040f540b50a",
40
+ "register_id" :"6cbe2342-3d5f-11e0-8697-4040f540b50a",
41
+ "sequence" :"0",
42
+ "handle" :"tshirt",
43
+ "sku" :"tshirt-white",
44
+ "name" :"T-shirt (Demo)",
45
+ "quantity" : 1,
46
+ "price" : 4.3,
47
+ "price_set" : 0,
48
+ "tax" : 0.65,
49
+ "tax_id" : "53b3501c-887c-102d-8a4b-a9cf13f17faa",
50
+ "tax_rate" : 0.15,
51
+ "tax_total" : 0.65,
52
+ "price_total" : 4.3,
53
+ "display_retail_price_tax_inclusive" : "1",
54
+ "status" : "CONFIRMED"
55
+ }, {
56
+ "id" :"7d073c32-d5fe-f00d-239d-99f9babfe965",
57
+ "product_id" :"6cc53042-3d5f-11e0-8697-4040f540b50a",
58
+ "register_id" :"6cbe2342-3d5f-11e0-8697-4040f540b50a",
59
+ "sequence" :"1",
60
+ "handle" :"tshirt",
61
+ "sku" :"tshirt-white",
62
+ "name" :"T-shirt (Demo)",
63
+ "quantity" : 1,
64
+ "price" : 4.3,
65
+ "price_set" : 0,
66
+ "tax" : 0.65,
67
+ "tax_id" : "53b3501c-887c-102d-8a4b-a9cf13f17faa",
68
+ "tax_rate" : 0.15,
69
+ "tax_total" : 0.65,
70
+ "price_total" : 4.3,
71
+ "display_retail_price_tax_inclusive" : "1",
72
+ "status" : "CONFIRMED"
73
+ } ],
74
+ "totals": { "total_tax" : 1.3,
75
+ "total_price" : 8.6,
76
+ "total_payment" : 9.9,
77
+ "total_to_pay" : 0 },
78
+ "register_sale_payments" : [ {"id" : "45bf5bc7-8379-7c89-19c0-4e551a3b2dac",
79
+ "payment_type_id" : "1",
80
+ "register_id" : "",
81
+ "retailer_payment_type_id" : "6cde3ba0-3d5f-11e0-8697-4040f540b50a",
82
+ "name" : "Cash",
83
+ "payment_date" : "2012-02-24 00:25:51",
84
+ "amount" : 9.9} ]
85
+ }, { "id": "2e658bce-9627-bc27-d77d-6c9ba2e8216e",
86
+ "register_id": "6cbe2342-3d5f-11e0-8697-4040f540b50a",
87
+ "market_id": "1",
88
+ "customer_id": "6cbfbc20-3d5f-11e0-8697-4040f540b50a",
89
+ "customer_name": "",
90
+ "customer": {
91
+ "id": "6cbfbc20-3d5f-11e0-8697-4040f540b50a",
92
+ "name": "",
93
+ "customer_code": "WALKIN",
94
+ "customer_group_id": "6cbee822-3d5f-11e0-8697-4040f540b50a",
95
+ "customer_group_name": "All Customers",
96
+ "updated_at": "2012-02-24 00:25:56",
97
+ "deleted_at": "",
98
+ "balance": "0.000",
99
+ "year_to_date": "41.70000",
100
+ "points": "0",
101
+ "custom_field_1": "",
102
+ "custom_field_2": "",
103
+ "custom_field_3": "",
104
+ "custom_field_4": "",
105
+ "contact": {
106
+ }
107
+ },
108
+ "user_id": "85b7853a-52cd-11e1-8cd4-4040dde94e2e",
109
+ "user_name": "greg.signal@trineo.co.nz",
110
+ "sale_date": "2012-02-24 00:25:41",
111
+ "created_at": "2012-02-24 00:25:45",
112
+ "updated_at": "2012-02-24 00:25:45",
113
+ "total_price": 6.91,
114
+ "total_tax": 1.04,
115
+ "tax_name": "NZ GST",
116
+ "note": "",
117
+ "status": "CLOSED",
118
+ "short_code": "fbhjk",
119
+ "invoice_number": "2",
120
+ "register_sale_products": [ {
121
+ "id" :"b12a2ffb-02b0-0bef-408d-0c5f1affc18a",
122
+ "product_id" :"6cc53042-3d5f-11e0-8697-4040f540b50a",
123
+ "register_id" :"6cbe2342-3d5f-11e0-8697-4040f540b50a",
124
+ "sequence" :"0",
125
+ "handle" :"tshirt",
126
+ "sku" :"tshirt-white",
127
+ "name" :"T-shirt (Demo)",
128
+ "quantity" : 1,
129
+ "price" : 4.3,
130
+ "price_set" : 0,
131
+ "tax" : 0.65,
132
+ "tax_id" : "53b3501c-887c-102d-8a4b-a9cf13f17faa",
133
+ "tax_rate" : 0.15,
134
+ "tax_total" : 0.65,
135
+ "price_total" : 4.3,
136
+ "display_retail_price_tax_inclusive" : "1",
137
+ "status" : "CONFIRMED"
138
+ }, {
139
+ "id" :"ad4b20b8-c7e7-ad95-651f-ebfde0387045",
140
+ "product_id" :"6cd62cbc-3d5f-11e0-8697-4040f540b50a",
141
+ "register_id" :"6cbe2342-3d5f-11e0-8697-4040f540b50a",
142
+ "sequence" :"1",
143
+ "handle" :"coffee",
144
+ "sku" :"coffee-hot",
145
+ "name" :"Coffee (Demo)",
146
+ "quantity" : 1,
147
+ "price" : 2.61,
148
+ "price_set" : 0,
149
+ "tax" : 0.39,
150
+ "tax_id" : "53b3501c-887c-102d-8a4b-a9cf13f17faa",
151
+ "tax_rate" : 0.15,
152
+ "tax_total" : 0.39,
153
+ "price_total" : 2.61,
154
+ "display_retail_price_tax_inclusive" : "1",
155
+ "status" : "CONFIRMED"
156
+ } ],
157
+ "totals": { "total_tax" : 1.04,
158
+ "total_price" : 6.91,
159
+ "total_payment" : 7.95,
160
+ "total_to_pay" : 0 },
161
+ "register_sale_payments" : [ {"id" : "c3aea28a-8103-b204-a4ba-8e6e517931df",
162
+ "payment_type_id" : "1",
163
+ "register_id" : "",
164
+ "retailer_payment_type_id" : "6cde3ba0-3d5f-11e0-8697-4040f540b50a",
165
+ "name" : "Cash",
166
+ "payment_date" : "2012-02-24 00:25:41",
167
+ "amount" : 7.95} ]
168
+ }, { "id": "98ce3dbf-e862-c811-fa93-10f6db3a8f66",
169
+ "register_id": "6cbe2342-3d5f-11e0-8697-4040f540b50a",
170
+ "market_id": "1",
171
+ "customer_id": "6cbfbc20-3d5f-11e0-8697-4040f540b50a",
172
+ "customer_name": "",
173
+ "customer": {
174
+ "id": "6cbfbc20-3d5f-11e0-8697-4040f540b50a",
175
+ "name": "",
176
+ "customer_code": "WALKIN",
177
+ "customer_group_id": "6cbee822-3d5f-11e0-8697-4040f540b50a",
178
+ "customer_group_name": "All Customers",
179
+ "updated_at": "2012-02-24 00:25:56",
180
+ "deleted_at": "",
181
+ "balance": "0.000",
182
+ "year_to_date": "41.70000",
183
+ "points": "0",
184
+ "custom_field_1": "",
185
+ "custom_field_2": "",
186
+ "custom_field_3": "",
187
+ "custom_field_4": "",
188
+ "contact": {
189
+ }
190
+ },
191
+ "user_id": "85b7853a-52cd-11e1-8cd4-4040dde94e2e",
192
+ "user_name": "greg.signal@trineo.co.nz",
193
+ "sale_date": "2012-02-15 23:33:57",
194
+ "created_at": "2012-02-15 23:34:15",
195
+ "updated_at": "2012-02-15 23:34:15",
196
+ "total_price": 20.73,
197
+ "total_tax": 3.12,
198
+ "tax_name": "NZ GST",
199
+ "note": "",
200
+ "status": "CLOSED",
201
+ "short_code": "80smy",
202
+ "invoice_number": "2",
203
+ "register_sale_products": [ {
204
+ "id" :"80730b76-94ef-7677-50b3-0802ad448819",
205
+ "product_id" :"6cd62cbc-3d5f-11e0-8697-4040f540b50a",
206
+ "register_id" :"6cbe2342-3d5f-11e0-8697-4040f540b50a",
207
+ "sequence" :"0",
208
+ "handle" :"coffee",
209
+ "sku" :"coffee-hot",
210
+ "name" :"Coffee (Demo)",
211
+ "quantity" : 1,
212
+ "price" : 2.61,
213
+ "price_set" : 0,
214
+ "tax" : 0.39,
215
+ "tax_id" : "53b3501c-887c-102d-8a4b-a9cf13f17faa",
216
+ "tax_rate" : 0.15,
217
+ "tax_total" : 0.39,
218
+ "price_total" : 2.61,
219
+ "display_retail_price_tax_inclusive" : "1",
220
+ "status" : "CONFIRMED"
221
+ }, {
222
+ "id" :"e3b1fbd7-6942-00b4-776b-77374277eda3",
223
+ "product_id" :"6cd62cbc-3d5f-11e0-8697-4040f540b50a",
224
+ "register_id" :"6cbe2342-3d5f-11e0-8697-4040f540b50a",
225
+ "sequence" :"0",
226
+ "handle" :"coffee",
227
+ "sku" :"coffee-hot",
228
+ "name" :"Coffee (Demo)",
229
+ "quantity" : 1,
230
+ "price" : 2.61,
231
+ "price_set" : 0,
232
+ "tax" : 0.39,
233
+ "tax_id" : "53b3501c-887c-102d-8a4b-a9cf13f17faa",
234
+ "tax_rate" : 0.15,
235
+ "tax_total" : 0.39,
236
+ "price_total" : 2.61,
237
+ "display_retail_price_tax_inclusive" : "1",
238
+ "status" : "CONFIRMED"
239
+ }, {
240
+ "id" :"251ee7b5-5ac7-1a18-a467-7527a5b54406",
241
+ "product_id" :"6cc53042-3d5f-11e0-8697-4040f540b50a",
242
+ "register_id" :"6cbe2342-3d5f-11e0-8697-4040f540b50a",
243
+ "sequence" :"1",
244
+ "handle" :"tshirt",
245
+ "sku" :"tshirt-white",
246
+ "name" :"T-shirt (Demo)",
247
+ "quantity" : 1,
248
+ "price" : 4.3,
249
+ "price_set" : 0,
250
+ "tax" : 0.65,
251
+ "tax_id" : "53b3501c-887c-102d-8a4b-a9cf13f17faa",
252
+ "tax_rate" : 0.15,
253
+ "tax_total" : 0.65,
254
+ "price_total" : 4.3,
255
+ "display_retail_price_tax_inclusive" : "1",
256
+ "status" : "CONFIRMED"
257
+ }, {
258
+ "id" :"17199ec2-db5a-dec5-c483-015fbb92a5a5",
259
+ "product_id" :"6cc53042-3d5f-11e0-8697-4040f540b50a",
260
+ "register_id" :"6cbe2342-3d5f-11e0-8697-4040f540b50a",
261
+ "sequence" :"2",
262
+ "handle" :"tshirt",
263
+ "sku" :"tshirt-white",
264
+ "name" :"T-shirt (Demo)",
265
+ "quantity" : 1,
266
+ "price" : 4.3,
267
+ "price_set" : 0,
268
+ "tax" : 0.65,
269
+ "tax_id" : "53b3501c-887c-102d-8a4b-a9cf13f17faa",
270
+ "tax_rate" : 0.15,
271
+ "tax_total" : 0.65,
272
+ "price_total" : 4.3,
273
+ "display_retail_price_tax_inclusive" : "1",
274
+ "status" : "CONFIRMED"
275
+ }, {
276
+ "id" :"40feb90b-dffb-957c-0227-f552cefb2370",
277
+ "product_id" :"6cc53042-3d5f-11e0-8697-4040f540b50a",
278
+ "register_id" :"6cbe2342-3d5f-11e0-8697-4040f540b50a",
279
+ "sequence" :"3",
280
+ "handle" :"tshirt",
281
+ "sku" :"tshirt-white",
282
+ "name" :"T-shirt (Demo)",
283
+ "quantity" : 1,
284
+ "price" : 4.3,
285
+ "price_set" : 0,
286
+ "tax" : 0.65,
287
+ "tax_id" : "53b3501c-887c-102d-8a4b-a9cf13f17faa",
288
+ "tax_rate" : 0.15,
289
+ "tax_total" : 0.65,
290
+ "price_total" : 4.3,
291
+ "display_retail_price_tax_inclusive" : "1",
292
+ "status" : "CONFIRMED"
293
+ }, {
294
+ "id" :"81a03160-eac3-eb97-f43a-a4c1297ad330",
295
+ "product_id" :"6cd62cbc-3d5f-11e0-8697-4040f540b50a",
296
+ "register_id" :"6cbe2342-3d5f-11e0-8697-4040f540b50a",
297
+ "sequence" :"4",
298
+ "handle" :"coffee",
299
+ "sku" :"coffee-hot",
300
+ "name" :"Coffee (Demo)",
301
+ "quantity" : 1,
302
+ "price" : 2.61,
303
+ "price_set" : 0,
304
+ "tax" : 0.39,
305
+ "tax_id" : "53b3501c-887c-102d-8a4b-a9cf13f17faa",
306
+ "tax_rate" : 0.15,
307
+ "tax_total" : 0.39,
308
+ "price_total" : 2.61,
309
+ "display_retail_price_tax_inclusive" : "1",
310
+ "status" : "CONFIRMED"
311
+ } ],
312
+ "totals": { "total_tax" : 3.12,
313
+ "total_price" : 20.73,
314
+ "total_payment" : 23.85,
315
+ "total_to_pay" : 0 },
316
+ "register_sale_payments" : [ {"id" : "23d8f36f-500c-ac6f-cd68-465ae4ed96e1",
317
+ "payment_type_id" : "1",
318
+ "register_id" : "",
319
+ "retailer_payment_type_id" : "6cde3ba0-3d5f-11e0-8697-4040f540b50a",
320
+ "name" : "Cash",
321
+ "payment_date" : "2012-02-15 23:33:56",
322
+ "amount" : 23.85} ]
323
+ } ]
324
+ }