czech_post_b2b_client 1.2.5 → 1.2.6

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: 5b3d8606fd4218b5344ee5b5f6e6f9fae333851654d0b869d57d1c1f98fc16a8
4
- data.tar.gz: 8c2833143397c0b9d909f63da014f0228a1cd26d254765176b95b523e1ddf231
3
+ metadata.gz: 74fa378ca71040acf1adb94fb61fa1d371ae2491273b3585bed2ef14ce6911e8
4
+ data.tar.gz: efda7da207ddf3146be8181c4765f8cca645020131f3cda81e211fb5ff9ea828
5
5
  SHA512:
6
- metadata.gz: 248c7f29bdcbb1d7a50e55d7a81bc72eba16d0dfdbd4b980492501d62d280b8686823130eb3ceaf5853839825639d3aacca31e29777db0182da7407f73e98a67
7
- data.tar.gz: e92e86057e70d34eb7cb70494545708fa865a6cec42f2c8c0e57106e076dd8fddef4857fe68e6af0503718dc52c7146e6cdd58d56138abda7715f572d26ed26f
6
+ metadata.gz: 9752291d61873388331118b6167d212e40aab3ce344d0306f664ba245ac5e6515296dba98a97788b0604a39355a4514ac3d409b548d14e63efe3786f920cb627
7
+ data.tar.gz: 257ceece993bb225b3ec020667af0fab9c26edd0b2eb16c35d41c470f70c7b8377443da68dc7c057e9d1d237e4bc74743cf70a585a5ad7c6fe10152c86990a63
@@ -2,6 +2,10 @@
2
2
 
3
3
  All changes to the gem are documented here.
4
4
 
5
+ ## [1.2.6] - 2020-10-27
6
+
7
+ - fixed passing all errors from `parcelsServiceSync` response.
8
+
5
9
  ## [1.2.5] - 2020-10-06
6
10
 
7
11
  - `errorDescription` from `B2BError` response is now merged into error message.
@@ -61,36 +61,38 @@ module CzechPostB2bClient
61
61
  errors.add(:parcel, "Missing value for key { :#{key_chain.join(' => :')} } for parcel (parcel_id: '#{parcel_id}')!")
62
62
  end
63
63
  end
64
+
65
+ # TODO: check custom goods if present
64
66
  end
65
67
 
66
68
  def parcel_service_sync
67
69
  new_element('ns2:parcelServiceSyncRequest').tap do |ps_sync_request|
68
70
  add_element_to(ps_sync_request, do_parcel_header) # REQUIRED
69
- add_element_to(ps_sync_request, do_parcel_data) # optional
71
+ add_element_to(ps_sync_request, do_parcel_data) # REQUIRED
70
72
  end
71
73
  end
72
74
 
73
75
  def do_parcel_header # rubocop:disable Metrics/AbcSize
74
76
  new_element('ns2:doPOLSyncParcelHeader').tap do |parcel_header|
75
77
  add_element_to(parcel_header, 'ns2:transmissionDate', value: common_data[:parcels_sending_date].strftime('%d.%m.%Y')) # Predpokladane datum podani (format DD.MM.YYYY !)
76
- add_element_to(parcel_header, 'ns2:customerID', value: common_data[:customer_id]) # Technologicke cislo podavatele
78
+ add_element_to(parcel_header, 'ns2:customerID', value: common_data[:customer_id]) # Nepovinne: Technologicke cislo podavatele
77
79
  add_element_to(parcel_header, 'ns2:postCode', value: common_data[:sending_post_office_code]) # PSC podaci posty
78
80
  add_element_to(parcel_header, 'ns2:contractNumber', value: common_data[:contract_number]) # Nepovinne: Cislo zakazky
79
81
  add_element_to(parcel_header, 'ns2:frankingNumber', value: common_data[:franking_machine_number]) # Nepovinne: Cislo vyplatniho stroje
80
82
  add_element_to(parcel_header, 'ns2:transmissionEnd', value: common_data[:close_requests_batch]) # Nepovinna, default true: Indikace zda uzavrit podani, nebo budou jeste nasledovat dalsi requesty pro stejne podani
81
83
  add_element_to(parcel_header, 'ns2:locationNumber', value: common_data[:sending_post_office_location_number]) # Nepovinne: cislo podaciho mista (z nastaveni v Podani Online)
82
84
  add_element_to(parcel_header, 'ns2:senderCustCardNum', value: sender_data[:custom_card_number]) # Nepovinne: cislo zakaznicke karty odesilatele
83
- add_element_to(parcel_header, print_params)
85
+ add_element_to(parcel_header, print_params) # Nepovinne
84
86
  end
85
87
  end
86
88
 
87
89
  def do_parcel_data
88
90
  new_element('ns2:doPOLSyncParcelData').tap do |do_parcel_data|
