solidus_bactracs 3.1.1 → 3.2.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -1
- data/README.md +97 -18
- data/Rakefile +1 -0
- data/app/decorators/models/solidus_bactracs/spree/shipment_decorator.rb +13 -0
- data/app/jobs/solidus_bactracs/api/schedule_shipment_syncs_job.rb +7 -6
- data/app/jobs/solidus_bactracs/api/sync_shipments_job.rb +4 -0
- data/app/workers/verify_bactracs_sync_worker.rb +14 -0
- data/db/migrate/20210220093010_add_bactracs_api_sync_fields.rb +4 -1
- data/db/migrate/20220701000001_bactracs_typo_correction.rb +2 -1
- data/db/migrate/20220704144504_rename_bactracs_columns_in_spree_shipment.rb +10 -0
- data/lib/bactracs_service.rb +66 -0
- data/lib/solidus_bactracs/api/request_runner.rb +7 -6
- data/lib/solidus_bactracs/console_harness.rb +53 -0
- data/lib/solidus_bactracs/version.rb +1 -1
- data/lib/tasks/solidus_bactracs.rake +16 -0
- metadata +11 -7
- data/lib/solidus_backtracs/version.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54959bbe94b9360e9d26b71e5e22e5b3e5acaa71416ffa3db198a0e6c9029905
|
4
|
+
data.tar.gz: e38d854370db42b688dd13ce7ec31fe094333de329559435f2ead8b747991f84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5ebef122f00f3c0254251d8e1d0115dd54bad137eb185e7c257b69f06be418eb6a23eb10c1ec70afb7bf9aa4085e6847e42517ba02dca67d289e4b4be6daffa
|
7
|
+
data.tar.gz: 64e323385ba59a13602f41f502ff21686d8b9f30daafa3bcdab11d909d19eb9aab39838c94bcac1a27270aa78ac687c05a243ef34171d1c51cbf962878a75411
|
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 3.1.2
|
4
|
+
Fully include retry support tables and methods within the gem. Earlier in 3.1.x some migrations, etc, were expected to be handled by the host rails app.
|
5
|
+
|
3
6
|
## 3.1.0
|
4
7
|
Different retry support for CreateRMA, as well as more logging
|
5
8
|
|
6
|
-
## 3.0.
|
9
|
+
## 3.0.x
|
7
10
|
Re-release the gem under a new non-forked repo, since this gem is a non-mergeable divergence from the solidus_shipstation gem
|
8
11
|
|
9
12
|
## 2.2.0
|
data/README.md
CHANGED
@@ -28,7 +28,9 @@ used by the extension.
|
|
28
28
|
|
29
29
|
## Usage
|
30
30
|
|
31
|
-
This extension can integrate with
|
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
|
+
|
33
|
+
|
32
34
|
|
33
35
|
### XML integration
|
34
36
|
|
@@ -41,29 +43,27 @@ created and updated shipments in your Solidus store.
|
|
41
43
|
⛔️ This section is outdated and inaccurate.
|
42
44
|
|
43
45
|
In order to enable the XML integration, make sure to configure the relevant section of the
|
44
|
-
configuration initializer, and configure your
|
46
|
+
configuration initializer, and configure your Bactracs/Andlor site accordingly:
|
45
47
|
|
46
48
|
- **Username**: the username defined in your configuration.
|
47
49
|
- **Password**: the password defined in your configuration.
|
48
50
|
- **URL to custom page**: `https://yourdomain.com/bactracs.xml`.
|
49
51
|
|
50
|
-
You can also configure your
|
52
|
+
You can also configure your Bactracs/Andlor site to pull the XML feed automatically on a recurring
|
51
53
|
basis, or manually by clicking the "Refresh stores" button.
|
52
54
|
|
53
|
-
There are five shipment states for an order (= shipment) in
|
54
|
-
necessarily align with Solidus, but you can configure
|
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
|
55
57
|
specific needs. Here's the recommended mapping:
|
56
58
|
|
57
|
-
Bactracs
|
59
|
+
Bactracs RMA Type | Bactracs status | Solidus status
|
58
60
|
------------------------|--------------------|---------------
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
61
|
+
Type 1 | `unpaid` | `pending`
|
62
|
+
Type W | `paid` | `ready`
|
63
|
+
Type 3 | `shipped` | `shipped`
|
64
|
+
Type 4 | `cancelled` | `cancelled`
|
65
|
+
|
64
66
|
|
65
|
-
Once you've configured the XML integration in your app and ShipStation, there's nothing else you
|
66
|
-
need to do. ShipStation will
|
67
67
|
|
68
68
|
#### XML integration: Usage
|
69
69
|
|
@@ -73,23 +73,23 @@ There's nothing you need to do. Once properly configured, the integration just w
|
|
73
73
|
|
74
74
|
There are a few gotchas you need to be aware of:
|
75
75
|
|
76
|
-
- If you change the shipping method of an order in
|
76
|
+
- If you change the shipping method of an order in Bactracs, the change will not be reflected in
|
77
77
|
Solidus and the tracking link might not work properly.
|
78
78
|
- When `bactracs_capture_at_notification` is enabled, any errors during payment capture will
|
79
79
|
prevent the update of the shipment's tracking number.
|
80
80
|
|
81
81
|
### API integration
|
82
82
|
|
83
|
-
The [API integration](https://www.bactracs.com/docs/api/) works by calling the
|
83
|
+
The [API integration](https://www.bactracs.com/docs/api/) works by calling the Bactracs API
|
84
84
|
to sync all of your shipments continuously.
|
85
85
|
|
86
|
-
Because
|
86
|
+
Because Bactracs has very low rate limits (i.e., 40 reqs/minute at the time of writing), the
|
87
87
|
API integration does not send an API request for every single shipment update, as you would expect
|
88
88
|
from a traditional API integration.
|
89
89
|
|
90
90
|
Instead, a background job runs on a recurring basis and batches together all the shipments that need
|
91
|
-
to be created or updated in ShipStation. These shipments are then sent
|
92
|
-
to
|
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/).
|
93
93
|
|
94
94
|
This allows us to work around Bactracs's rate limit and sync up to 4000 shipments/minute.
|
95
95
|
|
@@ -144,6 +144,85 @@ This is a problem that is faced by all recurring jobs. The solution is two-fold:
|
|
144
144
|
|
145
145
|
## Development
|
146
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
|
+
|
147
226
|
### Testing the extension
|
148
227
|
|
149
228
|
|
data/Rakefile
CHANGED
@@ -7,6 +7,19 @@ module SolidusBactracs
|
|
7
7
|
base.singleton_class.prepend ClassMethods
|
8
8
|
end
|
9
9
|
|
10
|
+
def verify_bactracs_sync!
|
11
|
+
if bactracs_sync_verified_at.nil?
|
12
|
+
# API call to verify RMAs of shipments
|
13
|
+
if BactracsService.new.rma_was_synced?(self)
|
14
|
+
self.update_column(:bactracs_sync_verified_at, Time.now)
|
15
|
+
else
|
16
|
+
self.update_column(:bactracs_synced_at, nil)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
rescue => e
|
20
|
+
Rails.logger.error({ message: "#{e.message}, file: shipment_decorator.rb", shipment_number: number })
|
21
|
+
end
|
22
|
+
|
10
23
|
module ClassMethods
|
11
24
|
def exportable
|
12
25
|
::Spree::Deprecation.warn <<~DEPRECATION
|
@@ -21,16 +21,17 @@ module SolidusBactracs
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def query_shipments
|
24
|
-
shipments = SolidusBactracs::Shipment::PendingApiSyncQuery.apply(
|
25
|
-
|
24
|
+
shipments = SolidusBactracs::Shipment::PendingApiSyncQuery.apply(all_elegible_shipments)
|
25
|
+
end
|
26
|
+
|
27
|
+
def all_elegible_shipments(skus: SolidusBactracs.config.shippable_skus, state: :ready)
|
28
|
+
::Spree::Shipment
|
26
29
|
.joins(inventory_units: [:variant])
|
27
|
-
.where("spree_variants.sku" =>
|
28
|
-
.where("spree_shipments.state" =>
|
30
|
+
.where("spree_variants.sku" => skus)
|
31
|
+
.where("spree_shipments.state" => state)
|
29
32
|
.where(bactracs_synced_at: nil)
|
30
33
|
.distinct
|
31
|
-
)
|
32
34
|
end
|
33
35
|
end
|
34
36
|
end
|
35
37
|
end
|
36
|
-
|
@@ -10,6 +10,10 @@ module SolidusBactracs
|
|
10
10
|
return if shipments.empty?
|
11
11
|
|
12
12
|
sync_shipments(shipments)
|
13
|
+
|
14
|
+
# Verify bactracs sync
|
15
|
+
shipments.each { |shipment| VerifyBactracsSyncWorker.perform_async(shipment.id) }
|
16
|
+
|
13
17
|
rescue RateLimitedError => e
|
14
18
|
self.class.set(wait: e.retry_in).perform_later
|
15
19
|
rescue StandardError => e
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class VerifyBactracsSyncWorker
|
4
|
+
include Sidekiq::Worker
|
5
|
+
|
6
|
+
sidekiq_options queue: 'default'
|
7
|
+
|
8
|
+
def perform(shipment_id)
|
9
|
+
shipment = Spree::Shipment.find_by(id: shipment_id)
|
10
|
+
if shipment
|
11
|
+
shipment.verify_bactracs_sync!
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -1,8 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# NOTE: This migration is only required if you use the API integration strategy.
|
2
3
|
# If you're using the XML file instead, you can safely skip these columns.
|
3
4
|
|
4
5
|
class AddBactracsApiSyncFields < ActiveRecord::Migration[5.2]
|
5
6
|
def change
|
6
|
-
|
7
|
+
if !ActiveRecord::Base.connection.column_exists?(:spree_shipments, :bactracs_synced_at)
|
8
|
+
add_column :spree_shipments, :bactracs_synced_at, :datetime
|
9
|
+
end
|
7
10
|
end
|
8
11
|
end
|
@@ -2,7 +2,8 @@
|
|
2
2
|
|
3
3
|
class BactracsTypoCorrection < ActiveRecord::Migration[5.2]
|
4
4
|
def change
|
5
|
-
if ActiveRecord::Base.connection.column_exists?(:spree_shipments, :backtracs_synced_at)
|
5
|
+
if ( ActiveRecord::Base.connection.column_exists?(:spree_shipments, :backtracs_synced_at) &&
|
6
|
+
!ActiveRecord::Base.connection.column_exists?(:spree_shipments, :bactracs_synced_at))
|
6
7
|
rename_column :spree_shipments, :backtracs_synced_at, :bactracs_synced_at
|
7
8
|
end
|
8
9
|
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class RenameBactracsColumnsInSpreeShipment < ActiveRecord::Migration[5.2]
|
4
|
+
def change
|
5
|
+
if ( ActiveRecord::Base.connection.column_exists?(:spree_shipments, :backtracs_sync_verified_at) &&
|
6
|
+
!ActiveRecord::Base.connection.column_exists?(:spree_shipments, :bactracs_sync_verified_at))
|
7
|
+
rename_column :spree_shipments, :backtracs_sync_verified_at, :bactracs_sync_verified_at
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "uri"
|
4
|
+
require "net/http"
|
5
|
+
|
6
|
+
class BactracsService
|
7
|
+
attr_accessor :token
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
@username = SolidusBactracs.configuration.authentication_username
|
11
|
+
@password = SolidusBactracs.configuration.authentication_password
|
12
|
+
@runner = SolidusBactracs::Api::RequestRunner.new
|
13
|
+
# Authenticate account
|
14
|
+
authenticate!
|
15
|
+
end
|
16
|
+
|
17
|
+
def rma_was_synced?(shipment)
|
18
|
+
if @token.present?
|
19
|
+
|
20
|
+
response =
|
21
|
+
@runner.call(
|
22
|
+
method: :post,
|
23
|
+
path: "/webservices/rma/rmaservice.asmx?op=Read",
|
24
|
+
params:
|
25
|
+
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n
|
26
|
+
<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n
|
27
|
+
<soap:Body>
|
28
|
+
<Read xmlns=\"http://bactracs.andlor.com/rmaservice\">\n
|
29
|
+
<sGuid>#{@token}</sGuid>\n
|
30
|
+
<sRMANumber>#{shipment.number}</sRMANumber>\n
|
31
|
+
</Read>\n
|
32
|
+
</soap:Body>\n
|
33
|
+
</soap:Envelope>"
|
34
|
+
)
|
35
|
+
|
36
|
+
if response
|
37
|
+
return response.dig("Envelope", "Body", "ReadResponse", "ReadResult", "oRMA").present? rescue false
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
return false
|
42
|
+
|
43
|
+
rescue => e
|
44
|
+
Rails.logger.error({ message: e.message.to_s, file: "bactracs_service.rb" })
|
45
|
+
|
46
|
+
return false
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def authenticate!
|
52
|
+
|
53
|
+
response =
|
54
|
+
@runner.call(
|
55
|
+
method: :get,
|
56
|
+
path: "/webservices/user/Authentication.asmx/Login?sUserName=#{@username}&sPassword=#{@password}"
|
57
|
+
)
|
58
|
+
|
59
|
+
if response.dig("AuthenticationResponse", "Result") == "true"
|
60
|
+
@token = response.dig("AuthenticationResponse", "Message")
|
61
|
+
end
|
62
|
+
|
63
|
+
rescue => e
|
64
|
+
Rails.logger.error({ message: "#{e.message}, file: bactracs_service.rb" })
|
65
|
+
end
|
66
|
+
end
|
@@ -13,18 +13,18 @@ module SolidusBactracs
|
|
13
13
|
@retries = SolidusBactracs.configuration.api_retries
|
14
14
|
end
|
15
15
|
|
16
|
-
def authenticated_call(
|
16
|
+
def authenticated_call(serializer: nil, shipment: nil, method: :post, path: '/webservices/rma/rmaservice.asmx', count: 0)
|
17
17
|
if count <= @retries
|
18
18
|
sguid = authenticate! rescue nil
|
19
19
|
|
20
20
|
if !sguid.presence
|
21
21
|
clear_cache
|
22
22
|
count += 1
|
23
|
-
self.authenticated_call(method:
|
23
|
+
self.authenticated_call(method: method, path: path, serializer: serializer, shipment: shipment, count: count)
|
24
24
|
else
|
25
25
|
params = serializer.call(shipment, sguid)
|
26
26
|
|
27
|
-
rma_response = call(method:
|
27
|
+
rma_response = call(method: method, path: path, params: params)
|
28
28
|
if create_rma_success?(rma_response)
|
29
29
|
Rails.logger.info({ event: 'success CreateRMA', rma: shipment.number, response: parse_rma_creation_response(rma_response, "Message")})
|
30
30
|
shipment_synced(shipment)
|
@@ -35,11 +35,12 @@ module SolidusBactracs
|
|
35
35
|
clear_cache
|
36
36
|
count += 1
|
37
37
|
Rails.logger.warn({ event: 'bactracs failed CreateRMA', error: parse_rma_creation_response(rma_response, "Message")})
|
38
|
-
self.authenticated_call(method:
|
38
|
+
self.authenticated_call(method: method, path: path, serializer: serializer, shipment: shipment, count: count)
|
39
39
|
end
|
40
40
|
end
|
41
41
|
else
|
42
42
|
shipment_sync_failed(shipment)
|
43
|
+
return false
|
43
44
|
end
|
44
45
|
end
|
45
46
|
|
@@ -77,7 +78,7 @@ module SolidusBactracs
|
|
77
78
|
@response = nil
|
78
79
|
end
|
79
80
|
|
80
|
-
def authenticate!
|
81
|
+
def authenticate!
|
81
82
|
unless @username.present? || @password.present? || @api_base.present?
|
82
83
|
raise "Credentials not defined for Authentication"
|
83
84
|
end
|
@@ -110,7 +111,7 @@ module SolidusBactracs
|
|
110
111
|
|
111
112
|
def rma_exists?(response)
|
112
113
|
if parse_rma_creation_response(response, "Message").match(/rma .* already exists/)
|
113
|
-
Rails.logger.warn({ event: 'bactracs failed CreateRMA', error: parse_rma_creation_response(
|
114
|
+
Rails.logger.warn({ event: 'bactracs failed CreateRMA', error: parse_rma_creation_response(response, "Message")})
|
114
115
|
return true
|
115
116
|
end
|
116
117
|
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module SolidusBactracs
|
2
|
+
class ConsoleHarness
|
3
|
+
attr_reader :runner, :syncer, :sync, :shipments, :shipments_elegible
|
4
|
+
|
5
|
+
attr_accessor :cursor, :batch
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
@runner = SolidusBactracs::Api::RequestRunner.new
|
9
|
+
@syncer = SolidusBactracs::Api::BatchSyncer.from_config
|
10
|
+
@sync = SolidusBactracs::Api::ScheduleShipmentSyncsJob.new
|
11
|
+
@shipments = SolidusBactracs::Api::ScheduleShipmentSyncsJob.new.query_shipments
|
12
|
+
@shipments_elegible = SolidusBactracs::Api::ScheduleShipmentSyncsJob.new.all_elegible_shipments
|
13
|
+
@cursor = 0
|
14
|
+
@batch = 4
|
15
|
+
end
|
16
|
+
|
17
|
+
def refresh
|
18
|
+
@shipments = SolidusBactracs::Api::ScheduleShipmentSyncsJob.new.query_shipments
|
19
|
+
end
|
20
|
+
|
21
|
+
def shipment(id)
|
22
|
+
@shipments.find_by(id: id)
|
23
|
+
end
|
24
|
+
|
25
|
+
def shipment_number(ship_number)
|
26
|
+
@shipments.find_by(number: ship_number)
|
27
|
+
end
|
28
|
+
|
29
|
+
def serialize(shipment)
|
30
|
+
# SolidusShipstation::Api::ApplianceShipmentSerializer.new(shipment)
|
31
|
+
@syncer.client.shipment_serializer.call(shipment, @runner.authenticate!)
|
32
|
+
end
|
33
|
+
|
34
|
+
def try_one(a_shipment = nil)
|
35
|
+
puts "trying shipment #{(shipment = a_shipment || @shipments[@cursor]).id}"
|
36
|
+
# resp = @runner.call(:post, '/orders/createorders', [serialize(shipment)])
|
37
|
+
resp = @runner.authenticated_call(shipment: shipment, serializer: @syncer.client.shipment_serializer)
|
38
|
+
if resp
|
39
|
+
@cursor += 1
|
40
|
+
return resp
|
41
|
+
end
|
42
|
+
ensure
|
43
|
+
puts resp
|
44
|
+
end
|
45
|
+
|
46
|
+
def try_batch(batch_size=nil)
|
47
|
+
b = [batch_size.to_i, @batch].max
|
48
|
+
b.times do
|
49
|
+
break unless try_one
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
namespace :solidus_bactracs do
|
4
|
+
desc 'Run export jobs to send shipments to Bactracs'
|
5
|
+
task export: :environment do
|
6
|
+
SolidusBactracs::Api::ScheduleShipmentSyncsJob.perform_later
|
7
|
+
end
|
8
|
+
|
9
|
+
desc "Verify bactracs RMA creation"
|
10
|
+
task verify_bactracs_sync: :environment do
|
11
|
+
Spree::Shipment.not_bactracs_sync_verified.find_each(batch_size: 200) do |shipment|
|
12
|
+
# set shipment sync at and bactracs_sync_verified_at attributes by verifying RMA
|
13
|
+
shipment.verify_bactracs_sync!
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solidus_bactracs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zeryab Ali
|
8
8
|
- Zachary Jones
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-
|
12
|
+
date: 2022-08-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|
@@ -115,7 +115,7 @@ dependencies:
|
|
115
115
|
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
|
-
description:
|
118
|
+
description:
|
119
119
|
email: techbilling@suvie.com
|
120
120
|
executables: []
|
121
121
|
extensions: []
|
@@ -155,6 +155,7 @@ files:
|
|
155
155
|
- app/queries/solidus_bactracs/shipment/exportable_query.rb
|
156
156
|
- app/queries/solidus_bactracs/shipment/pending_api_sync_query.rb
|
157
157
|
- app/views/spree/bactracs/export.xml.builder
|
158
|
+
- app/workers/verify_bactracs_sync_worker.rb
|
158
159
|
- bin/console
|
159
160
|
- bin/rails
|
160
161
|
- bin/rails-engine
|
@@ -166,9 +167,10 @@ files:
|
|
166
167
|
- config/routes.rb
|
167
168
|
- db/migrate/20210220093010_add_bactracs_api_sync_fields.rb
|
168
169
|
- db/migrate/20220701000001_bactracs_typo_correction.rb
|
170
|
+
- db/migrate/20220704144504_rename_bactracs_columns_in_spree_shipment.rb
|
171
|
+
- lib/bactracs_service.rb
|
169
172
|
- lib/generators/solidus_bactracs/install/install_generator.rb
|
170
173
|
- lib/generators/solidus_bactracs/install/templates/initializer.rb
|
171
|
-
- lib/solidus_backtracs/version.rb
|
172
174
|
- lib/solidus_bactracs.rb
|
173
175
|
- lib/solidus_bactracs/api/batch_syncer.rb
|
174
176
|
- lib/solidus_bactracs/api/client.rb
|
@@ -178,11 +180,13 @@ files:
|
|
178
180
|
- lib/solidus_bactracs/api/shipment_serializer.rb
|
179
181
|
- lib/solidus_bactracs/api/threshold_verifier.rb
|
180
182
|
- lib/solidus_bactracs/configuration.rb
|
183
|
+
- lib/solidus_bactracs/console_harness.rb
|
181
184
|
- lib/solidus_bactracs/engine.rb
|
182
185
|
- lib/solidus_bactracs/errors.rb
|
183
186
|
- lib/solidus_bactracs/shipment_notice.rb
|
184
187
|
- lib/solidus_bactracs/testing_support/factories.rb
|
185
188
|
- lib/solidus_bactracs/version.rb
|
189
|
+
- lib/tasks/solidus_bactracs.rake
|
186
190
|
- solidus_bactracs.gemspec
|
187
191
|
- spec/controllers/spree/bactracs_controller_spec.rb
|
188
192
|
- spec/fixtures/bactracs_xml_schema.xsd
|
@@ -214,7 +218,7 @@ metadata:
|
|
214
218
|
source_code_uri: https://github.com/suvie-eng/solidus_bactracs/
|
215
219
|
changelog_uri: https://github.com/suvie-eng/solidus_bactracs/blob/master/CHANGELOG.md
|
216
220
|
allowed_push_host: https://rubygems.org
|
217
|
-
post_install_message:
|
221
|
+
post_install_message:
|
218
222
|
rdoc_options: []
|
219
223
|
require_paths:
|
220
224
|
- lib
|
@@ -230,7 +234,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
230
234
|
version: '0'
|
231
235
|
requirements: []
|
232
236
|
rubygems_version: 3.1.4
|
233
|
-
signing_key:
|
237
|
+
signing_key:
|
234
238
|
specification_version: 4
|
235
239
|
summary: A Solidus extension for integrating the Bactracs API.
|
236
240
|
test_files:
|