1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Pronamic\WordPress\Pay\Gateways\OmniKassa; |
4
|
|
|
|
5
|
|
|
use Pronamic\WordPress\Pay\Payments\PaymentStatus; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Title: OmniKassa response codes |
9
|
|
|
* Description: |
10
|
|
|
* Copyright: 2005-2020 Pronamic |
11
|
|
|
* Company: Pronamic |
12
|
|
|
* |
13
|
|
|
* @author Remco Tolsma |
14
|
|
|
* @version 2.0.3 |
15
|
|
|
* @since 1.0.0 |
16
|
|
|
*/ |
17
|
|
|
class ResponseCodes { |
18
|
|
|
/** |
19
|
|
|
* Transaction successful. |
20
|
|
|
* |
21
|
|
|
* @var string |
22
|
|
|
*/ |
23
|
|
|
const TRANSACTION_SUCCES = '00'; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Credit card authorisation limit exceeded. Contact the Support Team Rabo OmniKassa. |
27
|
|
|
* |
28
|
|
|
* @var string |
29
|
|
|
*/ |
30
|
|
|
const AUTHORIZATION_LIMIT = '02'; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Invalid merchant contract. |
34
|
|
|
* |
35
|
|
|
* @var string |
36
|
|
|
*/ |
37
|
|
|
const INVALID_MERCHANT_CONTRACT = '03'; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Refused. |
41
|
|
|
* |
42
|
|
|
* @var string |
43
|
|
|
*/ |
44
|
|
|
const AUTHORIZATION_REFUSED = '05'; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Invalid transaction. Check the fields in the payment request. |
48
|
|
|
* |
49
|
|
|
* @var string |
50
|
|
|
*/ |
51
|
|
|
const INVALID_TRANSACTION = '12'; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Invalid credit card number, invalid card security code, invalid card (MasterCard) or invalid Card Verification Value (MasterCard or Visa). |
55
|
|
|
* |
56
|
|
|
* @var string |
57
|
|
|
*/ |
58
|
|
|
const INVALID_CARD_NUMBER = '14'; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* Cancellation of payment by user. |
62
|
|
|
* |
63
|
|
|
* @var string |
64
|
|
|
*/ |
65
|
|
|
const CANCELLATION_OF_PAYMENT = '17'; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* Invalid status. |
69
|
|
|
* |
70
|
|
|
* @var string |
71
|
|
|
*/ |
72
|
|
|
const INVALID_STATUS = '24'; |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Transaction not found in database. |
76
|
|
|
* |
77
|
|
|
* @var string |
78
|
|
|
*/ |
79
|
|
|
const TRANSACTION_NOT_FOUND_IN_DATABASE = '25'; |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* Invalid format. |
83
|
|
|
* |
84
|
|
|
* @var string |
85
|
|
|
*/ |
86
|
|
|
const INVALID_FORMAT = '30'; |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* Fraud suspicion. |
90
|
|
|
* |
91
|
|
|
* @var string |
92
|
|
|
*/ |
93
|
|
|
const FRAUD_SUSPICION = '34'; |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* Operation not allowed for this merchant/webshop. |
97
|
|
|
* |
98
|
|
|
* @var string |
99
|
|
|
*/ |
100
|
|
|
const OPERATION_NOT_ALLOWED = '40'; |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* Awaiting status report. |
104
|
|
|
* |
105
|
|
|
* @var string |
106
|
|
|
*/ |
107
|
|
|
const PENDING_TRANSACTION = '60'; |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* Security problem detected. Transaction terminated. |
111
|
|
|
* |
112
|
|
|
* @var string |
113
|
|
|
*/ |
114
|
|
|
const SECURITY_BREACH_DETECTED = '63'; |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* Maximum number of attempts to enter credit card number (3) exceeded. |
118
|
|
|
* |
119
|
|
|
* @var string |
120
|
|
|
*/ |
121
|
|
|
const NUMBER_ATTEMPT_EXCEEDED = '75'; |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* Rabo OmniKassa server temporarily unavailable. |
125
|
|
|
* |
126
|
|
|
* @var string |
127
|
|
|
*/ |
128
|
|
|
const ACQUIRER_SERVER_TEMPORARILY_UNAVAILABLE = '90'; |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* Duplicate transaction. |
132
|
|
|
* |
133
|
|
|
* @var string |
134
|
|
|
*/ |
135
|
|
|
const DUPLICATE_TRANSACTION = '94'; |
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* Time period expired. Transaction refused. |
139
|
|
|
* |
140
|
|
|
* @var string |
141
|
|
|
*/ |
142
|
|
|
const REQUEST_TIMEOUT = '97'; |
143
|
|
|
|
144
|
|
|
/** |
145
|
|
|
* Payment page temporarily unavailable. |
146
|
|
|
* |
147
|
|
|
* @var string |
148
|
|
|
*/ |
149
|
|
|
const PAYMENT_PAGE_TEMPORARILY_UNAVAILABLE = '99'; |
150
|
|
|
|
151
|
|
|
/** |
152
|
|
|
* Transform an OmniKassa response code to an more global status |
153
|
|
|
* |
154
|
|
|
* @see page 30 http://pronamic.nl/wp-content/uploads/2013/10/integratiehandleiding_rabo_omnikassa_en_versie_5_0_juni_2013_10_29451215.pdf |
155
|
|
|
* |
156
|
|
|
* @param string $response_code Response code. |
157
|
|
|
* |
158
|
|
|
* @return string|null |
159
|
|
|
*/ |
160
|
19 |
|
public static function transform( $response_code ) { |
161
|
|
|
switch ( $response_code ) { |
162
|
19 |
|
case self::TRANSACTION_SUCCES: |
163
|
1 |
|
return PaymentStatus::SUCCESS; |
164
|
|
|
|
165
|
18 |
|
case self::AUTHORIZATION_LIMIT: |
166
|
17 |
|
case self::INVALID_MERCHANT_CONTRACT: |
167
|
16 |
|
case self::AUTHORIZATION_REFUSED: |
168
|
15 |
|
case self::INVALID_TRANSACTION: |
169
|
14 |
|
case self::INVALID_STATUS: |
170
|
13 |
|
case self::TRANSACTION_NOT_FOUND_IN_DATABASE: |
171
|
12 |
|
case self::INVALID_FORMAT: |
172
|
11 |
|
case self::FRAUD_SUSPICION: |
173
|
10 |
|
case self::OPERATION_NOT_ALLOWED: |
174
|
9 |
|
case self::SECURITY_BREACH_DETECTED: |
175
|
8 |
|
case self::NUMBER_ATTEMPT_EXCEEDED: |
176
|
7 |
|
case self::ACQUIRER_SERVER_TEMPORARILY_UNAVAILABLE: |
177
|
6 |
|
case self::DUPLICATE_TRANSACTION: |
178
|
13 |
|
return PaymentStatus::FAILURE; |
179
|
|
|
|
180
|
5 |
|
case self::CANCELLATION_OF_PAYMENT: |
181
|
1 |
|
return PaymentStatus::CANCELLED; |
182
|
|
|
|
183
|
4 |
|
case self::PENDING_TRANSACTION: |
184
|
3 |
|
case self::PAYMENT_PAGE_TEMPORARILY_UNAVAILABLE: |
185
|
2 |
|
return PaymentStatus::OPEN; |
186
|
|
|
|
187
|
2 |
|
case self::REQUEST_TIMEOUT: |
188
|
1 |
|
return PaymentStatus::EXPIRED; |
189
|
|
|
|
190
|
|
|
default: |
191
|
1 |
|
return null; |
192
|
|
|
} |
193
|
|
|
} |
194
|
|
|
} |
195
|
|
|
|