solidus_bactracs 3.3.0 → 3.3.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0013aa0b04dbd61b4b6dc02af169425be44089ecb2cc19d2ec246ce81cb9ce2d
4
- data.tar.gz: d9e6e69eb3ddd8c81c68e39fc3b3eb8b5277c183a45e1d96e941778472beaf8b
3
+ metadata.gz: c253cf9eff07138bbc398a46d8cb03d0d30af1c0d7000e91554135cc15a8fbd9
4
+ data.tar.gz: 3683cd659eef9d33c6f487b8611876cb756697778ef7fd1856c752a355cbf2a9
5
5
  SHA512:
6
- metadata.gz: a69d203aa13627e8719cd1501cc4d807a9ae20ed8c045e038592ee7448c675376d43517127f9640037ea069128db27be8d6878f388102d76a839f2727f1ceec0
7
- data.tar.gz: 80b5f4ad0db3b8c7e7fdc280cf36f825bc996bd8b8c49ebb7bb28d5e71fc272a1c5d1724503702773f0d7944d4cc4cadccac7f47489f6054a5ce47a8d001171c
6
+ metadata.gz: e5fffca275370de98ca4f38fa53b144275c0d37a5c09f1de2445ac8ce0586d2a8ebd4f8d6eb714fdca045c9dab16a2a68b09420c4905d49b2995408743a959bb
7
+ data.tar.gz: 45d5a089947e1c9ebb741066bc3d13ba165bbc42b027bfb58d9c2d6d1cb3aa496d96d81e0196d479328fd6d78883b8f966cb08210c02429f711d398825757573
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.3.0
4
+ Exposed a config var that holds an evaluator for the type of RMA being sent through bactracs. `config.evaluate_rma_type` . You should overwrite this with your own means of determining the RMA type for a given shipment.
5
+
3
6
  ## 3.1.2
4
7
  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
8
 
data/README.md CHANGED
@@ -98,9 +98,19 @@ implementation, but the extension abstracts it all away for you.
98
98
 
99
99
  #### API integration: Configuration
100
100
 
101
- In order to enable the API integration, make sure to configure the relevant section of the
102
- configuration initializer. At the very least, the integration needs to know your API credentials
103
- and store ID, but there are additional options you can configure — just look at the initializer!
101
+ In order to enable the API integration, make sure to configure the relevant section of the configuration initializer. At the very least, the integration needs to know your API credentials and store ID, but there are additional options you can configure — just look at the initializer!
102
+
103
+ ##### RMA Type
104
+
105
+ This gem exposes a config var that holds an evaluator for the type of RMA being sent through bactracs. E.G. `1`, `2`, `W`, etc.
106
+
107
+ ```
108
+ config.evaluate_rma_type = proc do |shipment|
109
+ "W"
110
+ end
111
+ ```
112
+
113
+ You should overwrite this with your own means of determining the RMA type for a given shipment.
104
114
 
105
115
  #### API integration: Usage
106
116
 
@@ -146,7 +156,7 @@ This is a problem that is faced by all recurring jobs. The solution is two-fold:
146
156
 
147
157
  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
158
 
149
- Create a new harness in the console via
159
+ Create a new harness in the console via
150
160
 
151
161
  ```ruby
152
162
  h = SolidusBactracs::ConsoleHarness.new
@@ -21,10 +21,10 @@ module SolidusBactracs
21
21
  end
22
22
 
23
23
  def query_shipments
24
- shipments = SolidusBactracs::Shipment::PendingApiSyncQuery.apply(all_elegible_shipments)
24
+ shipments = SolidusBactracs::Shipment::PendingApiSyncQuery.apply(all_eligible_shipments)
25
25
  end
26
26
 
27
- def all_elegible_shipments(skus: SolidusBactracs.config.shippable_skus, state: :ready)
27
+ def all_eligible_shipments(skus: SolidusBactracs.config.shippable_skus, state: :ready)
28
28
  ::Spree::Shipment
29
29
  .joins(inventory_units: [:variant])
30
30
  .where("spree_variants.sku" => skus)
@@ -13,6 +13,7 @@ module SolidusBactracs
13
13
  def call(sguid: nil)
14
14
  order = @shipment.order
15
15
  user = @shipment.user
16
+ rma_type = safe_rma_type
16
17
 
17
18
  xml = Builder::XmlMarkup.new
18
19
  xml.instruct!(:xml, :encoding => "UTF-8")
@@ -23,7 +24,7 @@ module SolidusBactracs
23
24
  xml.sGuid sguid
24
25
  xml.NewRMA {
25
26
  xml.RMANumber @shipment.number
26
- xml.RMATypeName @shipment.rma_type.present? ? @shipment.rma_type : @config.evaluate_rma_type
27
+ xml.RMATypeName rma_type
27
28
  xml.RMASubTypeName
28
29
  xml.CustomerRef
29
30
  xml.InboundShippingPriority
@@ -96,6 +97,11 @@ module SolidusBactracs
96
97
  }
97
98
  end
98
99
 
100
+ def safe_rma_type
101
+ rma_type = @shipment.rma_type if (@shipment.respond_to?(:rma_type) && @shipment.rma_type.present?)
102
+ rma_type ||= @config.evaluate_rma_type.call(@shipment)
103
+ end
104
+
99
105
  def find_sku_variant(variant)
100
106
  @config.sku_map[variant.sku].present? ? @config.sku_map[variant.sku] : variant.sku
101
107
  end
@@ -9,7 +9,7 @@ module SolidusBactracs
9
9
  @syncer = SolidusBactracs::Api::BatchSyncer.from_config
10
10
  @sync = SolidusBactracs::Api::ScheduleShipmentSyncsJob.new
11
11
  @shipments = SolidusBactracs::Api::ScheduleShipmentSyncsJob.new.query_shipments
12
- @shipments_elegible = SolidusBactracs::Api::ScheduleShipmentSyncsJob.new.all_elegible_shipments
12
+ @shipments_elegible = SolidusBactracs::Api::ScheduleShipmentSyncsJob.new.all_eligible_shipments
13
13
  @cursor = 0
14
14
  @batch = 4
15
15
  end
@@ -18,11 +18,11 @@ module SolidusBactracs
18
18
  @shipments = SolidusBactracs::Api::ScheduleShipmentSyncsJob.new.query_shipments
19
19
  end
20
20
 
21
- def shipment(id)
21
+ def has_shipment?(id)
22
22
  @shipments.find_by(id: id)
23
23
  end
24
24
 
25
- def shipment_number(ship_number)
25
+ def has_shipment_number?(ship_number)
26
26
  @shipments.find_by(number: ship_number)
27
27
  end
28
28
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidusBactracs
4
- VERSION = '3.3.0'
4
+ VERSION = '3.3.2'
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.3.0
4
+ version: 3.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zeryab Ali
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2022-09-16 00:00:00.000000000 Z
12
+ date: 2022-10-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty