Fix: show API errors
This commit is contained in:
parent
d3c2d950a6
commit
da93deb744
@ -506,6 +506,27 @@ function hash_call($methodName,$nvpStr)
|
|||||||
return $nvpResArray;
|
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
|
<?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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@ -113,8 +113,29 @@ llxHeader();
|
|||||||
|
|
||||||
<?php
|
<?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']);
|
print_barre_liste($langs->trans('PaypalTransaction'), $page, $_SERVER['PHP_SELF']);
|
||||||
|
|
||||||
|
// Search parameters
|
||||||
print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
|
print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
|
||||||
@ -143,26 +164,7 @@ print '</table>';
|
|||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
|
|
||||||
// Call Paypal API
|
// Transactions list
|
||||||
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");
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre($langs->trans('ID'),$_SERVER['PHP_SELF'],'','',''.$socid.'&viewstatut='.$viewstatut,'width="25%"',$sortfield,$sortorder);
|
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