From a4a89b3a7da2d868c6768b2d8189d9e270338023 Mon Sep 17 00:00:00 2001 From: Alessio Rendina Date: Tue, 16 Jul 2024 15:30:52 +0200 Subject: [PATCH] LPD-31640 Fix UPS CX --- .../liferay/ups/OptionsRestController.java | 42 +++++++++++-------- .../resources/application-default.properties | 8 ++++ 2 files changed, 32 insertions(+), 18 deletions(-) diff --git a/workspaces/liferay-ups-workspace/client-extensions/liferay-ups-commerce-shipping-engine/src/main/java/com/liferay/ups/OptionsRestController.java b/workspaces/liferay-ups-workspace/client-extensions/liferay-ups-commerce-shipping-engine/src/main/java/com/liferay/ups/OptionsRestController.java index 14198d791958b3..bcf144941c392d 100644 --- a/workspaces/liferay-ups-workspace/client-extensions/liferay-ups-commerce-shipping-engine/src/main/java/com/liferay/ups/OptionsRestController.java +++ b/workspaces/liferay-ups-workspace/client-extensions/liferay-ups-commerce-shipping-engine/src/main/java/com/liferay/ups/OptionsRestController.java @@ -278,32 +278,34 @@ private JSONObject _postRate( shippingAddressJSONObject.getString("regionISOCode") ) ) - ) - ).put( - "Shipper", - new JSONObject( ).put( - "Address", + "Shipper", new JSONObject( ).put( - "AddressLine", - new JSONArray( + "Address", + new JSONObject( ).put( - typeSettingsJSONObject.getString( - "shipperAddressLine1") + "AddressLine", + new JSONArray( + ).put( + typeSettingsJSONObject.getString( + "shipperAddressLine1") + ).put( + typeSettingsJSONObject.getString( + "shipperAddressLine2") + ).put( + typeSettingsJSONObject.getString( + "shipperAddressLine3") + ) ).put( + "CountryCode", typeSettingsJSONObject.getString( - "shipperAddressLine2") + "shipperCountryCode") ).put( + "PostalCode", typeSettingsJSONObject.getString( - "shipperAddressLine3") + "shipperPostalCode") ) - ).put( - "CountryCode", - typeSettingsJSONObject.getString("shipperCountryCode") - ).put( - "PostalCode", - typeSettingsJSONObject.getString("shipperPostalCode") ) ) ) @@ -339,7 +341,7 @@ private JSONObject _postRate( } } - return new JSONObject(StringPool.BLANK); + return new JSONObject(); } private JSONArray _toShippingOptionsJSONArray(JSONArray jsonArray) { @@ -348,6 +350,10 @@ private JSONArray _toShippingOptionsJSONArray(JSONArray jsonArray) { for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); + if (!jsonObject.has("RateResponse")) { + continue; + } + JSONObject rateResponseJSONObject = jsonObject.getJSONObject( "RateResponse"); diff --git a/workspaces/liferay-ups-workspace/client-extensions/liferay-ups-commerce-shipping-engine/src/main/resources/application-default.properties b/workspaces/liferay-ups-workspace/client-extensions/liferay-ups-commerce-shipping-engine/src/main/resources/application-default.properties index 26dddc1935cd3d..df521e7e44c7ba 100644 --- a/workspaces/liferay-ups-workspace/client-extensions/liferay-ups-commerce-shipping-engine/src/main/resources/application-default.properties +++ b/workspaces/liferay-ups-workspace/client-extensions/liferay-ups-commerce-shipping-engine/src/main/resources/application-default.properties @@ -1,3 +1,11 @@ +# +# LXC +# + +com.liferay.lxc.dxp.domains=localhost:8080 +com.liferay.lxc.dxp.mainDomain=localhost:8080 +com.liferay.lxc.dxp.server.protocol=http + # # OAuth #