-
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.
PAYOSWXP-156: set transaction-state to „authorized“ on „appointed“
- Loading branch information
1 parent
bb489ff
commit 5b06579
Showing
6 changed files
with
54 additions
and
319 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PayonePayment\Payone\Webhook\Handler; | ||
|
||
use PayonePayment\Components\DataHandler\Transaction\TransactionDataHandlerInterface; | ||
use PayonePayment\Struct\PaymentTransaction; | ||
use Shopware\Core\Checkout\Order\Aggregate\OrderTransaction\OrderTransactionDefinition; | ||
use Shopware\Core\System\SalesChannel\SalesChannelContext; | ||
use Shopware\Core\System\StateMachine\Aggregation\StateMachineTransition\StateMachineTransitionActions; | ||
use Shopware\Core\System\StateMachine\StateMachineRegistry; | ||
use Shopware\Core\System\StateMachine\Transition; | ||
use Symfony\Component\HttpFoundation\Request; | ||
|
||
class PaymentStatusHandler implements WebhookHandlerInterface | ||
{ | ||
public function __construct( | ||
private readonly TransactionDataHandlerInterface $transactionDataHandler, | ||
private readonly StateMachineRegistry $stateMachineRegistry | ||
) { | ||
} | ||
|
||
public function process(SalesChannelContext $salesChannelContext, Request $request): void | ||
{ | ||
$paymentTransaction = $this->transactionDataHandler->getPaymentTransactionByPayoneTransactionId( | ||
$salesChannelContext->getContext(), | ||
$request->request->getInt('txid') | ||
); | ||
|
||
if (!$paymentTransaction instanceof PaymentTransaction) { | ||
return; | ||
} | ||
|
||
$this->stateMachineRegistry->transition( | ||
new Transition( | ||
OrderTransactionDefinition::ENTITY_NAME, | ||
$paymentTransaction->getOrderTransaction()->getId(), | ||
StateMachineTransitionActions::ACTION_AUTHORIZE, | ||
'stateId' | ||
), | ||
$salesChannelContext->getContext() | ||
); | ||
} | ||
|
||
public function supports(SalesChannelContext $salesChannelContext, array $data): bool | ||
{ | ||
return isset($data['txid']) && ($data['txaction'] ?? null) === 'appointed'; | ||
} | ||
} |
10 changes: 0 additions & 10 deletions
10
src/Resources/views/storefront/page/account/order-history/order-item.html.twig
This file was deleted.
Oops, something went wrong.
96 changes: 0 additions & 96 deletions
96
src/Storefront/Controller/Account/AccountOrderControllerDecorator.php
This file was deleted.
Oops, something went wrong.
200 changes: 0 additions & 200 deletions
200
tests/Storefront/Controller/Account/AccountOrderControllerDecoratorTest.php
This file was deleted.
Oops, something went wrong.