-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ups): do not include delivery date for ups when exporting (#317)
INT-711
- Loading branch information
1 parent
abf4234
commit fc1eabc
Showing
6 changed files
with
160 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace MyParcelNL\Pdk\App\Order\Calculator\UPS; | ||
|
||
use MyParcelNL\Pdk\App\Order\Calculator\AbstractCarrierOptionsCalculator; | ||
|
||
final class UPSCalculator extends AbstractCarrierOptionsCalculator | ||
{ | ||
protected function getCalculators(): array | ||
{ | ||
return [ | ||
UPSCountryShipmentOptionsCalculator::class, | ||
]; | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/App/Order/Calculator/UPS/UPSCountryShipmentOptionsCalculator.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace MyParcelNL\Pdk\App\Order\Calculator\UPS; | ||
|
||
use MyParcelNL\Pdk\App\Order\Calculator\AbstractPdkOrderOptionCalculator; | ||
use MyParcelNL\Pdk\App\Order\Model\PdkOrder; | ||
use MyParcelNL\Pdk\Base\Contract\CountryServiceInterface; | ||
use MyParcelNL\Pdk\Facade\Pdk; | ||
|
||
class UPSCountryShipmentOptionsCalculator extends AbstractPdkOrderOptionCalculator | ||
{ | ||
private $countryService; | ||
|
||
public function __construct(PdkOrder $order) | ||
{ | ||
parent::__construct($order); | ||
|
||
$this->countryService = Pdk::get(CountryServiceInterface::class); | ||
} | ||
|
||
public function calculate(): void | ||
{ | ||
$cc = $this->order->shippingAddress->cc; | ||
if ($this->countryService->isRow($cc) || $this->countryService->isEu($cc)) { | ||
$this->order->deliveryOptions->date = null; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...erActionTest__it_exports_international_orders_with_data_set_ups__data_set_default__1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"data": { | ||
"shipments": [ | ||
{ | ||
"carrier": 8, | ||
"customs_declaration": { | ||
"contents": 1, | ||
"invoice": "PDK-1", | ||
"items": [ | ||
{ | ||
"amount": 1, | ||
"classification": "000000", | ||
"country": "NL", | ||
"description": "test", | ||
"item_value": { | ||
"amount": 1000, | ||
"currency": "EUR" | ||
}, | ||
"weight": 0 | ||
} | ||
], | ||
"weight": 1 | ||
}, | ||
"general_settings": { | ||
"save_recipient_address": 0 | ||
}, | ||
"options": { | ||
"package_type": 1, | ||
"delivery_type": 2 | ||
}, | ||
"physical_properties": { | ||
"weight": 1 | ||
}, | ||
"recipient": { | ||
"cc": "US", | ||
"city": "Cupertino", | ||
"company": "MyParcel", | ||
"person": "Felicia Parcel", | ||
"postal_code": "95014", | ||
"state": "CA", | ||
"street": "1 Infinite Loop", | ||
"vat_number": "NL123456789B01" | ||
}, | ||
"reference_identifier": "PDK-1" | ||
} | ||
] | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
...ctionTest__it_exports_international_orders_with_data_set_ups__data_set_order_mode__1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"data": { | ||
"shipments": [ | ||
{ | ||
"carrier": 8, | ||
"customs_declaration": { | ||
"contents": 1, | ||
"invoice": "PDK-1", | ||
"items": [ | ||
{ | ||
"amount": 1, | ||
"classification": "000000", | ||
"country": "NL", | ||
"description": "test", | ||
"item_value": { | ||
"amount": 1000, | ||
"currency": "EUR" | ||
}, | ||
"weight": 0 | ||
} | ||
], | ||
"weight": 1 | ||
}, | ||
"general_settings": { | ||
"save_recipient_address": 0 | ||
}, | ||
"options": { | ||
"package_type": 1, | ||
"delivery_type": 2 | ||
}, | ||
"physical_properties": { | ||
"weight": 1 | ||
}, | ||
"recipient": { | ||
"cc": "US", | ||
"city": "Cupertino", | ||
"company": "MyParcel", | ||
"person": "Felicia Parcel", | ||
"postal_code": "95014", | ||
"state": "CA", | ||
"street": "1 Infinite Loop", | ||
"vat_number": "NL123456789B01" | ||
}, | ||
"reference_identifier": "PDK-1" | ||
} | ||
] | ||
} | ||
} |