Debug list of transactions
This commit is contained in:
parent
8e778df0ff
commit
9ba55f0d1f
@ -54,17 +54,18 @@ $pagenext = $page + 1;
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('', $langs->trans("StripeChargeList"));
|
||||
|
||||
$form = new Form($db);
|
||||
$societestatic = new Societe($db);
|
||||
$memberstatic = new Adherent($db);
|
||||
$acc = new Account($db);
|
||||
$stripe=new Stripe($db);
|
||||
|
||||
llxHeader('', $langs->trans("StripeChargeList"));
|
||||
|
||||
if (! empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox','alpha')))
|
||||
{
|
||||
$service = 'StripeTest';
|
||||
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode','Stripe'),'','warning');
|
||||
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning');
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -91,20 +92,20 @@ if (!$rowid)
|
||||
$title=$langs->trans("StripeChargeList");
|
||||
$title.=($stripeaccount?' (Stripe connection with Stripe OAuth Connect account '.$stripeaccount.')':' (Stripe connection with keys from Stripe module setup)');
|
||||
|
||||
print_barre_liste($title,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $totalnboflines, 'title_accountancy.png', 0, '', '', $limit);
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $totalnboflines, 'title_accountancy.png', 0, '', '', $limit);
|
||||
|
||||
print '<DIV class="div-table-responsive">';
|
||||
print '<TABLE class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
print '<TR class="liste_titre">';
|
||||
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder);
|
||||
print_liste_field_titre("StripeCustomer",$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder);
|
||||
print_liste_field_titre("StripeCustomerId",$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder);
|
||||
print_liste_field_titre("Customer",$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder);
|
||||
print_liste_field_titre("Origin",$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder);
|
||||
print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"","","",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"","","",'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("Paid",$_SERVER["PHP_SELF"],"","","",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"","","",'align="left"');
|
||||
print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"","","",'align="right"');
|
||||
print "</TR>\n";
|
||||
|
||||
print "</TR>\n";
|
||||
@ -149,7 +150,7 @@ if (!$rowid)
|
||||
print "<TD><A href='".DOL_URL_ROOT."/stripe/charge.php?rowid=".$charge->id."'>".$charge->id."</A></TD>\n";
|
||||
// Stripe customer
|
||||
print "<TD>".$charge->customer."</TD>\n";
|
||||
// Employee
|
||||
// Link
|
||||
print "<TD>";
|
||||
if ($societestatic->id > 0)
|
||||
{
|
||||
@ -190,7 +191,7 @@ if (!$rowid)
|
||||
// Amount
|
||||
print "<TD align=\"right\">".price(($charge->amount-$charge->amount_refunded)/100)."</TD>";
|
||||
// Status
|
||||
print "<TD>";
|
||||
print '<TD align="right">';
|
||||
if ($charge->refunded=='1'){
|
||||
print $langs->trans("refunded");
|
||||
} elseif ($charge->paid=='1'){
|
||||
|
||||
@ -18,6 +18,8 @@
|
||||
// Put here all includes required by your class file
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php';
|
||||
//require_once DOL_DOCUMENT_ROOT.'/core/lib/stripe.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
@ -46,16 +48,21 @@ $offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
/*
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
llxHeader('', $langs->trans("StripeTransactionList"));
|
||||
|
||||
$form = new Form($db);
|
||||
$societestatic = new societe($db);
|
||||
$societestatic = new Societe($db);
|
||||
$memberstatic = new Adherent($db);
|
||||
$acc = new Account($db);
|
||||
$stripe = new Stripe($db);
|
||||
|
||||
if (! empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha')))
|
||||
llxHeader('', $langs->trans("StripeTransactionList"));
|
||||
|
||||
if (! empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox','alpha')))
|
||||
{
|
||||
$service = 'StripeTest';
|
||||
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning');
|
||||
@ -66,10 +73,10 @@ else
|
||||
}
|
||||
|
||||
$stripeaccount = $stripe->getStripeAccount($service);
|
||||
if (empty($stripeaccount))
|
||||
/*if (empty($stripeaccount))
|
||||
{
|
||||
print $langs->trans('ErrorStripeAccountNotDefined');
|
||||
}
|
||||
}*/
|
||||
|
||||
if (! $rowid) {
|
||||
|
||||
@ -93,13 +100,14 @@ if (! $rowid) {
|
||||
|
||||
print '<TR class="liste_titre">';
|
||||
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Customer", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder);
|
||||
//print_liste_field_titre("StripeCustomerId",$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder);
|
||||
//print_liste_field_titre("CustomerId", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Origin", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "", "", "", 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", "", 'align="left"');
|
||||
print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "", "", "", 'align="left"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Paid", $_SERVER["PHP_SELF"], "", "", "", 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Fee", $_SERVER["PHP_SELF"], "", "", "", 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", "", 'align="right"');
|
||||
print "</TR>\n";
|
||||
|
||||
print "</TR>\n";
|
||||
@ -113,8 +121,34 @@ if (! $rowid) {
|
||||
$txn = \Stripe\BalanceTransaction::all(array("limit" => $limit));
|
||||
}
|
||||
|
||||
foreach ($txn->data as $txn) {
|
||||
print '<TR class="oddeven">';
|
||||
foreach ($txn->data as $txn)
|
||||
{
|
||||
//$charge = $txn;
|
||||
//var_dump($txn);
|
||||
|
||||
// The metadata FULLTAG is defined by the online payment page
|
||||
/*$FULLTAG=$charge->metadata->FULLTAG;
|
||||
|
||||
// Save into $tmparray all metadata
|
||||
$tmparray = dolExplodeIntoArray($FULLTAG,'.','=');
|
||||
// Load origin object according to metadata
|
||||
if (! empty($tmparray['CUS']))
|
||||
{
|
||||
$societestatic->fetch($tmparray['CUS']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$societestatic->id = 0;
|
||||
}
|
||||
if (! empty($tmparray['MEM']))
|
||||
{
|
||||
$memberstatic->fetch($tmparray['MEM']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$memberstatic->id = 0;
|
||||
}*/
|
||||
|
||||
$societestatic->fetch($charge->metadata->idcustomer);
|
||||
$societestatic->id = $charge->metadata->idcustomer;
|
||||
$societestatic->lastname = $obj->lastname;
|
||||
@ -124,33 +158,47 @@ if (! $rowid) {
|
||||
$societestatic->email = $obj->email;
|
||||
$societestatic->societe_id = $obj->fk_soc;
|
||||
|
||||
print '<TR class="oddeven">';
|
||||
|
||||
// Ref
|
||||
print "<TD><A href='" . DOL_URL_ROOT . "/stripe/transaction.php?rowid=" . $txn->source . "'>" . $txn->source . "</A></TD>\n";
|
||||
// Employee
|
||||
print "<TD>" . $societestatic->getNomUrl(1) . "</TD>\n";
|
||||
// Stripe customer
|
||||
//print "<TD>".$charge->customer."</TD>\n";
|
||||
// Link
|
||||
/*print "<TD>";
|
||||
if ($societestatic->id > 0)
|
||||
{
|
||||
print $societestatic->getNomUrl(1);
|
||||
}
|
||||
if ($memberstatic->id > 0)
|
||||
{
|
||||
print $memberstatic->getNomUrl(1);
|
||||
}
|
||||
print "</TD>\n";*/
|
||||
// Origine
|
||||
print "<TD>";
|
||||
if ($charge->metadata->source == "order") {
|
||||
print $FULLTAG;
|
||||
if ($charge->metadata->source=="order"){
|
||||
$object = new Commande($db);
|
||||
$object->fetch($charge->metadata->idsource);
|
||||
print "<A href='" . DOL_URL_ROOT . "/commande/card.php?id=" . $txn->metadata->idsource . "'>" . img_picto('', 'object_order') . " " . $object->ref . "</A>";
|
||||
} elseif ($txn->metadata->source == "invoice") {
|
||||
print "<A href='".DOL_URL_ROOT."/commande/card.php?id=".$charge->metadata->idsource."'>".img_picto('', 'object_order')." ".$object->ref."</A>";
|
||||
} elseif ($charge->metadata->source=="invoice"){
|
||||
$object = new Facture($db);
|
||||
$object->fetch($txn->metadata->idsource);
|
||||
print "<A href='" . DOL_URL_ROOT . "/compta/facture/card.php?facid=" . $txn->metadata->idsource . "'>" . img_picto('', 'object_invoice') . " " . $object->ref . "</A>";
|
||||
$object->fetch($charge->metadata->idsource);
|
||||
print "<A href='".DOL_URL_ROOT."/compta/facture/card.php?facid=".$charge->metadata->idsource."'>".img_picto('', 'object_invoice')." ".$object->ref."</A>";
|
||||
}
|
||||
print "</TD>\n";
|
||||
// Date payment
|
||||
print '<TD align="center">' . dol_print_date($txn->created, '%d/%m/%Y %H:%M') . "</TD>\n";
|
||||
// Label payment
|
||||
print "<TD>";
|
||||
|
||||
print "</TD>\n";
|
||||
// Type
|
||||
print '<TD>' . $txn->type . '</TD>';
|
||||
// Amount
|
||||
print "<TD align=\"right\">" . price(($txn->amount) / 100) . "</TD>";
|
||||
print "<TD align=\"right\">" . price(($txn->fee) / 100) . "</TD>";
|
||||
// Status
|
||||
print "<TD align='right'>";
|
||||
print $txn->status;
|
||||
print '</TD>';
|
||||
print "</TR>\n";
|
||||
}
|
||||
print "</TABLE>";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user