Skip to content
This repository has been archived by the owner on Jul 20, 2020. It is now read-only.

Update PHP to allow caller to set curl options #140

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tzs
Copy link

@tzs tzs commented Jul 25, 2018

Many production environments restrict outgoing network access on their servers that deal with payments, only allowing such access through proxies that vet the destinations before allowing access. This patch provides an option for the caller of verifyIPN() to provide the curl object for verifyIPN() to use instead of allocating its own curl object. This allows the caller to set any proxy options, or other options, that may be required in order to allow the connection back to Paypal to work.

Many production environments restrict outgoing network access on their servers that deal with payments, only allowing such access through proxies that vet the destinations before allowing access. This patch provides an option for the caller of verifyIPN() to provide the curl object for verifyIPN() to use instead of allocating its own curl object. This allows the caller to set any proxy options, or other options, that may be required in order to allow the connection back to Paypal to work.
@@ -17,6 +19,11 @@ class PaypalIPN
/** Response from PayPal indicating validation failed */
const INVALID = 'INVALID';

public function __construct($curl_handler = null)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docblock on the function please

@@ -6,6 +6,8 @@ class PaypalIPN
private $use_sandbox = false;
/** @var bool Indicates if the local certificates are used. */
private $use_local_certs = true;
/** @var curl handler */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is missing a type.

@tzs
Copy link
Author

tzs commented Jul 25, 2018

phpDocumentor comments added. The description for __construct seems awkward, but I could not think of anything better.

* handle that you supply, as opposed to creating a new cURL session
* handle like the default constructor does.
*
* @param resource $curl_handler (optional) cURL session handle

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param resource $curl_handler (optional) cURL session handle
* @param resource|null $curl_handler (optional) cURL session handle

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants