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