magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.57k stars 9.32k forks source link

UPS API Change Request #37534

Open ntmhung opened 1 year ago

ntmhung commented 1 year ago

Description

My client has informed me that starting from June 5, 2023, UPS no longer issues new access keys. UPS is going to change to use Oauth 2.0. image

I think the magento/module-ups module should be updated to meet the requirement. It needed to be done before June 5, 2023. This is the API document https://developer.ups.com/api/reference#operation/GenerateToken.

Expected behavior

The magento/module-ups supports using the OAuth security model from UPS.

Benefits

It will help new users planning to use the UPS shipping method connect to the UPS API after June 5, 2023.

Additional information

No response

Release note

No response

vipin1211987 commented 6 months ago

If you are facing lots of errors then hire any magento developer or buy any 3rd party extension.

rahuldambare commented 6 months ago

I have added patch of 2.4.4 in Magento 2.3 and override method in my custom module. However Sometimes I am getting error as "The shipping method is missing. Select the shipping method and try again." on payment page.

This error is coming from vendor/magento/module-quote/etc/di.xml from Magento\Quote\Model\ValidationRules\ShippingMethodValidationRule I have check there is shipping amount available in quote by adding log. Still getting same error.

Even I have data available in total_segments shipping still this error shows. when moving from shipping page to payment page order summary gets reload and shipping amount removed from order summary .

Functions I have override in my custom module after adding patch in 2.3 version as below protected function _getRestQuotes() protected function _parseRestResponse($rateResponse)

My Customization are available on url https://www.file.io/YghI/download/vfXL5oVlg3Cd

vipin1211987 commented 6 months ago

Not able to open file There was an error retrieving your file.

Connect us at ecomplugins support for integration help.

rahuldambare commented 6 months ago

Upsphp.txt Please check file here

vipin1211987 commented 6 months ago

There are many issues. Main issue with ups token. You can not call again and again. There are API limits. You must cache it.

You have many hardcoded variables and using session which also created these type issues like sometime showing shipping methods and next call hide rates.

rahuldambare commented 6 months ago

Could you please highlight the code or provide some correction which can help to fix this bug.

yomyyo commented 5 months ago

I've added the necessary lines to the API request, and am still getting significantly higher quotes on the REST API.

@jaminion the residential address indicator is being passed, which does increase the rates, but I am passing the same residential flag on the XML request so they should still be the same.

While debugging this issue, I've found that the stock M2 UPS REST patch sends "01" as the AddressLine on the Shipper and ShipTo, which doesn't appear to affect rates but is definitely not the correct address and should simply be removed.

Finally got word back from developer support. The issues with negotiated rate was due to using the non-production url to send our requests to (https://wwwcie.ups.com/api/rating/). We need to be using https://onlinetools.ups.com/api/rating/ to send our requests as that is the production URL

fballiano commented 5 months ago

ok, the default values where changed in 20.9.0 but they're also configurable in the backend

qrider commented 5 months ago

Hi, Does anyone know of a 2.3 patch? @rahuldambare looks like your link expired.

klou commented 2 months ago

M2.4.7-p2

Leaving this for anybody else:

Using UPS Type: United Parcel Service REST, can confirm that the Gateway REST URL and the Tracking REST URL need to change to (https://onlinetools.ups.com/api/rating/) and (https://onlinetools.ups.com/api/track/) instead of the original defaults, which were pointing to (https://wwwcie.ups.com/api/ rating or track /)

With the defaults, tracking responses kept giving results for Tracking Number "1Z1202R66698804005", no matter what the request tracking number was.

jaywilliams commented 2 months ago

@klou Thank you for sharing that information, that solves the issue I was experiencing with incorrect negotiated rates showing up.

I created this patch to change the Magento defaults to use the production API endpoint:

diff --git a/vendor/magento/module-ups/etc/config.xml b/vendor/magento/module-ups/etc/config.xml
index aaeccf87..10d21849 100644
--- a/vendor/magento/module-ups/etc/config.xml
+++ b/vendor/magento/module-ups/etc/config.xml
@@ -21,13 +21,13 @@
                 <free_method>GND</free_method>
                 <gateway_url>https://www.ups.com/using/services/rave/qcostcgi.cgi</gateway_url>
                 <gateway_xml_url>https://onlinetools.ups.com/ups.app/xml/Rate</gateway_xml_url>
-                <gateway_rest_url>https://wwwcie.ups.com/api/rating/</gateway_rest_url>
+                <gateway_rest_url>https://onlinetools.ups.com/api/rating/</gateway_rest_url>
                 <handling>0</handling>
                 <model>Magento\Ups\Model\Carrier</model>
                 <pickup>CC</pickup>
                 <title>United Parcel Service</title>
                 <tracking_xml_url>https://onlinetools.ups.com/ups.app/xml/Track</tracking_xml_url>
-                <tracking_rest_url>https://wwwcie.ups.com/api/track/</tracking_rest_url>
+                <tracking_rest_url>https://onlinetools.ups.com/api/track/</tracking_rest_url>
                 <unit_of_measure>LBS</unit_of_measure>
                 <username backend_model="Magento\Config\Model\Config\Backend\Encrypted" />
                 <password backend_model="Magento\Config\Model\Config\Backend\Encrypted" />

I'd also like to make everyone aware that Magento has released updated patches which fix an issue with UPS dimensional shipping. https://experienceleague.adobe.com/en/docs/commerce-knowledge-base/kb/troubleshooting/known-issues-patches-attached/ups-shipping-method-integration-migration-from-soap-to-restful-api

glo05363 commented 2 months ago

@klou and @jaywilliams thanks for your observation onto the same, internal team is looking into this if this is a required change and we will update you ASAP on this.

engcom-Bravo commented 2 months ago

Hi @ntmhung,

Internal team has looked into the issue and following are the observation:

As we have given the avenue of having a Live Account set as “No” by default which will work on sandbox authorisation and shipment. Where the user has the option of setting it up as “Yes” making it to production.

Screenshot 2024-09-09 at 6 54 34 PM

2.The same way as Live Account option , By Default we have given the Sandbox “Tracking” and “Rating” Urls which can be edited from admin panel to production Gateway Urls, and we kept the possibility open for the user to edit the same as they want. Screenshot 2024-09-09 at 9 56 44 PM

We have tried to keep it streamlined for REST APIs. Having said that we also understand that this may have caused some confusion. We will update the Developer documentation on “Sandbox” and “production” setup steps and information for the patches.

Thanks.

engcom-Bravo commented 2 months ago

Hi @ntmhung,

Our internal team has updated the Developer documentation on “Sandbox” and “production” setup steps. Please go through the same while you are setting up the shipping.

We will update further on the default URLs change once delivered.

Thanks.