solidus_bactracs 3.2.0 → 3.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e67ac9974b0c0fb6e097172f14667e73c99c5d4ccd948423e48dcdd5820becde
4
- data.tar.gz: a7fb4b01e858278ab263373d087aa5a4c63222f9389d2f2a8087566e50f42270
3
+ metadata.gz: 54959bbe94b9360e9d26b71e5e22e5b3e5acaa71416ffa3db198a0e6c9029905
4
+ data.tar.gz: e38d854370db42b688dd13ce7ec31fe094333de329559435f2ead8b747991f84
5
5
  SHA512:
6
- metadata.gz: d6232847569c2a6166959fcfdd3791597d8e32aaa71f68def3d4eff77b8b8269857c0973143f5c8af3b33cf47ffcd326b209a43f8c36d6ae07c0542db3255205
7
- data.tar.gz: d61675ac31273aa2751b300350d3b3b20ce8d4c23c62c39192a9a90c489762c4d6ff5179abefbcb53ce17031c4f9a68c976663599b49194078a3857d49cf6116
6
+ metadata.gz: d5ebef122f00f3c0254251d8e1d0115dd54bad137eb185e7c257b69f06be418eb6a23eb10c1ec70afb7bf9aa4085e6847e42517ba02dca67d289e4b4be6daffa
7
+ data.tar.gz: 64e323385ba59a13602f41f502ff21686d8b9f30daafa3bcdab11d909d19eb9aab39838c94bcac1a27270aa78ac687c05a243ef34171d1c51cbf962878a75411
data/README.md CHANGED
@@ -31,6 +31,7 @@ used by the extension.
31
31
  This extension can integrate with Bactracs via SOAP-based XML API integration. The gem currently makes SOAP 1.1 format calls, though the API support SOAP 1.2
32
32
 
33
33
 
34
+
34
35
  ### XML integration
35
36
 
