Skip to content

Commit 39756ef

Browse files
committed
fixed mftf and integration test failures
1 parent 915c1de commit 39756ef

File tree

11 files changed

+408
-513
lines changed

11 files changed

+408
-513
lines changed

app/code/Magento/Ups/Model/Carrier.php

Lines changed: 1 addition & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,82 +1454,6 @@ private function generateShipmentDescription(array $items): string
14541454
return substr(implode(' ', $itemsDesc), 0, 35);
14551455
}
14561456

1457-
/**
1458-
* Send and process shipment accept request
1459-
*
1460-
* @param Element $shipmentConfirmResponse
1461-
* @return DataObject
1462-
* @deprecated 100.3.3 New asynchronous methods introduced.
1463-
* @see requestToShipment
1464-
*/
1465-
protected function _sendShipmentAcceptRequest(Element $shipmentConfirmResponse)
1466-
{
1467-
$xmlRequest = $this->_xmlElFactory->create(
1468-
['data' => '<?xml version = "1.0" ?><ShipmentAcceptRequest/>']
1469-
);
1470-
$request = $xmlRequest->addChild('Request');
1471-
$request->addChild('RequestAction', 'ShipAccept');
1472-
$xmlRequest->addChild('ShipmentDigest', $shipmentConfirmResponse->ShipmentDigest);
1473-
$debugData = ['request' => $this->filterDebugData($this->_xmlAccessRequest) . $xmlRequest->asXML()];
1474-
1475-
try {
1476-
$deferredResponse = $this->asyncHttpClient->request(
1477-
new Request(
1478-
$this->getShipAcceptUrl(),
1479-
Request::METHOD_POST,
1480-
['Content-Type' => 'application/xml'],
1481-
$this->_xmlAccessRequest . $xmlRequest->asXML()
1482-
)
1483-
);
1484-
$xmlResponse = $deferredResponse->get()->getBody();
1485-
$debugData['result'] = $xmlResponse;
1486-
$this->_setCachedQuotes($xmlRequest, $xmlResponse);
1487-
} catch (Throwable $e) {
1488-
$debugData['result'] = ['error' => $e->getMessage(), 'code' => $e->getCode()];
1489-
$xmlResponse = '';
1490-
}
1491-
1492-
$response = '';
1493-
try {
1494-
$response = $this->_xmlElFactory->create(['data' => $xmlResponse]);
1495-
} catch (Throwable $e) {
1496-
$response = $this->_xmlElFactory->create(['data' => '']);
1497-
$debugData['result'] = ['error' => $e->getMessage(), 'code' => $e->getCode()];
1498-
}
1499-
1500-
$result = new DataObject();
1501-
if (isset($response->Error)) {
1502-
$result->setErrors((string)$response->Error->ErrorDescription);
1503-
} else {
1504-
$shippingLabelContent = (string)$response->ShipmentResults->PackageResults->LabelImage->GraphicImage;
1505-
$trackingNumber = (string)$response->ShipmentResults->PackageResults->TrackingNumber;
1506-
1507-
// phpcs:ignore Magento2.Functions.DiscouragedFunction
1508-
$result->setShippingLabelContent(base64_decode($shippingLabelContent));
1509-
$result->setTrackingNumber($trackingNumber);
1510-
}
1511-
1512-
$this->_debug($debugData);
1513-
1514-
return $result;
1515-
}
1516-
1517-
/**
1518-
* Get ship accept url
1519-
*
1520-
* @return string
1521-
*/
1522-
public function getShipAcceptUrl()
1523-
{
1524-
if ($this->getConfigData('is_account_live')) {
1525-
$url = $this->_liveUrls['ShipAccept'];
1526-
} else {
1527-
$url = $this->_defaultUrls['ShipAccept'];
1528-
}
1529-
1530-
return $url;
1531-
}
1532-
15331457
/**
15341458
* Request quotes for given packages.
15351459
*
@@ -1666,7 +1590,7 @@ protected function _doShipmentRequest(DataObject $request)
16661590
if ($result->hasErrors() || empty($response)) {
16671591
return $result;
16681592
} else {
1669-
return $this->_sendShipmentAcceptRequest($response);
1593+
return '';
16701594
}
16711595
}
16721596

app/code/Magento/Ups/Model/UpsOauth.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class UpsOauth
3131
*/
3232
protected $jsonSerializer;
3333

