@@ 9-34 (lines=26) @@ | ||
6 | use PayumTW\Allpay\Request\Api\CancelTransaction; |
|
7 | use Payum\Core\Exception\RequestNotSupportedException; |
|
8 | ||
9 | class CancelTransactionAction extends BaseApiAwareAction |
|
10 | { |
|
11 | /** |
|
12 | * {@inheritdoc} |
|
13 | * |
|
14 | * @param $request RefundTransaction |
|
15 | */ |
|
16 | public function execute($request) |
|
17 | { |
|
18 | RequestNotSupportedException::assertSupports($this, $request); |
|
19 | ||
20 | $details = ArrayObject::ensureArrayObject($request->getModel()); |
|
21 | ||
22 | $details->replace($this->api->cancelTransaction((array) $details)); |
|
23 | } |
|
24 | ||
25 | /** |
|
26 | * {@inheritdoc} |
|
27 | */ |
|
28 | public function supports($request) |
|
29 | { |
|
30 | return |
|
31 | $request instanceof CancelTransaction && |
|
32 | $request->getModel() instanceof \ArrayAccess; |
|
33 | } |
|
34 | } |
|
35 |
@@ 10-38 (lines=29) @@ | ||
7 | use PayumTW\Allpay\Request\Api\CreateTransaction; |
|
8 | use Payum\Core\Exception\RequestNotSupportedException; |
|
9 | ||
10 | class CreateTransactionAction extends BaseApiAwareAction |
|
11 | { |
|
12 | /** |
|
13 | * {@inheritdoc} |
|
14 | * |
|
15 | * @param $request CreateTransaction |
|
16 | */ |
|
17 | public function execute($request) |
|
18 | { |
|
19 | RequestNotSupportedException::assertSupports($this, $request); |
|
20 | ||
21 | $details = ArrayObject::ensureArrayObject($request->getModel()); |
|
22 | ||
23 | throw new HttpPostRedirect( |
|
24 | $this->api->getApiEndpoint(), |
|
25 | $this->api->createTransaction((array) $details) |
|
26 | ); |
|
27 | } |
|
28 | ||
29 | /** |
|
30 | * {@inheritdoc} |
|
31 | */ |
|
32 | public function supports($request) |
|
33 | { |
|
34 | return |
|
35 | $request instanceof CreateTransaction && |
|
36 | $request->getModel() instanceof \ArrayAccess; |
|
37 | } |
|
38 | } |
|
39 |
@@ 9-34 (lines=26) @@ | ||
6 | use PayumTW\Allpay\Request\Api\GetTransactionData; |
|
7 | use Payum\Core\Exception\RequestNotSupportedException; |
|
8 | ||
9 | class GetTransactionDataAction extends BaseApiAwareAction |
|
10 | { |
|
11 | /** |
|
12 | * {@inheritdoc} |
|
13 | * |
|
14 | * @param $request GetTransactionData |
|
15 | */ |
|
16 | public function execute($request) |
|
17 | { |
|
18 | RequestNotSupportedException::assertSupports($this, $request); |
|
19 | ||
20 | $details = ArrayObject::ensureArrayObject($request->getModel()); |
|
21 | ||
22 | $details->replace($this->api->getTransactionData((array) $details)); |
|
23 | } |
|
24 | ||
25 | /** |
|
26 | * {@inheritdoc} |
|
27 | */ |
|
28 | public function supports($request) |
|
29 | { |
|
30 | return |
|
31 | $request instanceof GetTransactionData && |
|
32 | $request->getModel() instanceof \ArrayAccess; |
|
33 | } |
|
34 | } |
|
35 |
@@ 9-34 (lines=26) @@ | ||
6 | use PayumTW\Allpay\Request\Api\RefundTransaction; |
|
7 | use Payum\Core\Exception\RequestNotSupportedException; |
|
8 | ||
9 | class RefundTransactionAction extends BaseApiAwareAction |
|
10 | { |
|
11 | /** |
|
12 | * {@inheritdoc} |
|
13 | * |
|
14 | * @param $request RefundTransaction |
|
15 | */ |
|
16 | public function execute($request) |
|
17 | { |
|
18 | RequestNotSupportedException::assertSupports($this, $request); |
|
19 | ||
20 | $details = ArrayObject::ensureArrayObject($request->getModel()); |
|
21 | ||
22 | $details->replace($this->api->refundTransaction((array) $details)); |
|
23 | } |
|
24 | ||
25 | /** |
|
26 | * {@inheritdoc} |
|
27 | */ |
|
28 | public function supports($request) |
|
29 | { |
|
30 | return |
|
31 | $request instanceof RefundTransaction && |
|
32 | $request->getModel() instanceof \ArrayAccess; |
|
33 | } |
|
34 | } |
|
35 |