Skip to content

Commit c7703d1

Browse files
authored
Merge pull request #278 from friendlycart/ups/add-extended-area-surcharge-code
Add UPS surcharge code 495 to money hash parser
2 parents d7e5e70 + 0da9c95 commit c7703d1

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

lib/friendly_shipping/services/rl/parse_rate_quote_response.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ def call(request:, response:)
3434
end
3535
end
3636

37-
private
38-
3937
# The currency to use when parsing the rate quotes.
40-
CURRENCY = Money::Currency.new('USD').freeze
38+
CURRENCY = Money::Currency.new('USD')
39+
40+
private
4141

4242
# Builds {Rate} instances from the parsed JSON.
4343
#

lib/friendly_shipping/services/ups_json/parse_money_hash.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ def self.call(money_hash, key_name)
105105
"470" => "COMMITTED DELIVERY WINDOW",
106106
"480" => "SECURITY SURCHARGE",
107107
"492" => "CUSTOMER TRANSACTION FEE",
108+
"495" => "EXTENDED AREA SURCHARGE",
108109
"500" => "SHIPMENT COD",
109110
"510" => "LIFT GATE FOR PICKUP",
110111
"511" => "LIFT GATE FOR DELIVERY",

lib/friendly_shipping/services/usps_international/parse_rate_response.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ def call(request:, response:, shipment:, options:)
5151
end
5252
end
5353

54-
private
55-
5654
PACKAGE_NODE_XPATH = '//Package'
5755
SERVICE_NODE_NAME = 'Service'
5856

57+
private
58+
5959
# Iterate over all packages and parse the rates for each package
6060
#
6161
# @param [Nokogiri::XML::Node] xml The XML document containing packages and rates

lib/friendly_shipping/services/usps_ship/parse_rate_estimates_response.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def call(request:, response:)
3535

3636
success(rates, request, response)
3737
rescue JSON::ParserError, KeyError => e
38-
failure(e.message, request, response)
38+
failure(e, request, response)
3939
end
4040

4141
private

spec/friendly_shipping/services/usps_ship/parse_rate_estimates_response_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
it "returns failure" do
4848
failure = call.failure
4949
expect(failure).to be_a(FriendlyShipping::ApiResult)
50-
expect(failure.data).to eq("unexpected token at 'malformed json'")
50+
expect(failure.data).to be_a(JSON::ParserError)
5151
expect(failure.original_request).to eq(request)
5252
expect(failure.original_response).to eq(response)
5353
end

spec/friendly_shipping/services/usps_ship/parse_timings_response_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
failure = call.failure
6565
expect(failure).to be_a(FriendlyShipping::ApiResult)
6666
expect(failure.data).to be_a(JSON::ParserError)
67-
expect(failure.data.message).to eq("unexpected token at 'malformed json'")
6867
expect(failure.original_request).to eq(request)
6968
expect(failure.original_response).to eq(response)
7069
end

0 commit comments

Comments
 (0)