Skip to content

Commit e9b684f

Browse files
committed
#AC-9653::UPS SOAP and REST support in 2.4.7-beta3-unit and integration fixes
1 parent 126d8dc commit e9b684f

File tree

2 files changed

+70
-14
lines changed

2 files changed

+70
-14
lines changed

app/code/Magento/Ups/Test/Unit/Model/CarrierTest.php

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ public function requestToShipmentDataProvider(): array
427427
'recipient_address_country_code' => 'US',
428428
'shipper_address_state_or_province_code' => 'PR',
429429
'shipper_address_postal_code' => '00968',
430-
'shipper_address_country_code' => 'PR',
430+
'shipper_address_country_code' => 'US',
431431
]
432432
],
433433
[
@@ -442,7 +442,7 @@ public function requestToShipmentDataProvider(): array
442442
[
443443
'recipient_address_state_or_province_code' => 'PR',
444444
'recipient_address_postal_code' => '00968',
445-
'recipient_address_country_code' => 'PR',
445+
'recipient_address_country_code' => 'US',
446446
'shipper_address_state_or_province_code' => 'CA',
447447
'shipper_address_postal_code' => '90230',
448448
'shipper_address_country_code' => 'US',
@@ -468,6 +468,7 @@ public function getCountryById(?string $id): Country
468468
}
469469

470470
/**
471+
* @param string $carrierType
471472
* @param string $methodType
472473
* @param string $methodCode
473474
* @param string $methodTitle
@@ -478,6 +479,7 @@ public function getCountryById(?string $id): Country
478479
* @dataProvider allowedMethodsDataProvider
479480
*/
480481
public function testGetAllowedMethods(
482+
string $carrierType,
481483
string $methodType,
482484
string $methodCode,
483485
string $methodTitle,
@@ -493,6 +495,12 @@ public function testGetAllowedMethods(
493495
null,
494496
$allowedMethods
495497
],
498+
[
499+
'carriers/ups/type',
500+
ScopeInterface::SCOPE_STORE,
501+
null,
502+
$carrierType
503+
],
496504
[
497505
'carriers/ups/origin_shipment',
498506
ScopeInterface::SCOPE_STORE,
@@ -515,20 +523,31 @@ public function allowedMethodsDataProvider(): array
515523
{
516524
return [
517525
[
526+
'UPS',
527+
'method',
528+
'1DM',
529+
'Next Day Air Early AM',
530+
'',
531+
[]
532+
],
533+
[
534+
'UPS',
535+
'method',
536+
'1DM',
537+
'Next Day Air Early AM',
538+
'1DM,1DML,1DA',
539+
['1DM' => 'Next Day Air Early AM']
540+
],
541+
[
542+
'UPS_XML',
518543
'originShipment',
519544
'01',
520545
'UPS Next Day Air',
521546
'01,02,03',
522547
['01' => 'UPS Next Day Air']
523548
],
524549
[
525-
'originShipment',
526-
'02',
527-
'UPS Second Day Air',
528-
'01,02,03',
529-
['02' => 'UPS Second Day Air']
530-
],
531-
[
550+
'UPS_REST',
532551
'originShipment',
533552
'03',
534553
'UPS Ground',

dev/tests/integration/testsuite/Magento/Ups/Model/CarrierTest.php

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,35 @@ function (string $message) {
8383
'upsAuth' => $this->upsAuthMock]);
8484
}
8585

86+
/**
87+
* @return void
88+
*/
89+
public function testGetShipAcceptUrl()
90+
{
91+
$this->assertEquals('https://wwwcie.ups.com/ups.app/xml/ShipAccept', $this->carrier->getShipAcceptUrl());
92+
}
93+
94+
/**
95+
* Test ship accept url for live site
96+
*
97+
* @magentoConfigFixture current_store carriers/ups/is_account_live 1
98+
*/
99+
public function testGetShipAcceptUrlLive()
100+
{
101+
$this->assertEquals('https://onlinetools.ups.com/ups.app/xml/ShipAccept', $this->carrier->getShipAcceptUrl());
102+
}
103+
86104
/**
87105
* @return void
88106
*/
89107
public function testGetShipConfirmUrl()
90108
{
91-
$this->assertEquals('https://wwwcie.ups.com/api/shipments/v1/ship', $this->carrier->getShipConfirmUrl());
109+
if ($this->carrier->getConfigData('type') == 'UPS_XML') {
110+
$this->assertEquals('https://wwwcie.ups.com/ups.app/xml/ShipConfirm', $this->carrier->getShipConfirmUrl());
111+
} else {
112+
$this->assertEquals('https://wwwcie.ups.com/api/shipments/v1/ship', $this->carrier->getShipConfirmUrl());
113+
}
114+
92115
}
93116

94117
/**
@@ -98,16 +121,25 @@ public function testGetShipConfirmUrl()
98121
*/
99122
public function testGetShipConfirmUrlLive()
100123
{
101-
$this->assertEquals(
102-
'https://onlinetools.ups.com/api/shipments/v1/ship',
103-
$this->carrier->getShipConfirmUrl()
104-
);
124+
if ($this->carrier->getConfigData('type') == 'UPS_XML') {
125+
$this->assertEquals(
126+
'https://onlinetools.ups.com/ups.app/xml/ShipConfirm',
127+
$this->carrier->getShipConfirmUrl()
128+
);
129+
} else {
130+
$this->assertEquals(
131+
'https://onlinetools.ups.com/api/shipments/v1/ship',
132+
$this->carrier->getShipConfirmUrl()
133+
);
134+
}
135+
105136
}
106137

107138
/**
108139
* Collect rates for UPS Ground method.
109140
*
110141
* @magentoConfigFixture current_store carriers/ups/active 1
142+
* @magentoConfigFixture current_store carriers/ups/type UPS_REST
111143
* @magentoConfigFixture current_store carriers/ups/allowed_methods 03
112144
* @magentoConfigFixture current_store carriers/ups/free_method 03
113145
* @magentoConfigFixture default_store carriers/ups/shipper_number 12345
@@ -168,6 +200,7 @@ public function testCollectFreeRates()
168200
* @dataProvider collectRatesDataProvider
169201
* @magentoConfigFixture default_store shipping/origin/country_id GB
170202
* @magentoConfigFixture default_store carriers/ups/active 1
203+
* @magentoConfigFixture current_store carriers/ups/type UPS_REST
171204
* @magentoConfigFixture default_store carriers/ups/shipper_number 12345
172205
* @magentoConfigFixture default_store carriers/ups/origin_shipment Shipments Originating in the European Union
173206
* @magentoConfigFixture default_store carriers/ups/username user
@@ -230,6 +263,7 @@ public function testCollectRates(int $negotiable, int $tax, int $responseId, str
230263
* @return void
231264
* @magentoConfigFixture default_store shipping/origin/country_id GB
232265
* @magentoConfigFixture default_store carriers/ups/active 1
266+
* @magentoConfigFixture default_store carriers/ups/type UPS_REST
233267
* @magentoConfigFixture default_store carriers/ups/shipper_number 12345
234268
* @magentoConfigFixture default_store carriers/ups/origin_shipment Shipments Originating in the European Union
235269
* @magentoConfigFixture default_store carriers/ups/username user
@@ -287,6 +321,7 @@ public function collectRatesDataProvider()
287321
*
288322
* @magentoConfigFixture default_store shipping/origin/country_id GB
289323
* @magentoConfigFixture default_store carriers/ups/active 1
324+
* @magentoConfigFixture default_store carriers/ups/type UPS_REST
290325
* @magentoConfigFixture default_store carriers/ups/shipper_number 12345
291326
* @magentoConfigFixture default_store carriers/ups/origin_shipment Shipments Originating in the European Union
292327
* @magentoConfigFixture default_store carriers/ups/username user
@@ -380,6 +415,8 @@ public function testRequestToShipment(): void
380415
*
381416
* @magentoConfigFixture default_store shipping/origin/country_id GB
382417
* @magentoConfigFixture default_store carriers/ups/active 1
418+
* @magentoConfigFixture default_store carriers/ups/type UPS_REST
419+
383420
* @magentoConfigFixture default_store carriers/ups/shipper_number 12345
384421
* @magentoConfigFixture default_store carriers/ups/origin_shipment Shipments Originating in the European Union
385422
* @magentoConfigFixture default_store carriers/ups/username user

0 commit comments

Comments
 (0)