solidus_bactracs 3.5.1 → 3.5.2

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: 4e535e8a59bea282ee76d1fe01b99f738d19061abf29d1745e40bdcce792337e
4
- data.tar.gz: 75d5f6d07e1fd88e1f30c46418c674059b582aca33a884b16830be441d39a708
3
+ metadata.gz: 3d733c0f761c26283033cc63a123d7104fda4400a5ad918929d525be036a4206
4
+ data.tar.gz: 30b2aee8a90add793153cf78faa81586915f8b6eb8f452621d6652f5adb758e3
5
5
  SHA512:
6
- metadata.gz: 39918c8782cd792f3fa091b2762dda89ea07db28a33a0598711fa561010a9eef293e2d7eb94c5f921f23a49a9afef5d995ee242f3a8fb4ce949f41a53d36f038
7
- data.tar.gz: b47a72baad881dfe7645addb7caadf4be5529d90d625b73bd32341d992d04ad110d56f7dc8730744a46ba55cb6edb45b1e3a19bbe6efe78a6363fbb2a17822c4
6
+ metadata.gz: a0bb9e80092aff503373648fffa19326d05a9030e6c0cb0f2ec3c86ae7930f814139af289af5ffdbdd5e73c6460e0d8624b635d961a64d78f0e17be027d180db
7
+ data.tar.gz: adebc9074bb74fc6e2983e76a55948062485571856164116741a839ef2a6b3327528bbe08549ddaa52ce8c0dbd93ce22061d649ef533a1e0d5433256f8abcbef
data/.tool-versions CHANGED
@@ -1 +1 @@
1
- ruby 3.1.1
1
+ ruby 3.1.2
@@ -29,7 +29,7 @@ module SolidusBactracs
29
29
  Rails.logger.info({ event: 'success CreateRMA', rma: shipment.number, response: parse_rma_creation_response(rma_response, "Message")})
30
30
  shipment_synced(shipment)
31
31
  return true
32
- elsif rma_exists?(rma_response)
32
+ elsif rma_exists?(rma_response) or rma_fail?(rma_response)
33
33
  return false
34
34
  else
35
35
  clear_cache
@@ -89,7 +89,7 @@ module SolidusBactracs
89
89
 
90
90
  raise RequestError.from_response(@response) unless @response # just try again for @retries?
91
91
  if "false" == parse_authentication_response(@response, "Result")
92
- Rails.logger.warn({ event: 'bactracs auth failed', error: parse_authentication_response(@response, "Message")})
92
+ Rails.logger.error({ event: 'bactracs auth failed', error: parse_authentication_response(@response, "Message")})
93
93
  raise RequestError.from_response(@response)
94
94
  end
95
95
  sguid = parse_authentication_response(@response, "Message")
@@ -110,12 +110,20 @@ module SolidusBactracs
110
110
  end
111
111
 
112
112
  def rma_exists?(response)
113
+ if parse_rma_creation_response(response, "Message").match(/failed CreateRMA/)
114
+ Rails.logger.error({ event: 'bactracs failed CreateRMA', error: parse_rma_creation_response(response, "Message")})
115
+ return true
116
+ end
117
+ end
118
+
119
+ def rma_fail?(response)
113
120
  if parse_rma_creation_response(response, "Message").match(/rma .* already exists/)
114
- Rails.logger.warn({ event: 'bactracs failed CreateRMA', error: parse_rma_creation_response(response, "Message")})
121
+ Rails.logger.error({ event: 'bactracs failed CreateRMA', error: parse_rma_creation_response(response, "Message")})
115
122
  return true
116
123
  end
117
124
  end
118
125
 
126
+
119
127
  def shipment_synced(shipment)
120
128
  shipment.update_attribute(:bactracs_synced_at, Time.zone.now)
121
129
 
@@ -69,8 +69,9 @@ module SolidusBactracs
69
69
  end
70
70
  end
71
71
  end
72
- Rails.logger.info(xml.to_s)
73
- xml
72
+ # Rails.logger.info(xml.to_s)
73
+ @xml = xml.to_xml.sub(/<to_xml\/>$/,'')
74
+ return @xml
74
75
  end
75
76
 
76
77
  def line_items_xml(xml: nil, line_item: nil, variant: nil, order: nil)
@@ -36,7 +36,7 @@ module SolidusBactracs
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
39
- @cursor += 1
39
+ @cursor += 1 if (a_shipment == @shipments[@cursor] || shipment == @shipments[@cursor])
40
40
  return resp
41
41
  end
42
42
  ensure
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidusBactracs
4
- VERSION = '3.5.1'
4
+ VERSION = '3.5.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.5.1
4
+ version: 3.5.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-11-14 00:00:00.000000000 Z
12
+ date: 2023-08-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty