From da93deb744f382fb119742736994291e1f445b24 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 4 May 2011 10:03:05 +0000 Subject: [PATCH] Fix: show API errors --- htdocs/paypal/lib/paypal.lib.php | 21 ++++++++++++ htdocs/paypal/lib/paypalfunctions.lib.php | 3 +- htdocs/paypal/transaction.php | 42 ++++++++++++----------- 3 files changed, 45 insertions(+), 21 deletions(-) diff --git a/htdocs/paypal/lib/paypal.lib.php b/htdocs/paypal/lib/paypal.lib.php index a75a993f49c..0254351f2e7 100755 --- a/htdocs/paypal/lib/paypal.lib.php +++ b/htdocs/paypal/lib/paypal.lib.php @@ -506,6 +506,27 @@ function hash_call($methodName,$nvpStr) return $nvpResArray; } +/** + * Get API 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; +} /*'---------------------------------------------------------------------------------- diff --git a/htdocs/paypal/lib/paypalfunctions.lib.php b/htdocs/paypal/lib/paypalfunctions.lib.php index 0f5d4c3b82c..bda35165079 100755 --- a/htdocs/paypal/lib/paypalfunctions.lib.php +++ b/htdocs/paypal/lib/paypalfunctions.lib.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2010-2011 Laurent Destailleur + * Copyright (C) 2011 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/paypal/transaction.php b/htdocs/paypal/transaction.php index 7b5a82e1f38..eedd9a053a8 100644 --- a/htdocs/paypal/transaction.php +++ b/htdocs/paypal/transaction.php @@ -113,8 +113,29 @@ llxHeader(); trans('PaypalTransaction'), $page, $_SERVER['PHP_SELF']); +// Search parameters print '
'; print ''; @@ -143,26 +164,7 @@ print ''; print '
'; -// Call Paypal API -if (! empty($nvpStr)) -{ - $resArray=hash_call("TransactionSearch",$nvpStr); - - //var_dump($resArray); - - $reqArray=$_SESSION['nvpReqArray']; - - /* - $ack = strtoupper($resArray["ACK"]); - if($ack!="SUCCESS" && $ack!="SUCCESSWITHWARNING") - { - $_SESSION['reshash']=$resArray; - $location = "APIError.php"; - header("Location: $location"); - } - */ -} - +// Transactions list print ''; print ''; print_liste_field_titre($langs->trans('ID'),$_SERVER['PHP_SELF'],'','',''.$socid.'&viewstatut='.$viewstatut,'width="25%"',$sortfield,$sortorder);