34-
public const TEST_AUTH_URL = 'https://onlinetools.ups.com/security/v1/oauth/token';
34+
public const TEST_AUTH_URL = 'https://wwwcie.ups.com/security/v1/oauth/token';
3535

3636
/**
3737
*

app/code/Magento/Ups/Test/Mftf/Section/AdminShippingMethodsUpsSection.xml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,9 @@
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="AdminShippingMethodsUpsSection">
1212
<element name="carriersUpsTab" type="button" selector="#carriers_ups-head"/>
13-
<element name="carriersUpsType" type="select" selector="#carriers_ups_type"/>
14-
<element name="selectedUpsType" type="text" selector="#carriers_ups_type option[selected]"/>
1513
<element name="carriersUPSActive" type="input" selector="#carriers_ups_active_inherit"/>
16-
<element name="carriersUPSTypeSystem" type="input" selector="#carriers_ups_type_inherit"/>
1714
<element name="carriersUPSAccountLive" type="input" selector="#carriers_ups_is_account_live_inherit"/>
18-
<element name="carriersUPSGatewayXMLUrl" type="input" selector="#carriers_ups_gateway_xml_url_inherit"/>
15+
<element name="carriersUPSGatewayUrl" type="input" selector="#carriers_ups_gateway_url_inherit"/>
1916
<element name="carriersUPSModeXML" type="input" selector="#carriers_ups_mode_xml_inherit"/>
2017
<element name="carriersUPSOriginShipment" type="input" selector="#carriers_ups_origin_shipment_inherit"/>
2118
<element name="carriersUPSTitle" type="input" selector="#carriers_ups_title_inherit"/>
@@ -24,7 +21,7 @@
2421
<element name="carriersUPSShipmentRequestType" type="input" selector="#carriers_ups_shipment_requesttype_inherit"/>
2522
<element name="carriersUPSContainer" type="input" selector="#carriers_ups_container_inherit"/>
2623
<element name="carriersUPSDestType" type="input" selector="#carriers_ups_dest_type_inherit"/>
27-
<element name="carriersUPSTrackingXmlUrl" type="input" selector="#carriers_ups_tracking_xml_url_inherit"/>
24+
<element name="carriersUPSTrackingUrl" type="input" selector="#carriers_ups_tracking_url_inherit"/>
2825
<element name="carriersUPSUnitOfMeasure" type="input" selector="#carriers_ups_unit_of_measure_inherit"/>
2926
<element name="carriersUPSMaxPackageWeight" type="input" selector="#carriers_ups_max_package_weight_inherit"/>
3027
<element name="carriersUPSPickup" type="input" selector="#carriers_ups_pickup_inherit"/>

app/code/Magento/Ups/Test/Mftf/Test/AdminCheckInputFieldsDisabledAfterAppConfigDumpTest.xml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,14 @@
1919
<actualResult type="const">$grabUPSActiveDisabled</actualResult>
2020
<expectedResult type="string">true</expectedResult>
2121
</assertEquals>
22-
<grabAttributeFrom selector="{{AdminShippingMethodsUpsSection.carriersUPSTypeSystem}}" userInput="disabled" stepKey="grabUPSTypeDisabled"/>
23-
<assertEquals stepKey="assertUPSTypeDisabled">
24-
<actualResult type="const">$grabUPSTypeDisabled</actualResult>
25-
<expectedResult type="string">true</expectedResult>
26-
</assertEquals>
2722
<grabAttributeFrom selector="{{AdminShippingMethodsUpsSection.carriersUPSAccountLive}}" userInput="disabled" stepKey="grabUPSAccountLiveDisabled"/>
2823
<assertEquals stepKey="assertUPSAccountLiveDisabled">
2924
<actualResult type="const">$grabUPSAccountLiveDisabled</actualResult>
3025
<expectedResult type="string">true</expectedResult>
3126
</assertEquals>
32-
<grabAttributeFrom selector="{{AdminShippingMethodsUpsSection.carriersUPSGatewayXMLUrl}}" userInput="disabled" stepKey="grabUPSGatewayXMLUrlDisabled"/>
33-
<assertEquals stepKey="assertUPSGatewayXMLUrlDisabled">
34-
<actualResult type="const">$grabUPSGatewayXMLUrlDisabled</actualResult>
27+
<grabAttributeFrom selector="{{AdminShippingMethodsUpsSection.carriersUPSGatewayUrl}}" userInput="disabled" stepKey="grabUPSGatewayUrlDisabled"/>
28+
<assertEquals stepKey="assertUPSGatewayUrlDisabled">
29+
<actualResult type="const">$grabUPSGatewayUrlDisabled</actualResult>
3530
<expectedResult type="string">true</expectedResult>
3631
</assertEquals>
3732
<grabAttributeFrom selector="{{AdminShippingMethodsUpsSection.carriersUPSModeXML}}" userInput="disabled" stepKey="grabUPSModeXMLDisabled"/>
@@ -74,9 +69,9 @@
7469
<actualResult type="const">$grabUPSDestTypeDisabled</actualResult>
7570
<expectedResult type="string">true</expectedResult>
7671
</assertEquals>
77-
<grabAttributeFrom selector="{{AdminShippingMethodsUpsSection.carriersUPSTrackingXmlUrl}}" userInput="disabled" stepKey="grabUPSTrackingXmlUrlDisabled"/>
78-
<assertEquals stepKey="assertUPSTrackingXmlUrlDisabled">
79-
<actualResult type="const">$grabUPSTrackingXmlUrlDisabled</actualResult>
72+
<grabAttributeFrom selector="{{AdminShippingMethodsUpsSection.carriersUPSTrackingUrl}}" userInput="disabled" stepKey="grabUPSTrackingUrlDisabled"/>
73+
<assertEquals stepKey="assertUPSTrackingUrlDisabled">
74+
<actualResult type="const">$grabUPSTrackingUrlDisabled</actualResult>
8075
<expectedResult type="string">true</expectedResult>
8176
</assertEquals>
8277
<grabAttributeFrom selector="{{AdminShippingMethodsUpsSection.carriersUPSUnitOfMeasure}}" userInput="disabled" stepKey="grabUPSUnitOfMeasureDisabled"/>

app/code/Magento/Ups/Test/Mftf/Test/DefaultConfigForUPSTypeTest.xml

Lines changed: 0 additions & 51 deletions
This file was deleted.

app/code/Magento/Ups/view/adminhtml/templates/system/shipping/carrier_config.phtml

Lines changed: 10 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -75,29 +75,22 @@ require(["prototype"], function(){
7575
initialize: function()
7676
{
7777
this.carriersUpsActiveId = 'carriers_ups_active';
78-
this.carriersUpsTypeId = 'carriers_ups_type';
79-
if (!$(this.carriersUpsTypeId)) {
80-
return;
81-
}
8278
83-
this.checkingUpsXmlId = ['carriers_ups_gateway_xml_url','carriers_ups_username',
84-
'carriers_ups_password','carriers_ups_access_license_number'];
85-
this.checkingUpsId = ['carriers_ups_gateway_url'];
79+
this.checkingUpsXmlId = ['carriers_ups_gateway_url','carriers_ups_username',
80+
'carriers_ups_password'];
8681
this.originShipmentTitle = '';
8782
this.allowedMethodsId = 'carriers_ups_allowed_methods';
8883
this.freeShipmentId = 'carriers_ups_free_method';
89-
this.onlyUpsXmlElements = ['carriers_ups_gateway_xml_url','carriers_ups_tracking_xml_url',
90-
'carriers_ups_username','carriers_ups_password','carriers_ups_access_license_number',
84+
this.onlyUpsXmlElements = ['carriers_ups_gateway_url','carriers_ups_tracking_url',
85+
'carriers_ups_username','carriers_ups_password',
9186
'carriers_ups_origin_shipment','carriers_ups_negotiated_active','carriers_ups_shipper_number',
9287
'carriers_ups_mode_xml','carriers_ups_include_taxes'];
93-
this.onlyUpsElements = ['carriers_ups_gateway_url'];
9488
this.authUpsXmlElements = ['carriers_ups_username',
95-
'carriers_ups_password','carriers_ups_access_license_number'];
89+
'carriers_ups_password'];
9690
9791
script;
9892
$scriptString .= 'this.storedOriginShipment = \'' . /* @noEscape */ $storedOriginShipment . '\';
99-
this.storedFreeShipment = \'' . /* @noEscape */ $storedFreeShipment . '\';
100-
this.storedUpsType = \'' . /* @noEscape */ $storedUpsType . '\';';
93+
this.storedFreeShipment = \'' . /* @noEscape */ $storedFreeShipment . '\';';
10194
?>
10295
<?php $scriptString .= 'this.storedAllowedMethods = '
10396
. /* @noEscape */ $jsonHelper->jsonEncode($storedAllowedMethods) . ';
@@ -106,7 +99,6 @@ $scriptString .= 'this.storedOriginShipment = \'' . /* @noEscape */ $storedOrigi
10699

