Conditions | 9 |
Paths | 9 |
Total Lines | 43 |
Code Lines | 27 |
Lines | 0 |
Ratio | 0 % |
Tests | 28 |
CRAP Score | 9 |
Changes | 0 |
1 | <?php |
||
17 | 6 | public function execute($request) |
|
18 | { |
||
19 | 6 | RequestNotSupportedException::assertSupports($this, $request); |
|
20 | |||
21 | 6 | $details = ArrayObject::ensureArrayObject($request->getModel()); |
|
22 | |||
23 | 6 | if (isset($details['RtnCode']) === false) { |
|
24 | 1 | $request->markNew(); |
|
25 | |||
26 | 1 | return; |
|
27 | } |
||
28 | |||
29 | 5 | if ($details['RtnCode'] === '2') { |
|
30 | 1 | $request->markPending(); |
|
31 | |||
32 | 1 | return; |
|
33 | } |
||
34 | |||
35 | 4 | if ($details['RtnCode'] === '1') { |
|
36 | 3 | if (isset($details['Action']) === true) { |
|
37 | 3 | switch ($details['Action']) { |
|
38 | 3 | case 'C': |
|
39 | 1 | $request->markCaptured(); |
|
40 | 1 | break; |
|
41 | 2 | case 'R': |
|
42 | 1 | $request->markRefunded(); |
|
43 | 1 | break; |
|
44 | 1 | case 'E': |
|
45 | 1 | case 'N': |
|
46 | 1 | $request->markCanceled(); |
|
47 | 1 | break; |
|
48 | 3 | } |
|
49 | |||
50 | 3 | return; |
|
51 | } else { |
||
52 | 1 | $request->markCaptured(); |
|
53 | |||
54 | 1 | return; |
|
55 | } |
||
56 | } |
||
57 | |||
58 | 1 | $request->markFailed(); |
|
59 | 1 | } |
|
60 | |||
71 |