Sha256: b7244838389badcd6c951a92cc61e1d513c3219cc1740632288e518e62dfe5c7
Contents?: true
Size: 1.2 KB
Versions: 9
Compression:
Stored size: 1.2 KB
Contents
# frozen_string_literal: true module CzechPostB2bClient module ResponseParsers class SendParcelsParser < BaseParser def build_result super @result[:async_result] = { transaction_id: response_header.dig('idTransaction'), processing_end_expected_at: parse_time_with_correction(response_header.dig('timeStampProcessing')) } end def parse_time_with_correction(b2b_time_str) # b2b time in XML is NOT CORRECT! They return CET time value with UTC timezone # Like `2016-02-25T09:30:03.678Z`, which is actually `2016-02-25T09:30:03.678+0100` (CET) # Or `2016-05-25T09:30:03.678Z`, which is actually `2016-05-25T09:30:03.678+0200` (CET + DST) # But we must be prepare for unnoticed fix by CPost # unfortunattely this can be done for only freshly generated XMLs (comparing b2b_time with Time.now.utc) # but we have to kepp it compatible for old XML # so we pass it up and leave comments in documenation # Users of this gem will have to care of it Time.parse(b2b_time_str) end # just for info def cpost_time_zone timezone('Europe/Prague') end end end end
Version data entries
9 entries across 9 versions & 1 rubygems