3
3
class PaypalIPN
4
4
{
5
5
6
+ /**
7
+ * @var bool $use_sandbox Indicates if the sandbox endpoint is used.
8
+ */
6
9
private $ use_sandbox = false ;
7
- private $ use_local_certs = true ;
8
-
9
- /*
10
- * PayPal IPN postback endpoints
10
+ /**
11
+ * @var bool $use_local_certs Indicates if the local certificates are used.
11
12
*/
13
+ private $ use_local_certs = true ;
12
14
15
+ /** Production Postback URL */
13
16
const VERIFY_URI = 'https://ipnpb.paypal.com/cgi-bin/webscr ' ;
17
+ /** Sandbox Postback URL */
14
18
const SANDBOX_VERIFY_URI = 'https://ipnpb.sandbox.paypal.com/cgi-bin/webscr ' ;
15
19
16
- /*
17
- * Possible responses from PayPal after the request is issued.
18
- */
19
20
21
+ /** Response from PayPal indicating validation was successful */
20
22
const VALID = 'VERIFIED ' ;
23
+ /** Response from PayPal indicating validation failed */
21
24
const INVALID = 'INVALID ' ;
22
25
23
26
@@ -31,26 +34,34 @@ public function useSandbox()
31
34
$ this ->use_sandbox = true ;
32
35
}
33
36
37
+ /**
38
+ * Sets curl to use php curl's built in certs (may be required in some
39
+ * environments).
40
+ * @return void
41
+ */
42
+ public function usePHPCerts ()
43
+ {
44
+ $ this ->use_local_certs = false ;
45
+ }
46
+
34
47
35
48
/**
36
49
* Determine endpoint to post the verification data to.
37
50
* @return string
38
51
*/
39
52
public function getPaypalUri ()
40
53
{
41
- if ($ this ->use_sandbox )
42
- {
54
+ if ($ this ->use_sandbox ) {
43
55
return self ::SANDBOX_VERIFY_URI ;
44
- } else
45
- {
56
+ } else {
46
57
return self ::VERIFY_URI ;
47
58
}
48
59
}
49
60
50
61
51
62
/**
52
63
* Verification Function
53
- * Sends the incoming post data back to paypal using the cURL library.
64
+ * Sends the incoming post data back to PayPal using the cURL library.
54
65
*
55
66
* @return bool
56
67
* @throws Exception
0 commit comments