1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Statuses |
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\Core\Statuses as Core_Statuses; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* Title: Adyen statuses constants. |
17
|
|
|
* Description: |
18
|
|
|
* Copyright: 2005-2019 Pronamic |
19
|
|
|
* Company: Pronamic |
20
|
|
|
* |
21
|
|
|
* @author Reüel van der Steege |
22
|
|
|
* @version 1.0.0 |
23
|
|
|
* @since 1.0.0 |
24
|
|
|
* |
25
|
|
|
* @link https://docs.adyen.com/developers/checkout/payment-result-codes |
26
|
|
|
*/ |
27
|
|
|
class Statuses { |
28
|
|
|
/** |
29
|
|
|
* Authorized. |
30
|
|
|
* |
31
|
|
|
* The payment was successfully authorised. |
32
|
|
|
* |
33
|
|
|
* @var string |
34
|
|
|
*/ |
35
|
|
|
const AUTHORIZED = 'Authorised'; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Cancelled. |
39
|
|
|
* |
40
|
|
|
* The payment was cancelled (by either the shopper or |
41
|
|
|
* your own system) before processing was completed. |
42
|
|
|
* |
43
|
|
|
* @var string |
44
|
|
|
*/ |
45
|
|
|
const CANCELLED = 'Cancelled'; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* Error. |
49
|
|
|
* |
50
|
|
|
* There was an error when the payment was being processed. |
51
|
|
|
* |
52
|
|
|
* @var string |
53
|
|
|
*/ |
54
|
|
|
const ERROR = 'Error'; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* Pending. |
58
|
|
|
* |
59
|
|
|
* It's not possible to obtain the final status of the payment at this time. |
60
|
|
|
* This is common for payments with an asynchronous flow, such as Boleto, iDEAL, or Klarna. |
61
|
|
|
* |
62
|
|
|
* @var string |
63
|
|
|
*/ |
64
|
|
|
const PENDING = 'Pending'; |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* Received. |
68
|
|
|
* |
69
|
|
|
* This is part of the standard payment flow for methods such as SEPA Direct Debit, |
70
|
|
|
* where it can take some time before the final status of the payment is known. |
71
|
|
|
* |
72
|
|
|
* @var string |
73
|
|
|
*/ |
74
|
|
|
const RECEIVED = 'Received'; |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Redirect shopper. |
78
|
|
|
* |
79
|
|
|
* The shopper needs to be redirected to an external web page or app to complete the payment. |
80
|
|
|
* |
81
|
|
|
* @var string |
82
|
|
|
*/ |
83
|
|
|
const REDIRECT_SHOPPER = 'redirectShopper'; |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* Refused. |
87
|
|
|
* |
88
|
|
|
* The payment was refused. |
89
|
|
|
* |
90
|
|
|
* @var string |
91
|
|
|
*/ |
92
|
|
|
const REFUSED = 'Refused'; |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* Transform an Mollie state to an more global status. |
96
|
|
|
* |
97
|
|
|
* @param string $status Mollie status. |
98
|
|
|
* |
99
|
|
|
* @return string|null Pay status. |
100
|
|
|
*/ |
101
|
|
|
public static function transform( $status ) { |
102
|
|
|
switch ( $status ) { |
103
|
|
|
case self::PENDING: |
104
|
|
|
case self::RECEIVED: |
105
|
|
|
case self::REDIRECT_SHOPPER: |
106
|
|
|
return Core_Statuses::OPEN; |
107
|
|
|
|
108
|
|
|
case self::CANCELLED: |
109
|
|
|
return Core_Statuses::CANCELLED; |
110
|
|
|
|
111
|
|
|
case self::ERROR: |
112
|
|
|
case self::REFUSED: |
113
|
|
|
return Core_Statuses::FAILURE; |
114
|
|
|
|
115
|
|
|
case self::AUTHORIZED: |
116
|
|
|
return Core_Statuses::SUCCESS; |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
return null; |
120
|
|
|
} |
121
|
|
|
} |
122
|
|
|
|