-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from PAYONE-GmbH/feature/PAYONE-78
Add Shopware 6.2 compatibility.
- Loading branch information
Showing
101 changed files
with
979 additions
and
388 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
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
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
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,60 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PayonePayment\Components\Helper; | ||
|
||
use Shopware\Core\Checkout\Order\OrderEntity; | ||
use Shopware\Core\Framework\Context; | ||
use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; | ||
use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; | ||
use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter; | ||
use Shopware\Core\Framework\DataAbstractionLayer\Search\Sorting\FieldSorting; | ||
use Shopware\Core\Framework\Uuid\Uuid; | ||
|
||
class OrderFetcher implements OrderFetcherInterface | ||
{ | ||
/** @var EntityRepositoryInterface */ | ||
private $orderRepository; | ||
|
||
public function __construct(EntityRepositoryInterface $orderRepository) | ||
{ | ||
$this->orderRepository = $orderRepository; | ||
} | ||
|
||
public function getOrderById(string $orderId, Context $context): ?OrderEntity | ||
{ | ||
if (mb_strlen($orderId, '8bit') === 16) { | ||
$orderId = Uuid::fromBytesToHex($orderId); | ||
} | ||
|
||
$criteria = $this->getOrderCriteria(); | ||
$criteria->addFilter(new EqualsFilter('id', $orderId)); | ||
|
||
return $this->orderRepository->search($criteria, $context)->first(); | ||
} | ||
|
||
private function getOrderCriteria(): Criteria | ||
{ | ||
$criteria = new Criteria(); | ||
$criteria->addAssociation('transactions'); | ||
$criteria->addAssociation('transactions.stateMachineState'); | ||
$criteria->addAssociation('orderCustomer'); | ||
$criteria->addAssociation('addresses'); | ||
$criteria->addAssociation('addresses.salutation'); | ||
$criteria->addAssociation('addresses.country'); | ||
$criteria->addAssociation('deliveries'); | ||
$criteria->addAssociation('deliveries.shippingMethod'); | ||
$criteria->addAssociation('deliveries.positions'); | ||
$criteria->addAssociation('deliveries.positions.orderLineItem'); | ||
$criteria->addAssociation('deliveries.shippingOrderAddress'); | ||
$criteria->addAssociation('deliveries.shippingOrderAddress.country'); | ||
$criteria->addAssociation('deliveries.shippingOrderAddress.salutation'); | ||
$criteria->addAssociation('deliveries.shippingOrderAddress.country'); | ||
$criteria->addAssociation('lineItems'); | ||
$criteria->addAssociation('currency'); | ||
$criteria->addSorting(new FieldSorting('lineItems.createdAt')); | ||
|
||
return $criteria; | ||
} | ||
} |
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,13 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PayonePayment\Components\Helper; | ||
|
||
use Shopware\Core\Checkout\Order\OrderEntity; | ||
use Shopware\Core\Framework\Context; | ||
|
||
interface OrderFetcherInterface | ||
{ | ||
public function getOrderById(string $orderId, Context $context): ?OrderEntity; | ||
} |
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
Oops, something went wrong.