Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add more fields from dhl xml response

  • Loading branch information...
commit 81cd5cee3f00481ffb846d50ca4b33e6e649f6fe 1 parent 805df06
Tim Case authored
View
8 lib/active_shipping/shipping/dhl_label_response.rb
@@ -9,8 +9,8 @@ class DhlLabelResponse < Response
:receiver_city, :receiver_division, :receiver_postal_code, :receiver_country,
:receiver_contact_name, :receiver_contact_phone, :outbound_sort_code, :destination_facility_code,
:inbound_sort_code, :message_reference, :account_number, :weight, :weight_unit,
- :awb_barcode, :origin_destination_barcode, :dhl_routing_barcode, :airway_bill_number
-
+ :awb_barcode, :origin_destination_barcode, :dhl_routing_barcode, :airway_bill_number,
+ :dhl_routing_code, :dhl_routing_data_id, :data_identifier, :license_plate
def initialize(success, message, res = {}, options = {})
res = res["ShipmentValidateResponse"]
@@ -58,6 +58,10 @@ def initialize(success, message, res = {}, options = {})
@origin_destination_barcode = res['Barcodes']['OriginDestnBarcode']
@dhl_routing_barcode = res['Barcodes']['DHLRoutingBarCode']
@airway_bill_number = res['AirwayBillNumber']
+ @dhl_routing_code = res['DHLRoutingCode']
+ @dhl_routing_data_id = res['DHLRoutingDataId']
+ @data_identifier = res['Pieces']['Piece']['DataIdentifier']
+ @license_plate = res['Pieces']['Piece']['LicensePlate']
end
def reference_data
View
12 test/fixtures/xml/dhl/ship_validate_response_europe_success.xml
@@ -107,17 +107,5 @@
<LicensePlate>JD011000000000047093</LicensePlate>
<LicensePlateBarCode>iVBORw0KGgoAAAANSUhEUgAAAZYAAABeAQMAAAA6+qC4AAAABlBMVEX///8AAABVwtN+AAAAZ0lEQVR42u3LoRVAUACG0Z9AUhREU1jBDCbQJUfwGllSnPO2eWOgkXSFGTThu/16ktqoW7ax6XNnQhMfgX1MWsmrFVgl5i7TK9uLweX9fK7TKPn6jsPhcDgcDofD4XA4HA6Hw/nTeQHjcxS8QkokKQAAAABJRU5ErkJggg==</LicensePlateBarCode>
</Piece>
- <Piece>
- <PieceNumber>2</PieceNumber>
- <Depth>38</Depth>
- <Width>25</Width>
- <Height>11</Height>
- <Weight>0.12</Weight>
- <PackageType>EE</PackageType>
- <DimWeight>2.090000</DimWeight>
- <DataIdentifier>J</DataIdentifier>
- <LicensePlate>JD011000000000047094</LicensePlate>
- <LicensePlateBarCode>iVBORw0KGgoAAAANSUhEUgAAAZYAAABeAQMAAAA6+qC4AAAABlBMVEX///8AAABVwtN+AAAAZ0lEQVR42u3LoRFAYACG4Y9AUhQUxzZmMIEuOcEfZUlxZwwbGAMJSVeYQRPepz+WpMqrh7Utm3Q2rvEPZ3xMmMsq5IwKzJ2FV7QlcTbt/bl0rWTrOw6Hw+FwOBwOh8PhcDgcDudP5wXhdRS8yvsB9wAAAABJRU5ErkJggg==</LicensePlateBarCode>
- </Piece>
</Pieces>
</res:ShipmentValidateResponse>
View
4 test/unit/carriers/dhl_test.rb
@@ -97,6 +97,10 @@ def test_parse_response
assert_equal "NOEEI 30.37(a)", parsed_label.eei
assert_equal "1/1", parsed_label.piece
assert_equal "4140594496", parsed_label.airway_bill_number
+ assert_equal "US90210+00000000", parsed_label.dhl_routing_code
+ assert_equal '2L', parsed_label.dhl_routing_data_id
+ assert_equal 'J', parsed_label.data_identifier
+ assert_equal 'JD011000000000047093', parsed_label.license_plate
end
# def test_generate_label
Please sign in to comment.
Something went wrong with that request. Please try again.