Fix: show API errors
This commit is contained in:
parent
d3c2d950a6
commit
da93deb744
@ -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;
|
||||
}
|
||||
|
||||
|
||||
/*'----------------------------------------------------------------------------------
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.org>
|
||||
/* Copyright (C) 2010-2011 Laurent Destailleur <eldy@users.sourceforge.org>
|
||||
* Copyright (C) 2011 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* 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
|
||||
|
||||
@ -113,8 +113,29 @@ llxHeader();
|
||||
|
||||
<?php
|
||||
|
||||
// Call Paypal API
|
||||
if (! empty($nvpStr))
|
||||
{
|
||||
$resArray=hash_call("TransactionSearch",$nvpStr);
|
||||
|
||||
//var_dump($resArray);
|
||||
|
||||
$reqArray=$_SESSION['nvpReqArray'];
|
||||
|
||||
$ack = strtoupper($resArray["ACK"]);
|
||||
$errors='';
|
||||
if($ack!="SUCCESS" && $ack!="SUCCESSWITHWARNING")
|
||||
{
|
||||
$_SESSION['reshash']=$resArray;
|
||||
$errors = GetApiError();
|
||||
}
|
||||
}
|
||||
|
||||
dol_htmloutput_errors('',$errors);
|
||||
|
||||
print_barre_liste($langs->trans('PaypalTransaction'), $page, $_SERVER['PHP_SELF']);
|
||||
|
||||
// Search parameters
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
|
||||
@ -143,26 +164,7 @@ print '</table>';
|
||||
print '</form>';
|
||||
|
||||
|
||||
// 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 '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans('ID'),$_SERVER['PHP_SELF'],'','',''.$socid.'&viewstatut='.$viewstatut,'width="25%"',$sortfield,$sortorder);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user