Hello,
here is a feedback for paypal Direct payment with D7.3 not tested with PDT nor IPN mode but that should work too with modifications.
You have to modify some files in order to make it work (protocol HTTP1.1 for paypal).
In \modules\boonex\payment\classes\BxPmtPayPal.php because of the used version of HTTP for communicating through the socket:
function _readValidationData($sConnectionUrl, $sRequest)
{
$iErrCode = 0;
$sErrMessage = "";
if($this->getOption('cnt_type') == PP_CNT_TYPE_SSL)
$rSocket = fsockopen("ssl://" . $sConnectionUrl, 443, $iErrCode, $sErrMessage, 60);
else
$rSocket = fsockopen("tcp://" . $sConnectionUrl, 80, $iErrCode, $sErrMessage, 60);
// Is connexion ok ?
if(!$rSocket)
return array('code' => 2, 'message' => 'Can\'t connect to remote host for validation (' . $sErrMessage . ')');
// Else put message on socket with paypal server
fputs($rSocket, "POST /cgi-bin/webscr HTTP/1.1\r\n"); // Protocol HTTP/1.1 and "\r\n\r\n" as separator
fputs($rSocket, "Host: $sConnectionUrl\r\n");
fputs($rSocket, "Content-type: application/x-www-form-urlencoded\r\n");
fputs($rSocket, "Content-length: " . strlen($sRequest) . "\r\n");
fputs($rSocket, "Connection: close\r\n\r\n");
fputs($rSocket, $sRequest . "\r\n\r\n");
// wait for response from Paypal
$sResponse = '';
while(!feof($rSocket))
$sResponse .= fread($rSocket, 1024);
fclose($rSocket);
list($sResponseHeader, $sResponseContent) = explode("\r\n\r\n", $sResponse);
return array('code' => 0, 'content' => explode("\n", $sResponseContent));
}
Moreover, "content" field is badly tested in function _validateCheckout(&$aData):
--> change $aResponse['content'][1] in place of $aResponse['content'][0]
if(strcmp($aResponse['content'][1], "INVALID") == 0)
return array('code' => -1, 'message' => _t('_payment_pp_err_wrong_transaction'));
else if(strcmp($aResponse['content'][1], "VERIFIED") != 0)
return array('code' => 2, 'message' => _t('_payment_pp_err_wrong_verification_status'));
Be aware that the dateExpires field can block the cart update in inc\membership_levels.inc.php
function setMembership
...
Modify following your needs...
...
Hope it helps as I lost many hours on this :)