solidus_bactracs 3.3.1 → 3.4.0

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: 1f2ad0b256952771d0f451dc24a4f3e18a42a0ebfc48947254a0473676fc9630
4
- data.tar.gz: c74eeec842d70239114ff695479c0dabeeefc4af3eb869f7493eca2df1bc78bd
3
+ metadata.gz: 9bbd41ca4504892004e3c4b39dd1688529cc02ca50dafbeb62b33f7f1bff14e4
4
+ data.tar.gz: 11c2cf0ee91d07eec4e08fa3ed2c5c0f4756cb2ef3e2cccacb605ee1d1f8dc74
5
5
  SHA512:
6
- metadata.gz: 5f0ed8d6d3fbca729db366a103ec0fc7ced78c9a9c41230d7467d0a2141292fbf398e08a8d64af8a915dbcab9569f1781a61215d196ea34d546f2fc21a25c4ae
7
- data.tar.gz: 8a2e482a15f81d577922a87462c21f83ba885d09a0b6fdc55e567236b5245ecbed8b51cd9a53ecb144664ca3e882f8677b754bb2abd23258f38283580e4953c5
6
+ metadata.gz: cb76a600bbefb62da8c9e066b9dec324c85506ebb7d616c2e3b6a857eff8f89133a08b0369f700e4441250e8342c093adbc4547951baf3a0da5b5b4f83347fca
7
+ data.tar.gz: 57eee50b741eb981483c6952aface01438f00bbd8fc7e7fae64819669997059009a72d3aafdcb4fb14c06466e18efc5dae6172497953eaffa6668cd39fc18c10
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby 2.7.2
1
+ 3.1.2
data/.tool-versions CHANGED
@@ -1 +1 @@
1
- ruby 2.7.2
1
+ ruby 3.1.1
@@ -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,8 @@ module SolidusBactracs
13
13
  def call(sguid: nil)
14
14
  order = @shipment.order
15
15
  user = @shipment.user
16
+ rma_type = safe_rma_type
17
+ rp_location = get_rp_location
16
18
 
17
19
  xml = Builder::XmlMarkup.new
18
20
  xml.instruct!(:xml, :encoding => "UTF-8")
@@ -23,7 +25,7 @@ module SolidusBactracs
23
25
  xml.sGuid sguid
24
26
  xml.NewRMA {
25
27
  xml.RMANumber @shipment.number
26
- xml.RMATypeName @shipment.rma_type.present? ? @shipment.rma_type : @config.evaluate_rma_type
28
+ xml.RMATypeName rma_type
27
29
  xml.RMASubTypeName
28
30
  xml.CustomerRef
29
31
  xml.InboundShippingPriority
@@ -92,10 +94,20 @@ module SolidusBactracs
92
94
  xml.WarrantyRepair
93
95
  xml.RMALineTest
94
96
  xml.InboundShipWeight variant.weight.to_f
95
- xml.RPLocation @config.default_rp_location
97
+ xml.RPLocation rp_location
96
98
  }
97
99
  end
98
100
 
101
+ def safe_rma_type
102
+ rma_type = @shipment.rma_type if (@shipment.respond_to?(:rma_type) && @shipment.rma_type.present?)
103
+ rma_type ||= @config.evaluate_rma_type.call(@shipment)
104
+ end
105
+
106
+ def get_rp_location
107
+ rp_location = @shipment.get_rma_rp_location if @shipment.get_rma_rp_location
108
+ @config.default_rp_location.call(@shipment)
109
+ end
110
+
99
111
  def find_sku_variant(variant)
100
112
  @config.sku_map[variant.sku].present? ? @config.sku_map[variant.sku] : variant.sku
101
113
  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.1'
4
+ VERSION = '3.4.0'
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.1
4
+ version: 3.4.0
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-11-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
@@ -233,7 +233,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
233
233
  - !ruby/object:Gem::Version
234
234
  version: '0'
235
235
  requirements: []
236
- rubygems_version: 3.1.4
236
+ rubygems_version: 3.3.7
237
237
  signing_key:
238
238
  specification_version: 4
239
239
  summary: A Solidus extension for integrating the Bactracs API.