wp-pay-gateways /
adyen
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Result code |
||
| 4 | * |
||
| 5 | * @author Pronamic <[email protected]> |
||
| 6 | * @copyright 2005-2019 Pronamic |
||
| 7 | * @license GPL-3.0-or-later |
||
| 8 | * @package Pronamic\WordPress\Pay\Gateways\Adyen |
||
| 9 | */ |
||
| 10 | |||
| 11 | namespace Pronamic\WordPress\Pay\Gateways\Adyen; |
||
| 12 | |||
| 13 | use Pronamic\WordPress\Pay\Payments\PaymentStatus as Core_Statuses; |
||
|
0 ignored issues
–
show
|
|||
| 14 | |||
| 15 | /** |
||
| 16 | * Result code |
||
| 17 | * |
||
| 18 | * @link https://docs.adyen.com/developers/checkout/payment-result-codes |
||
| 19 | * |
||
| 20 | * @author Reüel van der Steege |
||
| 21 | * @version 1.0.0 |
||
| 22 | * @since 1.0.0 |
||
| 23 | */ |
||
| 24 | class ResultCode { |
||
| 25 | /** |
||
| 26 | * Authorized. |
||
| 27 | * |
||
| 28 | * The payment was successfully authorised. |
||
| 29 | * |
||
| 30 | * @var string |
||
| 31 | */ |
||
| 32 | const AUTHORIZED = 'Authorised'; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Cancelled. |
||
| 36 | * |
||
| 37 | * The payment was cancelled (by either the shopper or |
||
| 38 | * your own system) before processing was completed. |
||
| 39 | * |
||
| 40 | * @var string |
||
| 41 | */ |
||
| 42 | const CANCELLED = 'Cancelled'; |
||
| 43 | |||
| 44 | /** |
||
| 45 | * Error. |
||
| 46 | * |
||
| 47 | * There was an error when the payment was being processed. |
||
| 48 | * |
||
| 49 | * @var string |
||
| 50 | */ |
||
| 51 | const ERROR = 'Error'; |
||
| 52 | |||
| 53 | /** |
||
| 54 | * Pending. |
||
| 55 | * |
||
| 56 | * It's not possible to obtain the final status of the payment at this time. |
||
| 57 | * This is common for payments with an asynchronous flow, such as Boleto, iDEAL, or Klarna. |
||
| 58 | * |
||
| 59 | * @var string |
||
| 60 | */ |
||
| 61 | const PENDING = 'Pending'; |
||
| 62 | |||
| 63 | /** |
||
| 64 | * Received. |
||
| 65 | * |
||
| 66 | * This is part of the standard payment flow for methods such as SEPA Direct Debit, |
||
| 67 | * where it can take some time before the final status of the payment is known. |
||
| 68 | * |
||
| 69 | * @var string |
||
| 70 | */ |
||
| 71 | const RECEIVED = 'Received'; |
||
| 72 | |||
| 73 | /** |
||
| 74 | * Redirect shopper. |
||
| 75 | * |
||
| 76 | * The shopper needs to be redirected to an external web page or app to complete the payment. |
||
| 77 | * |
||
| 78 | * @var string |
||
| 79 | */ |
||
| 80 | const REDIRECT_SHOPPER = 'RedirectShopper'; |
||
| 81 | |||
| 82 | /** |
||
| 83 | * Refused. |
||
| 84 | * |
||
| 85 | * The payment was refused. |
||
| 86 | * |
||
| 87 | * @var string |
||
| 88 | */ |
||
| 89 | const REFUSED = 'Refused'; |
||
| 90 | |||
| 91 | /** |
||
| 92 | * Transform Adyen result code to WordPress payment status. |
||
| 93 | * |
||
| 94 | * @param string|null $result_code Adyen result code. |
||
| 95 | * @return string|null WordPress payment status. |
||
| 96 | */ |
||
| 97 | 9 | public static function transform( $result_code ) { |
|
| 98 | switch ( $result_code ) { |
||
| 99 | 9 | case self::PENDING: |
|
| 100 | 8 | case self::RECEIVED: |
|
| 101 | 7 | case self::REDIRECT_SHOPPER: |
|
| 102 | 3 | return Core_Statuses::OPEN; |
|
| 103 | |||
| 104 | 6 | case self::CANCELLED: |
|
| 105 | 1 | return Core_Statuses::CANCELLED; |
|
| 106 | |||
| 107 | 5 | case self::ERROR: |
|
| 108 | 4 | case self::REFUSED: |
|
| 109 | 2 | return Core_Statuses::FAILURE; |
|
| 110 | |||
| 111 | 3 | case self::AUTHORIZED: |
|
| 112 | 2 | return Core_Statuses::SUCCESS; |
|
| 113 | } |
||
| 114 | |||
| 115 | 1 | return null; |
|
| 116 | } |
||
| 117 | } |
||
| 118 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths