/
AsynchronousPaymentHandlerInterface.php
39 lines (35 loc) · 1.81 KB
/
AsynchronousPaymentHandlerInterface.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php declare(strict_types=1);
namespace Shopware\Core\Checkout\Payment\Cart\PaymentHandler;
use Shopware\Core\Checkout\Payment\Cart\AsyncPaymentTransactionStruct;
use Shopware\Core\Checkout\Payment\Exception\AsyncPaymentFinalizeException;
use Shopware\Core\Checkout\Payment\Exception\AsyncPaymentProcessException;
use Shopware\Core\Checkout\Payment\Exception\CustomerCanceledAsyncPaymentException;
use Shopware\Core\Framework\Validation\DataBag\RequestDataBag;
use Shopware\Core\System\SalesChannel\SalesChannelContext;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
interface AsynchronousPaymentHandlerInterface
{
/**
* The pay function will be called after the customer completed the order.
* Allows to process the order and store additional information.
*
* A redirect to the url will be performed
*
* Throw a @see AsyncPaymentProcessException exception if an error ocurres while processing the payment
*
* @throws AsyncPaymentProcessException
*/
public function pay(AsyncPaymentTransactionStruct $transaction, RequestDataBag $dataBag, SalesChannelContext $salesChannelContext): RedirectResponse;
/**
* The finalize function will be called when the user is redirected back to shop from the payment gateway.
*
* Throw a @see AsyncPaymentFinalizeException exception if an error ocurres while calling an external payment API
* Throw a @see CustomerCanceledAsyncPaymentException exception if the customer canceled the payment process on
* payment provider page
*
* @throws AsyncPaymentFinalizeException
* @throws CustomerCanceledAsyncPaymentException
*/
public function finalize(AsyncPaymentTransactionStruct $transaction, Request $request, SalesChannelContext $salesChannelContext): void;
}