89
- add_element_to(do_parcel_data, do_parcel_params)
91
+ add_element_to(do_parcel_data, do_parcel_params) # 1-5x
90
92
  add_element_to(do_parcel_data, do_parcel_address)
91
- add_element_to(do_parcel_data, do_parcel_address_document)
92
- add_element_to(do_parcel_data, do_parcel_customs_declaration)
93
- add_customs_documents_to(do_parcel_data)
93
+ add_element_to(do_parcel_data, do_parcel_address_document) # 0-1x
94
+ add_element_to(do_parcel_data, do_parcel_customs_declaration) # 0-1x
95
+ add_customs_documents_to(do_parcel_data) # 0-3x
94
96
  end
95
97
  end
96
98
 
@@ -221,6 +223,7 @@ module CzechPostB2bClient
221
223
  add_element_to(do_p_customs_declaration, 'ns2:customValCur', value: declaration_data[:value_currency_iso_code]) # ISO kod meny celni hodnoty
222
224
  add_element_to(do_p_customs_declaration, 'ns2:importerRefNum', value: declaration_data[:importer_reference_number]) # Nepovinne: Cislo dovozce
223
225
 
226
+ # 0-99x
224
227
  (declaration_data[:content_descriptions] || []).each do |dsc|
225
228
  do_p_customs_declaration << custom_goods_for(dsc)
226
229
  end
@@ -242,13 +245,13 @@ module CzechPostB2bClient
242
245
 
243
246
  def custom_goods_for(description_data)
244
247
  new_element('ns2:doPOLParcelCustomsGoods').tap do |do_p_customs_goods|
245
- add_element_to(do_p_customs_goods, 'ns2:sequence', value: description_data[:order].to_i) # Nepovinne: Poradi , cisl0 1-20
246
- add_element_to(do_p_customs_goods, 'ns2:customCont', value: description_data[:description]) # Nepovinne: Popis zbozi
247
- add_element_to(do_p_customs_goods, 'ns2:quantity', value: description_data[:quantity]) # Nepovinne: Mnozstvi
248
- add_element_to(do_p_customs_goods, 'ns2:weight', value: description_data[:weight_in_kg]) # Nepovinne: Hmotnost
249
- add_element_to(do_p_customs_goods, 'ns2:customVal', value: description_data[:value]) # Nepovinne: Celni hodnota
250
- add_element_to(do_p_customs_goods, 'ns2:hsCode', value: description_data[:hs_code]) # Nepovinne: HS kod
251
- add_element_to(do_p_customs_goods, 'ns2:iso', value: description_data[:origin_country_iso_code]) # Nepovinne: Zeme puvodu zbozi
248
+ add_element_to(do_p_customs_goods, 'ns2:sequence', value: description_data[:order].to_i) # Poradi , cisl0 1-20
249
+ add_element_to(do_p_customs_goods, 'ns2:customCont', value: description_data[:description]) # Popis zbozi
250
+ add_element_to(do_p_customs_goods, 'ns2:quantity', value: description_data[:quantity]) # Mnozstvi
251
+ add_element_to(do_p_customs_goods, 'ns2:weight', value: description_data[:weight_in_kg]) # Hmotnost
252
+ add_element_to(do_p_customs_goods, 'ns2:customVal', value: description_data[:value]) # Celni hodnota
253
+ add_element_to(do_p_customs_goods, 'ns2:hsCode', value: description_data[:hs_code]) # HS kod
254
+ add_element_to(do_p_customs_goods, 'ns2:iso', value: description_data[:origin_country_iso_code]) # Zeme puvodu zbozi
252
255
  end
253
256
  end
254
257
 
@@ -44,7 +44,11 @@ module CzechPostB2bClient
44
44
 
45
45
  def parcel_data_from(rp_hash)
46
46
  { parcel_code: rp_hash['parcelCode'],
47
- states: [state_hash_from(rp_hash.dig('parcelDataResponse'))] }
47
+ states: parcel_states_form(rp_hash.dig('parcelDataResponse')) }
48
+ end
49
+
50
+ def parcel_states_form(data_responses)
51
+ [data_responses].flatten.collect { |data_response| state_hash_from(data_response) }
48
52
  end
49
53
 
50
54
  def print_data_from(print_hash)
@@ -62,7 +66,6 @@ module CzechPostB2bClient
62
66
 
63
67
  def updated_result_value_for(value, parcel_params_result_hash)
64
68
  pd_hash = parcel_data_from(parcel_params_result_hash)
65
-
66
69
  return pd_hash if value.nil?
67
70
 
68
71
  # merging states
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CzechPostB2bClient
4
- VERSION = '1.2.5'
4
+ VERSION = '1.2.6'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: czech_post_b2b_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.5
4
+ version: 1.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Petr Mlčoch
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-06 00:00:00.000000000 Z
11
+ date: 2020-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ox