1 | <?php |
||
10 | class CreateTransactionAction extends BaseApiAwareAction |
||
11 | { |
||
12 | /** |
||
13 | * {@inheritdoc} |
||
14 | * |
||
15 | * @param $request CreateTransaction |
||
16 | */ |
||
17 | 2 | public function execute($request) |
|
18 | { |
||
19 | 2 | RequestNotSupportedException::assertSupports($this, $request); |
|
20 | |||
21 | 2 | $details = ArrayObject::ensureArrayObject($request->getModel()); |
|
22 | |||
23 | 2 | $details->validateNotEmpty(['cust_order_no', 'order_amount', 'order_detail']); |
|
24 | |||
25 | 2 | $params = $this->api->createTransaction((array) $details); |
|
26 | |||
27 | 2 | if (isset($params['status']) === true) { |
|
28 | 1 | $details->replace($params); |
|
29 | |||
30 | 1 | return; |
|
31 | } |
||
32 | |||
33 | 1 | throw new HttpPostRedirect( |
|
34 | 1 | $this->api->getApiEndpoint(), $params |
|
35 | 1 | ); |
|
36 | } |
||
37 | |||
38 | /** |
||
39 | * {@inheritdoc} |
||
40 | */ |
||
41 | 2 | public function supports($request) |
|
47 | } |
||
48 |