This repository was archived by the owner on Oct 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathError.php
More file actions
executable file
·79 lines (74 loc) · 2.71 KB
/
Copy pathError.php
File metadata and controls
executable file
·79 lines (74 loc) · 2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
namespace Worldpay;
class Error {
public static $errors = array(
"ip" => "Invalid parameters",
"cine" => "php_curl was not found",
"to" => "Request timed out",
"nf" => "Not found",
"apierror" => "API Error",
"uanv" => "Worldpay is currently unavailable, please try again later",
"contact" => "Error contacting Worldpay, please try again later",
'ssl' => 'You must enable SSL check in production mode',
'verify' => 'Worldpay not verifiying SSL connection',
'orderInput'=> array(
'token' => 'No token found',
'orderCode' => 'No order_code entered',
'orderDescription' => 'No order_description found',
'amount' => 'No amount found, or it is not a whole number',
'currencyCode' => 'No currency_code found',
'name' => 'No name found',
'billingAddress' => 'Invalid billing_address',
'deliveryAddress' => 'Invalid delivery_address'
),
'notificationPost' => 'Notification Error: Not a post',
'notificationUnknown' => 'Notification Error: Cannot be processed',
'refund' => array(
'ordercode' => 'No order code entered'
),
'capture' => array(
'ordercode' => 'No order code entered'
),
'3ds' => array(
'ordercode' => 'No order code entered'
),
'json' => 'JSON could not be decoded',
'key' => 'Please enter your service key',
'sslerror' => 'Worldpay SSL certificate could not be validated',
'timeouterror'=> 'Gateway timeout - possible order failure.
Please review the order in the portal to confirm success.'
);
/**
* Handle errors
* @param string-error_key $error
* @param string $message
* @param string $code
* @param string $httpStatusCode
* @param string $description
* @param string $customCode
* */
public static function throwError(
$error = false,
$message = false,
$code = null,
$httpStatusCode = null,
$description = null,
$customCode = null
) {
$error_message = ($message) ? $message : '';
if ($error) {
$error_message = self::$errors[$error];
if ($message) {
$error_message .= ' - '. $message;
}
}
throw new WorldpayException(
$error_message,
$code,
null,
$httpStatusCode,
$description,
$customCode
);
}
}