xpost 0.1.22 → 0.1.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/TODO.md +28 -1
- data/lib/.DS_Store +0 -0
- data/lib/xpost.rb +8 -6
- data/lib/xpost/.DS_Store +0 -0
- data/lib/xpost/address.rb +77 -0
- data/lib/xpost/authentication.rb +5 -0
- data/lib/xpost/configuration.rb +15 -0
- data/lib/xpost/item.rb +44 -0
- data/lib/xpost/order.rb +137 -0
- data/lib/xpost/orders.rb +53 -12
- data/lib/xpost/statuses.rb +29 -0
- data/lib/xpost/version.rb +1 -1
- data/sample/sample_essential_order_details.json +64 -0
- data/sample/sample_xpost_order-confirmed.json +317 -0
- data/sample/sample_xpost_order-for-pickup.json +379 -0
- data/sample/sample_xpost_order-pending.json +306 -0
- data/sample/webhook_sample.json +105 -0
- data/spec/factories/addresses.rb +46 -28
- data/spec/factories/items.rb +10 -10
- data/spec/factories/orders.rb +39 -16
- data/spec/{address_spec.rb → order/address/address_spec.rb} +0 -0
- data/spec/order/cancel_spec.rb +37 -0
- data/spec/order/confirm_spec.rb +38 -0
- data/spec/order/create_spec.rb +97 -0
- data/spec/order/for_pickup_spec.rb +42 -0
- data/spec/order/get_shipping_label_spec.rb +60 -0
- data/spec/{item_spec.rb → order/items/item_spec.rb} +5 -5
- data/spec/order/order_spec.rb +97 -0
- data/spec/orders/{orders_find_spec.rb → find_spec.rb} +3 -2
- data/spec/orders/{orders_track_spec.rb → track_spec.rb} +2 -2
- data/spec/spec_helper.rb +1 -0
- data/spec/xpost_spec.rb +27 -0
- data/xpost.gemspec +3 -0
- metadata +64 -12
- data/lib/xpost/models.rb +0 -5
- data/lib/xpost/models/address.rb +0 -38
- data/lib/xpost/models/item.rb +0 -31
- data/lib/xpost/models/order.rb +0 -54
- data/spec/line_item_spec.rb +0 -16
- data/spec/orders/order_create_spec.rb +0 -46
- data/spec/orders/order_for_pickup_spec.rb +0 -17
@@ -0,0 +1,306 @@
|
|
1
|
+
{
|
2
|
+
"id": 789566,
|
3
|
+
"party_id": 6191,
|
4
|
+
"service_id": 6191,
|
5
|
+
"currency": "PHP",
|
6
|
+
"reference_id": "2309174223312",
|
7
|
+
"tracking_number": "0078-9566-ABLV",
|
8
|
+
"payment_method": "cod",
|
9
|
+
"payment_provider": "lbcx",
|
10
|
+
"service": "next_day",
|
11
|
+
"status": "for_pickup",
|
12
|
+
"status_updated_at": "2018-08-13 11:52:15.948365+00",
|
13
|
+
"buyer_name": "Thea Lizardo",
|
14
|
+
"email": "thealizardo@gmail.com",
|
15
|
+
"contact_number": "+639176788488",
|
16
|
+
"subtotal": "1750.00",
|
17
|
+
"tax": "0.00",
|
18
|
+
"fee": "0.00",
|
19
|
+
"insurance": "0.00",
|
20
|
+
"discount": "0.00",
|
21
|
+
"shipping": "0.00",
|
22
|
+
"total": "1750.00",
|
23
|
+
"transaction_fee": "61.25",
|
24
|
+
"insurance_fee": "17.50",
|
25
|
+
"shipping_fee": "240.00",
|
26
|
+
"metadata": {
|
27
|
+
"key_1": "value_1",
|
28
|
+
"key_2": "value_2"
|
29
|
+
},
|
30
|
+
"preferred_pickup_time": "morning",
|
31
|
+
"preferred_delivery_time": "3pm - 5pm",
|
32
|
+
"created_at": "2018-08-13 11:52:15+00",
|
33
|
+
"tat": {
|
34
|
+
"for_pickup": 1534161135
|
35
|
+
},
|
36
|
+
"shipment": "box",
|
37
|
+
"remarks": null,
|
38
|
+
"buyer_id": "12345",
|
39
|
+
"parcel": {
|
40
|
+
"weight": {
|
41
|
+
"uom": "kg",
|
42
|
+
"value": "4"
|
43
|
+
},
|
44
|
+
"dimensions": {
|
45
|
+
"uom": "cm",
|
46
|
+
"width": 22,
|
47
|
+
"height": 22,
|
48
|
+
"length": 22
|
49
|
+
}
|
50
|
+
},
|
51
|
+
"updated_at": "2018-08-13 11:52:16+00",
|
52
|
+
"client": "Xpanse",
|
53
|
+
"organization": {
|
54
|
+
"party_id": 6191,
|
55
|
+
"name": "Xpanse",
|
56
|
+
"external_id": null
|
57
|
+
},
|
58
|
+
"pickup_address": {
|
59
|
+
"id": 1600969,
|
60
|
+
"code": null,
|
61
|
+
"name": "Thea Lizardo",
|
62
|
+
"title": null,
|
63
|
+
"email": null,
|
64
|
+
"phone_number": "",
|
65
|
+
"mobile_number": "+639171234567",
|
66
|
+
"fax_number": null,
|
67
|
+
"company": "xpanse",
|
68
|
+
"line_1": "Payless Warehouse",
|
69
|
+
"line_2": "",
|
70
|
+
"district": null,
|
71
|
+
"city": "Paranaque City",
|
72
|
+
"state": "Metro Manila",
|
73
|
+
"postal_code": "1634",
|
74
|
+
"region": "Mmb",
|
75
|
+
"country": {
|
76
|
+
"code": "PH",
|
77
|
+
"name": "Philippines"
|
78
|
+
},
|
79
|
+
"city_approximation": "Paranaque City",
|
80
|
+
"branch_code": null
|
81
|
+
},
|
82
|
+
"delivery_address": {
|
83
|
+
"id": 1600609,
|
84
|
+
"code": null,
|
85
|
+
"name": "Thea Lizardo",
|
86
|
+
"title": null,
|
87
|
+
"email": null,
|
88
|
+
"phone_number": "",
|
89
|
+
"mobile_number": "+639171234567",
|
90
|
+
"fax_number": null,
|
91
|
+
"company": "",
|
92
|
+
"line_1": "Payless Warehouse",
|
93
|
+
"line_2": "",
|
94
|
+
"district": null,
|
95
|
+
"city": "Paranaque City",
|
96
|
+
"state": "Metro Manila",
|
97
|
+
"postal_code": "1634",
|
98
|
+
"region": "Mmb",
|
99
|
+
"country": {
|
100
|
+
"code": "PH",
|
101
|
+
"name": "Philippines"
|
102
|
+
},
|
103
|
+
"city_approximation": "Paranaque City"
|
104
|
+
},
|
105
|
+
"return_address": {
|
106
|
+
"id": null,
|
107
|
+
"code": null,
|
108
|
+
"name": null,
|
109
|
+
"title": null,
|
110
|
+
"email": null,
|
111
|
+
"phone_number": null,
|
112
|
+
"mobile_number": null,
|
113
|
+
"fax_number": null,
|
114
|
+
"company": null,
|
115
|
+
"line_1": null,
|
116
|
+
"line_2": null,
|
117
|
+
"district": null,
|
118
|
+
"city": null,
|
119
|
+
"state": null,
|
120
|
+
"postal_code": null,
|
121
|
+
"region": null,
|
122
|
+
"country": {
|
123
|
+
"code": null,
|
124
|
+
"name": null
|
125
|
+
}
|
126
|
+
},
|
127
|
+
"dropoff_address": {
|
128
|
+
"id": null,
|
129
|
+
"code": null,
|
130
|
+
"name": null,
|
131
|
+
"title": null,
|
132
|
+
"email": null,
|
133
|
+
"phone_number": null,
|
134
|
+
"mobile_number": null,
|
135
|
+
"fax_number": null,
|
136
|
+
"company": null,
|
137
|
+
"line_1": null,
|
138
|
+
"line_2": null,
|
139
|
+
"district": null,
|
140
|
+
"city": null,
|
141
|
+
"state": null,
|
142
|
+
"postal_code": null,
|
143
|
+
"region": null,
|
144
|
+
"country": {
|
145
|
+
"code": null,
|
146
|
+
"name": null
|
147
|
+
}
|
148
|
+
},
|
149
|
+
"charge": {
|
150
|
+
"order_id": 789566,
|
151
|
+
"status": "pending",
|
152
|
+
"reference_id": "71001373530487",
|
153
|
+
"total_amount": "1750.00",
|
154
|
+
"tendered_amount": "0.00",
|
155
|
+
"change_amount": "0.00",
|
156
|
+
"remarks": null,
|
157
|
+
"created_at": "2018-08-13 11:52:15+00",
|
158
|
+
"updated_at": "2018-08-13 11:52:16+00"
|
159
|
+
},
|
160
|
+
"claim": {
|
161
|
+
"status": null,
|
162
|
+
"amount": null,
|
163
|
+
"shipping_fee_flag": null,
|
164
|
+
"insurance_fee_flag": null,
|
165
|
+
"transaction_fee_flag": null,
|
166
|
+
"assets": null,
|
167
|
+
"reason": null,
|
168
|
+
"remarks": null,
|
169
|
+
"created_at": null,
|
170
|
+
"updated_at": null,
|
171
|
+
"tat": null,
|
172
|
+
"reference_id": null
|
173
|
+
},
|
174
|
+
"buyer_name_parsed": {
|
175
|
+
"first_name": "Thea Lizardo",
|
176
|
+
"middle_name": null,
|
177
|
+
"last_name": null
|
178
|
+
},
|
179
|
+
"items": [
|
180
|
+
{
|
181
|
+
"type": "product",
|
182
|
+
"description": "Women's Abby Pointed Sling",
|
183
|
+
"amount": "1750.00",
|
184
|
+
"quantity": 1,
|
185
|
+
"total": "1750.00",
|
186
|
+
"metadata": {
|
187
|
+
"sku": "FSRI-174290070",
|
188
|
+
"size": "7",
|
189
|
+
"color": "Floral",
|
190
|
+
"width": "Regular"
|
191
|
+
},
|
192
|
+
"insured_value": null
|
193
|
+
}
|
194
|
+
],
|
195
|
+
"segments": [
|
196
|
+
{
|
197
|
+
"courier": "South Hub",
|
198
|
+
"type": "pick_up",
|
199
|
+
"barcode_format": "qr",
|
200
|
+
"tat": {
|
201
|
+
"end_date": null,
|
202
|
+
"start_date": null
|
203
|
+
},
|
204
|
+
"shipping_type": "land",
|
205
|
+
"currency": null,
|
206
|
+
"amount": null,
|
207
|
+
"reference_id": "0078-9566-ABLV",
|
208
|
+
"active": true,
|
209
|
+
"pickup_address": {
|
210
|
+
"name": "Thea Lizardo",
|
211
|
+
"title": null,
|
212
|
+
"email": null,
|
213
|
+
"phone_number": "",
|
214
|
+
"mobile_number": "+639171234567",
|
215
|
+
"fax_number": null,
|
216
|
+
"company": "xpanse",
|
217
|
+
"line_1": "Payless Warehouse",
|
218
|
+
"line_2": "",
|
219
|
+
"district": null,
|
220
|
+
"city": "Paranaque City",
|
221
|
+
"state": "Metro Manila",
|
222
|
+
"postal_code": "1634",
|
223
|
+
"region": "Mmb",
|
224
|
+
"country": {
|
225
|
+
"code": "PH",
|
226
|
+
"name": "Philippines"
|
227
|
+
}
|
228
|
+
},
|
229
|
+
"delivery_address": {
|
230
|
+
"name": "South Hub",
|
231
|
+
"title": null,
|
232
|
+
"email": null,
|
233
|
+
"phone_number": null,
|
234
|
+
"mobile_number": null,
|
235
|
+
"fax_number": null,
|
236
|
+
"company": null,
|
237
|
+
"line_1": "",
|
238
|
+
"line_2": null,
|
239
|
+
"district": "",
|
240
|
+
"city": "Manila City",
|
241
|
+
"state": "Metro Manila",
|
242
|
+
"postal_code": "",
|
243
|
+
"region": "MMB",
|
244
|
+
"country": {
|
245
|
+
"code": "PH",
|
246
|
+
"name": "Philippines"
|
247
|
+
}
|
248
|
+
}
|
249
|
+
},
|
250
|
+
{
|
251
|
+
"courier": "South Hub",
|
252
|
+
"type": "delivery",
|
253
|
+
"barcode_format": "qr",
|
254
|
+
"tat": {
|
255
|
+
"end_date": null,
|
256
|
+
"start_date": null
|
257
|
+
},
|
258
|
+
"shipping_type": "land",
|
259
|
+
"currency": null,
|
260
|
+
"amount": null,
|
261
|
+
"reference_id": "71001373530487",
|
262
|
+
"active": false,
|
263
|
+
"pickup_address": {
|
264
|
+
"name": "South Hub",
|
265
|
+
"title": null,
|
266
|
+
"email": null,
|
267
|
+
"phone_number": null,
|
268
|
+
"mobile_number": null,
|
269
|
+
"fax_number": null,
|
270
|
+
"company": null,
|
271
|
+
"line_1": "",
|
272
|
+
"line_2": null,
|
273
|
+
"district": "",
|
274
|
+
"city": "Manila City",
|
275
|
+
"state": "Metro Manila",
|
276
|
+
"postal_code": "",
|
277
|
+
"region": "MMB",
|
278
|
+
"country": {
|
279
|
+
"code": "PH",
|
280
|
+
"name": "Philippines"
|
281
|
+
}
|
282
|
+
},
|
283
|
+
"delivery_address": {
|
284
|
+
"name": "Thea Lizardo",
|
285
|
+
"title": null,
|
286
|
+
"email": null,
|
287
|
+
"phone_number": "",
|
288
|
+
"mobile_number": "+639171234567",
|
289
|
+
"fax_number": null,
|
290
|
+
"company": "",
|
291
|
+
"line_1": "Payless Warehouse",
|
292
|
+
"line_2": "",
|
293
|
+
"district": null,
|
294
|
+
"city": "Paranaque City",
|
295
|
+
"state": "Metro Manila",
|
296
|
+
"postal_code": "1634",
|
297
|
+
"region": "Mmb",
|
298
|
+
"country": {
|
299
|
+
"code": "PH",
|
300
|
+
"name": "Philippines"
|
301
|
+
}
|
302
|
+
}
|
303
|
+
}
|
304
|
+
],
|
305
|
+
"children": []
|
306
|
+
}
|
@@ -0,0 +1,105 @@
|
|
1
|
+
{
|
2
|
+
"event": "status_update",
|
3
|
+
"timestamp": 1512551041,
|
4
|
+
"data": [
|
5
|
+
{
|
6
|
+
"event_id": 35862967,
|
7
|
+
"tracking_number": "0495-0754-VZXJ",
|
8
|
+
"reference_id": "17120514285DPEK.42ecdce0-d185-4356-a30f-d33ea14cff05",
|
9
|
+
"created_at": "2017-12-06 16:41:31.898782+08",
|
10
|
+
"status_updated_at": "2017-12-06 16:41:21+08",
|
11
|
+
"status": "picked_up",
|
12
|
+
"remarks": "Package successfully picked up",
|
13
|
+
"fees": {
|
14
|
+
"shipping_fee": 100,
|
15
|
+
"insurance_fee": 9,
|
16
|
+
"transaction_fee": 27
|
17
|
+
},
|
18
|
+
"party": {
|
19
|
+
"id": 6,
|
20
|
+
"external_id": null
|
21
|
+
},
|
22
|
+
"parent": {
|
23
|
+
"id": null,
|
24
|
+
"tracking_number": null,
|
25
|
+
"reference_id": null
|
26
|
+
}
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"event_id": 35862969,
|
30
|
+
"tracking_number": "0476-8835-FHUL",
|
31
|
+
"reference_id": "17120110305AQXW.db11da3c-15f9-4a79-a605-2aa59600790f",
|
32
|
+
"created_at": "2017-12-06 16:41:31.939001+08",
|
33
|
+
"status_updated_at": "2017-12-06 16:04:06+08",
|
34
|
+
"status": "in_transit",
|
35
|
+
"remarks": "FORWARDED TO PUERTO PRINCESA DELIVERY HUB",
|
36
|
+
"fees": {
|
37
|
+
"shipping_fee": 100,
|
38
|
+
"insurance_fee": 5,
|
39
|
+
"transaction_fee": 20
|
40
|
+
},
|
41
|
+
"party": {
|
42
|
+
"id": 6,
|
43
|
+
"external_id": null
|
44
|
+
},
|
45
|
+
"parent": {
|
46
|
+
"id": null,
|
47
|
+
"tracking_number": null,
|
48
|
+
"reference_id": null
|
49
|
+
}
|
50
|
+
},
|
51
|
+
{
|
52
|
+
"event_id": 35862972,
|
53
|
+
"tracking_number": "0479-8119-CWAX",
|
54
|
+
"reference_id": "17120109493993N.88b7c455-cf29-404c-a91f-a398278ad1fd",
|
55
|
+
"created_at": "2017-12-06 16:41:32.475252+08",
|
56
|
+
"status_updated_at": "2017-12-06 16:20:19+08",
|
57
|
+
"status": "in_transit",
|
58
|
+
"remarks": "RECEIVED AT SOUTH LUZON AREA",
|
59
|
+
"fees": {
|
60
|
+
"shipping_fee": 100,
|
61
|
+
"insurance_fee": 6.1,
|
62
|
+
"transaction_fee": 20
|
63
|
+
},
|
64
|
+
"party": {
|
65
|
+
"id": 6,
|
66
|
+
"external_id": null
|
67
|
+
},
|
68
|
+
"parent": {
|
69
|
+
"id": null,
|
70
|
+
"tracking_number": null,
|
71
|
+
"reference_id": null
|
72
|
+
}
|
73
|
+
},
|
74
|
+
{
|
75
|
+
"event_id": 35862977,
|
76
|
+
"tracking_number": "0481-9668-HAJN",
|
77
|
+
"reference_id": "17120113387HYRH.3623ee76-ee52-44a0-b890-f2bdc661078e",
|
78
|
+
"created_at": "2017-12-06 16:41:33.064148+08",
|
79
|
+
"status_updated_at": "2017-12-06 16:37:43+08",
|
80
|
+
"status": "in_transit",
|
81
|
+
"remarks": "RECEIVED AT SOUTH LUZON AREA",
|
82
|
+
"fees": {
|
83
|
+
"shipping_fee": 100,
|
84
|
+
"insurance_fee": 5.52,
|
85
|
+
"transaction_fee": 20
|
86
|
+
},
|
87
|
+
"party": {
|
88
|
+
"id": 6,
|
89
|
+
"external_id": null
|
90
|
+
},
|
91
|
+
"parent": {
|
92
|
+
"id": null,
|
93
|
+
"tracking_number": null,
|
94
|
+
"reference_id": null
|
95
|
+
}
|
96
|
+
},
|
97
|
+
{
|
98
|
+
"event_id": 35862981,
|
99
|
+
"tracking_number": "0492-6744-JFQD",
|
100
|
+
"reference_id": "17120411264R1YD.8b95ac0c-4466-4053-bd03-ce1c9723b8fc",
|
101
|
+
"created_at": "2017-12-06 16:41:33.193278+08",
|
102
|
+
"status_updated_at": "2017-12-06 16:41:22+08",
|
103
|
+
...
|
104
|
+
}]
|
105
|
+
}
|
data/spec/factories/addresses.rb
CHANGED
@@ -1,38 +1,56 @@
|
|
1
1
|
FactoryBot.define do
|
2
|
-
factory :address, class: Xpost::
|
3
|
-
name "Bobby Axelrod"
|
4
|
-
line_1 "Axe Capital"
|
2
|
+
factory :address, class: Xpost::Address do
|
3
|
+
name { "Bobby Axelrod" }
|
4
|
+
line_1 { "Axe Capital" }
|
5
5
|
end
|
6
6
|
|
7
|
-
factory :required_address, class: Xpost::
|
8
|
-
name "Bobby Axelrod"
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
country "US"
|
7
|
+
factory :required_address, class: Xpost::Address do
|
8
|
+
name { "Bobby Axelrod" }
|
9
|
+
line_1 { "BGC Corporate Centre" }
|
10
|
+
city { "Taguig" }
|
11
|
+
state { "Metro Manila" }
|
12
|
+
postal_code { "1634" }
|
13
|
+
country { "PH" }
|
15
14
|
|
16
15
|
initialize_with { new(attributes) }
|
17
16
|
end
|
18
17
|
|
19
|
-
factory :complete_address, class: Xpost::
|
20
|
-
name "Bobby Axelrod"
|
21
|
-
|
22
|
-
|
23
|
-
city "
|
24
|
-
state "
|
25
|
-
postal_code
|
26
|
-
country "
|
27
|
-
company "Axe Capital"
|
28
|
-
title "CEO"
|
29
|
-
email "bobby@axe.com"
|
30
|
-
phone_number "12345678"
|
31
|
-
mobile_number "091712345678"
|
32
|
-
fax_number "12345678"
|
33
|
-
district "
|
34
|
-
|
35
|
-
|
18
|
+
factory :complete_address, class: Xpost::Address do
|
19
|
+
name { "Bobby Axelrod" }
|
20
|
+
line_1 { "BGC Corporate Centre" }
|
21
|
+
line_2 { "5th floor" }
|
22
|
+
city { "Taguig" }
|
23
|
+
state { "Metro Manila" }
|
24
|
+
postal_code { "1634" }
|
25
|
+
country { "PH" }
|
26
|
+
company { "Axe Capital" }
|
27
|
+
title { "CEO" }
|
28
|
+
email { "bobby@axe.com" }
|
29
|
+
phone_number { "12345678" }
|
30
|
+
mobile_number { "091712345678" }
|
31
|
+
fax_number { "12345678" }
|
32
|
+
district { "BGC" }
|
33
|
+
remarks { "Send ASAP" }
|
34
|
+
|
35
|
+
initialize_with { new(attributes) }
|
36
|
+
end
|
37
|
+
|
38
|
+
factory :complete_address_pickup, class: Xpost::Address do
|
39
|
+
name { "Taylor Mason" }
|
40
|
+
line_1 { "BGC Corporate Centre" }
|
41
|
+
line_2 { "7th floor" }
|
42
|
+
city { "Taguig" }
|
43
|
+
state { "Metro Manila" }
|
44
|
+
postal_code { "1634" }
|
45
|
+
country { "PH" }
|
46
|
+
company { "Taylor Mason Capital" }
|
47
|
+
title { "CEO" }
|
48
|
+
email { "taylor@tmcapital.com" }
|
49
|
+
phone_number { "12345678" }
|
50
|
+
mobile_number { "091712345678" }
|
51
|
+
fax_number { "12345678" }
|
52
|
+
district { "BGC" }
|
53
|
+
remarks { "" }
|
36
54
|
|
37
55
|
initialize_with { new(attributes) }
|
38
56
|
end
|