107100
$scriptString .= <<<script
108101
this.setFormValues();
109-
Event.observe($(this.carriersUpsTypeId), 'change', this.setFormValues.bind(this));
110102
Event.observe($(this.carriersUpsActiveId), 'change', this.setFormValues.bind(this));
111103
},
112104
updateAllowedMethods: function(originShipmentTitle)
@@ -141,11 +133,7 @@ $scriptString .= <<<script
141133
freeMethod.insert(option);
142134
143135
option = new Element('option', {value:code}).update(originShipment[code]);
144-
if (this.storedUpsType == 'UPS') {
145-
if (originShipmentTitle != 'default' || inArray(this.storedAllowedMethods, code)) {
146-
option.selected = true;
147-
}
148-
} else if (originShipmentTitle != this.storedOriginShipment
136+
if (originShipmentTitle != this.storedOriginShipment
149137
|| inArray(this.storedAllowedMethods, code)
150138
) {
151139
option.selected = true;
@@ -163,34 +151,19 @@ $scriptString .= <<<script
163151
setFormValues: function()
164152
{
165153
var a;
166-
if (\$F(this.carriersUpsTypeId) == 'UPS') {
167-
for (a = 0; a < this.checkingUpsXmlId.length; a++) {
168-
$(this.checkingUpsXmlId[a]).removeClassName('required-entry');
169-
}
170-
for (a = 0; a < this.checkingUpsId.length; a++) {
171-
$(this.checkingUpsId[a]).addClassName('required-entry');
172-
this.changeFieldsDisabledState(this.checkingUpsId, a);
173-
}
174-
Event.stopObserving($('carriers_ups_origin_shipment'), 'change', this.changeOriginShipment.bind(this));
175-
showRowArrayElements(this.onlyUpsElements);
176-
hideRowArrayElements(this.onlyUpsXmlElements);
177-
this.changeOriginShipment(null, 'default');
178-
} else {
154+
179155
for (a = 0; a < this.checkingUpsXmlId.length; a++) {
180156
$(this.checkingUpsXmlId[a]).addClassName('required-entry');
181157
this.changeFieldsDisabledState(this.checkingUpsXmlId, a);
182158
}
183-
for (a = 0; a < this.checkingUpsId.length; a++) {
184-
$(this.checkingUpsId[a]).removeClassName('required-entry');
185-
}
159+
186160
Event.observe($('carriers_ups_origin_shipment'), 'change', this.changeOriginShipment.bind(this));
187161
showRowArrayElements(this.onlyUpsXmlElements);
188162
if (\$F(this.carriersUpsActiveId) !== '1'){
189163
hideRowArrayElements(this.authUpsXmlElements);
190164
}
191-
hideRowArrayElements(this.onlyUpsElements);
192165
this.changeOriginShipment(null, null);
193-
}
166+
194167
},
195168
changeOriginShipment: function(Event, key)
196169
{

app/code/Magento/Usps/Test/Mftf/Section/AdminShippingMethodUSPSSection.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<element name="carriersUSPSContainer" type="input" selector="#carriers_usps_container_inherit"/>
2121
<element name="carriersUSPSSize" type="input" selector="#carriers_usps_size_inherit"/>
2222
<element name="carriersUSPSDestType" type="input" selector="#carriers_usps_machinable_inherit"/>
23-
<element name="carriersUSPSMachinable" type="input" selector="#carriers_ups_tracking_xml_url_inherit"/>
23+
<element name="carriersUSPSMachinable" type="input" selector="#carriers_ups_tracking_url_inherit"/>
2424
<element name="carriersUSPSMaxPackageWeight" type="input" selector="#carriers_usps_max_package_weight_inherit"/>
2525
<element name="carriersUSPSHandlingType" type="input" selector="#carriers_usps_handling_type_inherit"/>
2626
<element name="carriersUSPSHandlingAction" type="input" selector="#carriers_usps_handling_action_inherit"/>

0 commit comments

Comments
 (0)