mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
New: Work on paypal module (finished)
This commit is contained in:
parent
cc02778a69
commit
717ae6d9c1
|
|
@ -194,6 +194,9 @@ $shipToName, $shipToStreet, $shipToCity, $shipToState, $shipToCountryCode, $ship
|
|||
$nvpstr = $nvpstr . "&PHONENUM=" . urlencode($phoneNum);
|
||||
$nvpstr = $nvpstr . "&SOLUTIONTYPE=" . urlencode($solutionType);
|
||||
$nvpstr = $nvpstr . "&LANDINGPAGE=" . urlencode($landingPage);
|
||||
//$nvpstr = $nvpstr . "&CUSTOMERSERVICENUMBER=" . urlencode($tag);
|
||||
$nvpstr = $nvpstr . "&INVNUM=" . urlencode($tag);
|
||||
|
||||
|
||||
|
||||
$_SESSION["currencyCodeType"] = $currencyCodeType;
|
||||
|
|
@ -210,6 +213,7 @@ $shipToName, $shipToStreet, $shipToCity, $shipToState, $shipToCountryCode, $ship
|
|||
{
|
||||
$token = urldecode($resArray["TOKEN"]);
|
||||
$_SESSION['TOKEN']=$token;
|
||||
$_SESSION['ipaddress']=$_SERVER['REMOTE_ADDR ']; // Payer ip
|
||||
}
|
||||
|
||||
return $resArray;
|
||||
|
|
@ -283,6 +287,8 @@ function ConfirmPayment( $token, $paymentType, $currencyCodeType, $payerID, $ipa
|
|||
|
||||
$nvpstr = '&TOKEN=' . urlencode($token) . '&PAYERID=' . urlencode($payerID) . '&PAYMENTACTION=' . urlencode($paymentType) . '&AMT=' . urlencode($FinalPaymentAmt);
|
||||
$nvpstr .= '&CURRENCYCODE=' . urlencode($currencyCodeType) . '&IPADDRESS=' . urlencode($ipaddress);
|
||||
//$nvpstr .= '&CUSTOM=' . urlencode($tag);
|
||||
$nvpstr .= '&INVNUM=' . urlencode($tag);
|
||||
|
||||
/* Make the call to PayPal to finalize payment
|
||||
If an error occured, show the resulting errors
|
||||
|
|
@ -336,20 +342,21 @@ $countryCode, $currencyCode, $tag )
|
|||
global $sBNCode;
|
||||
|
||||
//Construct the parameter string that describes DoDirectPayment
|
||||
$nvpstr = "&AMT=" . $paymentAmount;
|
||||
$nvpstr = $nvpstr . "&CURRENCYCODE=" . $currencyCode;
|
||||
$nvpstr = $nvpstr . "&PAYMENTACTION=" . $paymentType;
|
||||
$nvpstr = $nvpstr . "&CREDITCARDTYPE=" . $creditCardType;
|
||||
$nvpstr = $nvpstr . "&ACCT=" . $creditCardNumber;
|
||||
$nvpstr = $nvpstr . "&EXPDATE=" . $expDate;
|
||||
$nvpstr = $nvpstr . "&CVV2=" . $cvv2;
|
||||
$nvpstr = $nvpstr . "&FIRSTNAME=" . $firstName;
|
||||
$nvpstr = $nvpstr . "&LASTNAME=" . $lastName;
|
||||
$nvpstr = $nvpstr . "&STREET=" . $street;
|
||||
$nvpstr = $nvpstr . "&CITY=" . $city;
|
||||
$nvpstr = $nvpstr . "&STATE=" . $state;
|
||||
$nvpstr = $nvpstr . "&COUNTRYCODE=" . $countryCode;
|
||||
$nvpstr = "&AMT=" . urlencode($paymentAmount);
|
||||
$nvpstr = $nvpstr . "&CURRENCYCODE=" . urlencode($currencyCode);
|
||||
$nvpstr = $nvpstr . "&PAYMENTACTION=" . urlencode($paymentType);
|
||||
$nvpstr = $nvpstr . "&CREDITCARDTYPE=" . urlencode($creditCardType);
|
||||
$nvpstr = $nvpstr . "&ACCT=" . urlencode($creditCardNumber);
|
||||
$nvpstr = $nvpstr . "&EXPDATE=" . urlencode($expDate);
|
||||
$nvpstr = $nvpstr . "&CVV2=" . urlencode($cvv2);
|
||||
$nvpstr = $nvpstr . "&FIRSTNAME=" . urlencode($firstName);
|
||||
$nvpstr = $nvpstr . "&LASTNAME=" . urlencode($lastName);
|
||||
$nvpstr = $nvpstr . "&STREET=" . urlencode($street);
|
||||
$nvpstr = $nvpstr . "&CITY=" . urlencode($city);
|
||||
$nvpstr = $nvpstr . "&STATE=" . urlencode($state);
|
||||
$nvpstr = $nvpstr . "&COUNTRYCODE=" . urlencode($countryCode);
|
||||
$nvpstr = $nvpstr . "&IPADDRESS=" . $_SERVER['REMOTE_ADDR'];
|
||||
$nvpstr = $nvpstr . "&INVNUM=" . urlencode($tag);
|
||||
|
||||
$resArray=hash_call("DoDirectPayment", $nvpstr);
|
||||
|
||||
|
|
@ -397,7 +404,7 @@ function hash_call($methodName,$nvpStr)
|
|||
if($USE_PROXY) curl_setopt ($ch, CURLOPT_PROXY, $PROXY_HOST. ":" . $PROXY_PORT);
|
||||
|
||||
//NVPRequest for submitting to server
|
||||
$nvpreq="METHOD=" . urlencode($methodName) . "&VERSION=" . urlencode($API_version) . "&PWD=" . urlencode($PAYPAL_API_PASSWORD) . "&USER=" . urlencode($PAYPAL_API_USER) . "&SIGNATURE=" . urlencode($PAYPAL_API_SIGNATURE) . $nvpStr . "&BUTTONSOURCE=" . urlencode($sBNCode);
|
||||
$nvpreq ="METHOD=" . urlencode($methodName) . "&VERSION=" . urlencode($API_version) . "&PWD=" . urlencode($PAYPAL_API_PASSWORD) . "&USER=" . urlencode($PAYPAL_API_USER) . "&SIGNATURE=" . urlencode($PAYPAL_API_SIGNATURE) . $nvpStr . "&BUTTONSOURCE=" . urlencode($sBNCode);
|
||||
$nvpreq.="&LOCALE=".strtoupper($langs->getDefaultLang(1));
|
||||
//$nvpreq.="&BRANDNAME=".urlencode(); // Override merchant name
|
||||
//$nvpreq.="&NOTIFYURL=".urlencode(); // For Instant Payment Notification url
|
||||
|
|
|
|||
|
|
@ -353,7 +353,8 @@ if ($_REQUEST["source"] == 'order')
|
|||
$amount=$order->total_ttc;
|
||||
if ($_REQUEST["amount"]) $amount=$_REQUEST["amount"];
|
||||
|
||||
$fulltag='IR='.$order->ref.'.TPID='.$order->client->id.'.TP='.strtr($order->client->nom,"-"," ");
|
||||
$fulltag='ORD='.$order->ref.'.CUS='.$order->client->id;
|
||||
//$fulltag.='.NAM='.strtr($order->client->nom,"-"," ");
|
||||
if (! empty($_REQUEST["tag"])) { $tag=$_REQUEST["tag"]; $fulltag.='.TAG='.$_REQUEST["tag"]; }
|
||||
$fulltag=dol_string_unaccent($fulltag);
|
||||
|
||||
|
|
@ -460,7 +461,8 @@ if ($_REQUEST["source"] == 'invoice')
|
|||
$amount=$invoice->total_ttc - $invoice->getSommePaiement();
|
||||
if ($_REQUEST["amount"]) $amount=$_REQUEST["amount"];
|
||||
|
||||
$fulltag='IR='.$invoice->ref.'.TPID='.$invoice->client->id.'.TP='.strtr($invoice->client->nom,"-"," ");
|
||||
$fulltag='INV='.$invoice->ref.'.CUS='.$invoice->client->id;
|
||||
//$fulltag.='.NAM='.strtr($invoice->client->nom,"-"," ");
|
||||
if (! empty($_REQUEST["tag"])) { $tag=$_REQUEST["tag"]; $fulltag.='.TAG='.$_REQUEST["tag"]; }
|
||||
$fulltag=dol_string_unaccent($fulltag);
|
||||
|
||||
|
|
@ -610,7 +612,8 @@ if ($_REQUEST["source"] == 'contractline')
|
|||
}
|
||||
if ($_REQUEST["amount"]) $amount=$_REQUEST["amount"];
|
||||
|
||||
$fulltag='CLR='.$contractline->ref.'.CR='.$contract->ref.'.TPID='.$contract->client->id.'.TP='.strtr($contract->client->nom,"-"," ");
|
||||
$fulltag='COL='.$contractline->ref.'.CON='.$contract->ref.'.CUS='.$contract->client->id;
|
||||
//$fulltag.='.NAM='.strtr($contract->client->nom,"-"," ");
|
||||
if (! empty($_REQUEST["tag"])) { $tag=$_REQUEST["tag"]; $fulltag.='.TAG='.$_REQUEST["tag"]; }
|
||||
$fulltag=dol_string_unaccent($fulltag);
|
||||
|
||||
|
|
@ -762,7 +765,8 @@ if ($_REQUEST["source"] == 'membersubscription')
|
|||
$amount=$subscription->total_ttc;
|
||||
if ($_REQUEST["amount"]) $amount=$_REQUEST["amount"];
|
||||
|
||||
$fulltag='MID='.$member->id.'.M='.strtr($member->getFullName($langs),"-"," ");
|
||||
$fulltag='MEM='.$member->id;
|
||||
//$fulltag.='.NAM='.strtr($member->getFullName($langs),"-"," ");
|
||||
if (! empty($_REQUEST["tag"])) { $tag=$_REQUEST["tag"]; $fulltag.='.TAG='.$_REQUEST["tag"]; }
|
||||
$fulltag=dol_string_unaccent($fulltag);
|
||||
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ if ($PAYPALTOKEN)
|
|||
$currencyCodeType = $_SESSION['currencyCodeType'];
|
||||
$FinalPaymentAmt = $_SESSION["Payment_Amount"];
|
||||
// From env
|
||||
$ipaddress = $_SERVER['REMOTE_ADDR ']; // Payer ip
|
||||
$ipaddress = $_SESSION['ipaddress'];
|
||||
|
||||
|
||||
dol_syslog("We call GetExpressCheckoutDetails");
|
||||
|
|
@ -131,6 +131,7 @@ if ($PAYPALTOKEN)
|
|||
// TOKEN=EC%2d1NJ057703V9359028&TIMESTAMP=2010%2d11%2d01T11%3a40%3a13Z&CORRELATIONID=1efa8c6a36bd8&ACK=Success&VERSION=56&BUILD=1553277&TRANSACTIONID=9B994597K9921420R&TRANSACTIONTYPE=expresscheckout&PAYMENTTYPE=instant&ORDERTIME=2010%2d11%2d01T11%3a40%3a12Z&AMT=155%2e57&FEEAMT=5%2e54&TAXAMT=0%2e00&CURRENCYCODE=EUR&PAYMENTSTATUS=Completed&PENDINGREASON=None&REASONCODE=None
|
||||
$PAYMENTSTATUS=urldecode($resArray["PAYMENTSTATUS"]); // Should contains 'Completed'
|
||||
$TRANSACTIONID=urldecode($resArray["TRANSACTIONID"]);
|
||||
$NOTE=urldecode($resArray["NOTE"]);
|
||||
|
||||
print $langs->trans("YourPaymentHasBeenRecorded")."<br>\n";
|
||||
print $langs->trans("ThisIsTransactionId",$TRANSACTIONID)."<br>\n";
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user