diff --git a/htdocs/paypal/lib/paypal.lib.php b/htdocs/paypal/lib/paypal.lib.php index dfb68d581a7e2a50217a0ee1403546dfdd17d1ba..fd68f7f274d4ade94d9b225b9e0373bc768f0912 100755 --- a/htdocs/paypal/lib/paypal.lib.php +++ b/htdocs/paypal/lib/paypal.lib.php @@ -26,8 +26,8 @@ /** * Show header * - * @param string $title - * @param string $head + * @param string $title Title + * @param string $head More header to add * @return void */ function llxHeaderPaypal($title, $head = "") @@ -334,8 +334,8 @@ function print_paypal_redirect($paymentAmount,$currencyCodeType,$paymentType,$re $landingPage='Billing'; } - dol_syslog("expresscheckout redirect with CallSetExpressCheckout $paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL, $tag, $solutionType, $landingPage, $shipToName, $shipToStreet, $shipToCity, $shipToState, $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum"); - $resArray = CallSetExpressCheckout( + dol_syslog("expresscheckout redirect with callSetExpressCheckout $paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL, $tag, $solutionType, $landingPage, $shipToName, $shipToStreet, $shipToCity, $shipToState, $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum"); + $resArray = callSetExpressCheckout( $paymentAmount, $currencyCodeType, $paymentType, @@ -404,7 +404,7 @@ function print_paypal_redirect($paymentAmount,$currencyCodeType,$paymentType,$re ' desc: Product description '-------------------------------------------------------------------------------------------------------------------------------------------- */ -function CallSetExpressCheckout($paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL, $tag, $solutionType, $landingPage, $shipToName, $shipToStreet, $shipToCity, $shipToState, $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum, $email='', $desc='') +function callSetExpressCheckout($paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL, $tag, $solutionType, $landingPage, $shipToName, $shipToStreet, $shipToCity, $shipToState, $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum, $email='', $desc='') { //------------------------------------------------------------------------------------------------------------------------------------ // Construct the parameter string that describes the SetExpressCheckout API call in the shortcut implementation @@ -461,9 +461,10 @@ function CallSetExpressCheckout($paymentAmount, $currencyCodeType, $paymentType, /** * Prepares the parameters for the GetExpressCheckoutDetails API Call. * - * @return array The NVP Collection object of the GetExpressCheckoutDetails Call Response. + * @param string $token Token + * @return array The NVP Collection object of the GetExpressCheckoutDetails Call Response. */ -function GetDetails($token) +function getDetails($token) { //'-------------------------------------------------------------- //' At this point, the buyer has completed authorizing the payment @@ -504,9 +505,16 @@ function GetDetails($token) /** * Validate payment * + * @param string $token Token + * @param string $paymentType Type + * @param string $currencyCodeType Currency + * @param string $payerID Payer ID + * @param string $ipaddress IP Address + * @param string $FinalPaymentAmt Amount + * @param string $tag Tag * @return void */ -function ConfirmPayment($token, $paymentType, $currencyCodeType, $payerID, $ipaddress, $FinalPaymentAmt, $tag) +function confirmPayment($token, $paymentType, $currencyCodeType, $payerID, $ipaddress, $FinalPaymentAmt, $tag) { /* Gather the information to make the final call to finalize the PayPal payment. The variable nvpstr @@ -699,31 +707,6 @@ function hash_call($methodName,$nvpStr) } -/** - * Get API errors - * - * @return array Array of errors - */ -function GetApiError() -{ - $errors=array(); - - $resArray=$_SESSION['reshash']; - - if(isset($_SESSION['curl_error_no'])) - { - $errors[] = $_SESSION['curl_error_no'].'-'.$_SESSION['curl_error_msg']; - } - - foreach($resArray as $key => $value) - { - $errors[] = $key.'-'.$value; - } - - return $errors; -} - - /** * This function will take NVPString and convert it to an Associative Array and it will decode the response. * It is usefull to search for a particular key and displaying arrays. diff --git a/htdocs/public/paypal/paymentok.php b/htdocs/public/paypal/paymentok.php index 426d2539966dcaf28458159bf32269c16fc0e2cb..f121ec9f83dd9de86f567258d2920b12bd28292e 100755 --- a/htdocs/public/paypal/paymentok.php +++ b/htdocs/public/paypal/paymentok.php @@ -118,17 +118,17 @@ if ($PAYPALTOKEN) if (! empty($paymentType)) { dol_syslog("We call GetExpressCheckoutDetails"); - $resArray=GetDetails($token); + $resArray=getDetails($token); //var_dump($resarray); dol_syslog("We call DoExpressCheckoutPayment token=".$token." paymentType=".$paymentType." currencyCodeType=".$currencyCodeType." payerID=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt." fulltag=".$fulltag); - $resArray=ConfirmPayment($token, $paymentType, $currencyCodeType, $payerID, $ipaddress, $FinalPaymentAmt, $fulltag); + $resArray=confirmPayment($token, $paymentType, $currencyCodeType, $payerID, $ipaddress, $FinalPaymentAmt, $fulltag); $ack = strtoupper($resArray["ACK"]); if($ack=="SUCCESS" || $ack=="SUCCESSWITHWARNING") { $object = (object) 'paypal'; - + $object->source = $source; $object->ref = $ref; $object->payerID = $payerID; @@ -144,7 +144,7 @@ if ($PAYPALTOKEN) print $langs->trans("YourPaymentHasBeenRecorded")."<br>\n"; print $langs->trans("ThisIsTransactionId",$TRANSACTIONID)."<br>\n"; if (! empty($conf->global->PAYPAL_MESSAGE_OK)) print $conf->global->PAYPAL_MESSAGE_OK; - + // Appel des triggers include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); $interface=new Interfaces($db);