DPS PxPay - Wrong parameter count for curl_error()
Hello,
We have suddenly started getting the below error when customers are selecting DPS PxPay as the payment option. And by suddenly, I mean, it was working fine a few hours ago (nothing was changed or updated in this time), and now customers are receiving a "This payment option is not available at this time" error and sent back to checkout.
Both DPS and my host are saying it is something to do with our website. Could anyone throw some light on what it could be, please!?
This is the log generated by the DPS module:
Code:
[18-Mar-2015 20:37:23] generateRequest:
<GenerateRequest><PxPayUserId>userid</PxPayUserId>
<PxPayKey>key</PxPayKey>
<AmountInput>XX.XX</AmountInput>
<CurrencyInput>NZD</CurrencyInput>
<MerchantReference>[removed]</MerchantReference>
<TxnData1>[removed]</TxnData1>
<TxnData2>[removed]</TxnData2>
<TxnData3>[removed]</TxnData3>
<TxnType>Purchase</TxnType>
<TxnId>[removed]</TxnId>
<UrlFail>[removed]/dps_pxpay_result_handler.php</UrlFail>
<UrlSuccess>[removed]/dps_pxpay_result_handler.php</UrlSuccess>
</GenerateRequest>
[18-Mar-2015 20:37:53] PHP Warning: Wrong parameter count for curl_error() in /home/xxxx/xxxx/shop/includes/modules/payment/dps_pxpay.php on line 320
[18-Mar-2015 20:37:53] response:
The corresponding line in the dps_pxpay file is:
Code:
$this->log("generateRequest:\n".str_replace(MODULE_PAYMENT_DPS_PXPAY_USERID, 'userid', str_replace(MODULE_PAYMENT_DPS_PXPAY_KEY, 'key', $generateRequest)));
$curl = $this->_initCURL($generateRequest);
$success = false;
if ($response = curl_exec($curl)) {
curl_close($curl);
$this->log("response:\n".$response);
$valid = $this->_xmlAttribute($response, 'valid');
if (1 == $valid) {
// redirect to DPS PxPay payments form
$uri = $this->_xmlElement($response, 'URI');
zen_redirect($uri);
} else {
// redisplay checkout
$this->_emailNotify(MODULE_PAYMENT_DPS_PXPAY_TEXT_INVALID_PAYMENT_REQUEST, $response);
$messageStack->add_session('checkout_payment', MODULE_PAYMENT_DPS_PXPAY_TEXT_NOT_AVAILABLE, 'error');
zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL', true, false));
}
} else {
// calling DPS failed
$this->log("response:\n".curl_error());
$this->_emailNotify(MODULE_PAYMENT_DPS_PXPAY_TEXT_CANT_CONNECT, $generateRequest);
$messageStack->add_session('checkout_payment', MODULE_PAYMENT_DPS_PXPAY_TEXT_NOT_AVAILABLE, 'error');
zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL', true, false));
}
And this is the initCURL function:
Code:
function &_initCURL($query) {
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $this->_dpsPxpayUrl);
curl_setopt($curl, CURLOPT_FRESH_CONNECT, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $query);
if (defined('CURLOPT_POSTFIELDSIZE')) {
curl_setopt($curl, CURLOPT_POSTFIELDSIZE, 0);
}
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($curl, CURLOPT_HEADER, 0);
//curl_setopt($curl, CURLOPT_SSLVERSION, 3);
if (strtoupper(substr(@php_uname('s'), 0, 3)) === 'WIN') {
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
}
return $curl;
}
Please help!
Re: DPS PxPay - Wrong parameter count for curl_error()
So I just changed line 320 from this:
Code:
$this->log("response:\n".curl_error());
to this:
Code:
$this->log("response:\n".curl_error($curl));
and now this is the reponse I get:
Code:
[18-Mar-2015 22:35:27] response:
Connection timed out after 30001 milliseconds
So now I'm wondering does this mean that the call to the DPS url is taking too long? Or the server I am hosted on is taking too long?
Re: DPS PxPay - Wrong parameter count for curl_error()
I updated the curl tester to check the DPS gateway, and have received an error (28) for DPS. All other gateways were GOOD.
I uploaded the curl tester to different sites on different servers, and received a GOOD for DPS on those tests.
So I guess it's a problem with this website's server talking to DPS's server .....