36
37
  The [XML integration](https://help.bactracs.com/hc/en-us/articles/360025856192-Custom-Store-Development-Guide)
@@ -42,29 +43,27 @@ created and updated shipments in your Solidus store.
42
43
  ⛔️ This section is outdated and inaccurate.
43
44
 
44
45
  In order to enable the XML integration, make sure to configure the relevant section of the
45
- configuration initializer, and configure your ShipStation store accordingly:
46
+ configuration initializer, and configure your Bactracs/Andlor site accordingly:
46
47
 
47
48
  - **Username**: the username defined in your configuration.
48
49
  - **Password**: the password defined in your configuration.
49
50
  - **URL to custom page**: `https://yourdomain.com/bactracs.xml`.
50
51
 
51
- You can also configure your ShipStation store to pull the XML feed automatically on a recurring
52
+ You can also configure your Bactracs/Andlor site to pull the XML feed automatically on a recurring
52
53
  basis, or manually by clicking the "Refresh stores" button.
53
54
 
54
- There are five shipment states for an order (= shipment) in ShipStation. These states do not
55
- necessarily align with Solidus, but you can configure ShipStation to create a mapping for your
55
+ There are five shipment states for an order (= shipment) in Bactracs. These states do not
56
+ necessarily align with Solidus, but you can configure Bactracs to create a mapping for your
56
57
  specific needs. Here's the recommended mapping:
57
58
 
58
- Bactracs description | Bactracs status | Solidus status
59
+ Bactracs RMA Type | Bactracs status | Solidus status
59
60
  ------------------------|--------------------|---------------
60
- Awaiting Payment | `unpaid` | `pending`
61
- Awaiting Shipment | `paid` | `ready`
62
- Shipped | `shipped` | `shipped`
63
- Cancelled | `cancelled` | `cancelled`
64
- On-Hold | `on-hold` | `pending`
61
+ Type 1 | `unpaid` | `pending`
62
+ Type W | `paid` | `ready`
63
+ Type 3 | `shipped` | `shipped`
64
+ Type 4 | `cancelled` | `cancelled`
65
+
65
66
 
66
- Once you've configured the XML integration in your app and ShipStation, there's nothing else you
67
- need to do. ShipStation will
68
67
 
69
68
  #### XML integration: Usage
70
69
 
@@ -74,23 +73,23 @@ There's nothing you need to do. Once properly configured, the integration just w
74
73
 
75
74
  There are a few gotchas you need to be aware of:
76
75
 
77
- - If you change the shipping method of an order in ShipStation, the change will not be reflected in
76
+ - If you change the shipping method of an order in Bactracs, the change will not be reflected in
78
77
  Solidus and the tracking link might not work properly.
79
78
  - When `bactracs_capture_at_notification` is enabled, any errors during payment capture will
80
79
  prevent the update of the shipment's tracking number.
81
80
 
82
81
  ### API integration
83
82
 
84
- The [API integration](https://www.bactracs.com/docs/api/) works by calling the ShipStation API
83
+ The [API integration](https://www.bactracs.com/docs/api/) works by calling the Bactracs API
85
84
  to sync all of your shipments continuously.
86
85
 
87
- Because ShipStation has very low rate limits (i.e., 40 reqs/minute at the time of writing), the
86
+ Because Bactracs has very low rate limits (i.e., 40 reqs/minute at the time of writing), the
88
87
  API integration does not send an API request for every single shipment update, as you would expect
89
88
  from a traditional API integration.
90
89
 
91
90
  Instead, a background job runs on a recurring basis and batches together all the shipments that need
92
- to be created or updated in ShipStation. These shipments are then sent in groups of 100 (by default)
93
- to ShipStation's [bulk order upsert endpoint](https://www.bactracs.com/docs/api/orders/create-update-multiple-orders/).
91
+ to be created or updated in ShipStation. These shipments are then sent one at a time
92
+ to Bactracs [RMA creation endpoint](https://www.bactracs.com/docs/api/orders/create-update-multiple-orders/).
94
93
 
95
94
  This allows us to work around Bactracs's rate limit and sync up to 4000 shipments/minute.
96
95
 
@@ -145,6 +144,85 @@ This is a problem that is faced by all recurring jobs. The solution is two-fold:
145
144
 
146
145
  ## Development
147
146
 
147
+ Because of the object abstractions in this gem, some find it difficult to test API responses vis the console. To ease such console work, a 'console harness' was developed that provides several affordances to exploratory development.
148
+
149
+ Create a new harness in the console via
150
+
151
+ ```ruby
152
+ h = SolidusBactracs::ConsoleHarness.new
153
+ ```
154
+
155
+ #### `.try_one`
156
+
157
+ The easiest way to test the API, seeing both the output of the shipment when serialized as a XML SOAP request, and the result from the Bactracs API.
158
+
159
+ ```ruby
160
+ h.try_one
161
+ ```
162
+
163
+ or try a few
164
+
165
+ ```ruby
166
+ h.try_batch(4)
167
+ ```
168
+
169
+ maybe you have a shipment with particular issues, e.g. shipment number `H123456789`
170
+
171
+ ```ruby
172
+ h.shipment_number('H123456789')
173
+
174
+ h.try_one(h.shipment_number('H123456789'))
175
+ ```
176
+
177
+ `.shipment_number` retries that shipment from the scope of available `h.shipments`.
178
+
179
+ #### `.refresh`
180
+
181
+ If that was successful, you may find your list of shipments has one or more shipments that are already synced
182
+
183
+ ```ruby
184
+ h.shipments.size # => 7
185
+ h.refresh
186
+ h.shipments.size # => 6
187
+ ```
188
+
189
+ #### `.cursor`
190
+
191
+ You can set where in the recordset you want to continue trying from
192
+
193
+ ```
194
+ h.cursor = 5
195
+ h.try_one
196
+ ```
197
+
198
+ #### `.batch`
199
+
200
+ You can also change the default batch size
201
+
202
+ ```
203
+ h.batch = 10
204
+ h.try_batch
205
+ # output from 10 runs, if not errors occur
206
+ ```
207
+
208
+ #### deep objects
209
+
210
+ Several deeply-nested objects are exposed for convenience
211
+
212
+ * runner
213
+ * syncer
214
+ * sync (job)
215
+
216
+ ```
217
+ h.serialize(shipment)
218
+ # see the output of serialization
219
+
220
+ h.runner.authenticated_call(shipment: h.shipments[0], serializer: h.syncer.client.shipment_serializer)
221
+ ```
222
+
223
+ Remember that you can monkey patch code in the console, to test the improvement the harness or the gem itself.
224
+
225
+
148
226
  ### Testing the extension
149
227
 
150
228
 
@@ -31,8 +31,8 @@ module SolidusBactracs
31
31
  @syncer.client.shipment_serializer.call(shipment, @runner.authenticate!)
32
32
  end
33
33
 
34
- def try_one
35
- puts "trying shipment #{(shipment = @shipments[@cursor]).id}"
34
+ def try_one(a_shipment = nil)
35
+ puts "trying shipment #{(shipment = a_shipment || @shipments[@cursor]).id}"
36
36
  # resp = @runner.call(:post, '/orders/createorders', [serialize(shipment)])
37
37
  resp = @runner.authenticated_call(shipment: shipment, serializer: @syncer.client.shipment_serializer)
38
38
  if resp
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidusBactracs
4
- VERSION = '3.2.0'
4
+ VERSION = '3.2.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_bactracs
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zeryab Ali