|
| __construct (\Magento\Paypal\Model\ConfigFactory $configFactory, \Psr\Log\LoggerInterface $logger, \Magento\Framework\HTTP\Adapter\CurlFactory $curlFactory, array $data=[]) |
|
| getRequestData ($key=null) |
|
Definition at line 11 of file AbstractIpn.php.
◆ __construct()
__construct |
( |
\Magento\Paypal\Model\ConfigFactory |
$configFactory, |
|
|
\Psr\Log\LoggerInterface |
$logger, |
|
|
\Magento\Framework\HTTP\Adapter\CurlFactory |
$curlFactory, |
|
|
array |
$data = [] |
|
) |
| |
- Parameters
-
\Magento\Paypal\Model\ConfigFactory | $configFactory | |
\Psr\Log\LoggerInterface | $logger | |
\Magento\Framework\HTTP\Adapter\CurlFactory | $curlFactory | |
array | $data | |
Definition at line 48 of file AbstractIpn.php.
56 $this->_curlFactory = $curlFactory;
57 $this->_ipnRequest =
$data;
◆ _addDebugData()
_addDebugData |
( |
|
$key, |
|
|
|
$value |
|
) |
| |
|
protected |
- Parameters
-
string | $key | |
array | string | $value | |
- Returns
- $this
Definition at line 178 of file AbstractIpn.php.
180 $this->_debugData[$key] =
$value;
◆ _debug()
Log debug data to file
- Returns
- void
Definition at line 166 of file AbstractIpn.php.
168 if ($this->_config && $this->_config->getValue(
'debug')) {
169 $this->logger->debug(var_export($this->_debugData,
true));
◆ _filterPaymentStatus()
_filterPaymentStatus |
( |
|
$ipnPaymentStatus | ) |
|
|
protected |
Filter payment status from NVP into paypal/info format
- Parameters
-
- Returns
- string @SuppressWarnings(PHPMD.CyclomaticComplexity)
Definition at line 127 of file AbstractIpn.php.
129 switch ($ipnPaymentStatus) {
146 case 'Canceled_Reversal':
const PAYMENTSTATUS_COMPLETED
const PAYMENTSTATUS_PENDING
const PAYMENTSTATUS_PROCESSED
const PAYMENTSTATUS_FAILED
const PAYMENTSTATUS_DENIED
const PAYMENTSTATUS_UNREVERSED
const PAYMENTSTATUS_VOIDED
const PAYMENTSTATUS_REFUNDED
const PAYMENTSTATUS_REVERSED
const PAYMENTSTATUS_EXPIRED
◆ _postBack()
Post back to PayPal to check whether this request is a valid one
- Returns
- void
- Exceptions
-
RemoteServiceUnavailableException | |
| |
Definition at line 81 of file AbstractIpn.php.
83 $httpAdapter = $this->_curlFactory->create();
84 $postbackQuery = http_build_query($this->
getRequestData()) .
'&cmd=_notify-validate';
85 $postbackUrl = $this->_config->getPayPalIpnUrl();
88 $httpAdapter->setConfig([
'verifypeer' => $this->_config->getValue(
'verifyPeer')]);
91 $postbackResult = $httpAdapter->read();
92 }
catch (\Exception $e) {
93 $this->
_addDebugData(
'http_error', [
'error' => $e->getMessage(),
'code' => $e->getCode()]);
101 if (empty($postbackResult) || in_array($responseCode, [
'500',
'502',
'503'])) {
102 if (empty($postbackResult)) {
103 $reason =
'Empty response.';
105 $reason =
'Response code: ' . $responseCode .
'.';
107 $this->_debugData[
'exception'] =
'PayPal IPN postback failure. ' . $reason;
108 throw new RemoteServiceUnavailableException(
__($reason));
111 $response = preg_split(
'/^\r?$/m', $postbackResult, 2);
116 throw new \Exception(
'PayPal IPN postback failure. See system.log for details.');
getRequestData($key=null)
_addDebugData($key, $value)
static extractCode($response_str)
◆ getRequestData()
getRequestData |
( |
|
$key = null | ) |
|
IPN request data getter
- Parameters
-
- Returns
- array|string
Definition at line 66 of file AbstractIpn.php.
71 return isset($this->_ipnRequest[$key]) ? $this->_ipnRequest[$key] :
null;
◆ $_config
◆ $_configFactory
◆ $_curlFactory
◆ $_debugData
◆ $_ipnRequest
The documentation for this class was generated from the following file: