Debug stripe module

This commit is contained in:
Laurent Destailleur 2018-04-06 14:05:07 +02:00
parent d3adbdfbbc
commit 8e778df0ff
4 changed files with 33 additions and 14 deletions

View File

@ -113,10 +113,10 @@ class modStripe extends DolibarrModules
'titre'=>'StripeAccount',
'mainmenu'=>'bank',
'leftmenu'=>'stripe',
'url' => '/stripe/charge.php',
'url' => '',
'langs' => 'stripe',
'position' => 100,
'enabled' => '$conf->global->MAIN_FEATURES_LEVEL >= 2',
'enabled' => '$conf->global->MAIN_FEATURES_LEVEL >= 1',
'perms' => '$user->rights->banque->configurer',
'target' => '',
'user' => 0

View File

@ -49,6 +49,7 @@ OAUTH_STRIPE_LIVE_ID=Stripe Connect Client ID (ca_...)
BankAccountForBankTransfer=Bank account for fund payouts
StripeAccount=Stripe account
StripeChargeList=List of Stripe charges
StripeTransactionList=List of Stripe transactions
StripeCustomerId=Stripe customer id
StripePaymentModes=Stripe payment modes
LocalID=Local ID

View File

@ -72,14 +72,14 @@ else
}
$stripeaccount = $stripe->getStripeAccount($service);
if (empty($stripeaccount))
/*if (empty($stripeaccount))
{
print $langs->trans('ErrorStripeAccountNotDefined');
}
}*/
if (!$rowid && $stripeaccount)
if (!$rowid)
{
print '<FORM method="GET" action="'.$_SERVER["PHP_SELF"].'">';
print '<FORM method="POST" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<INPUT type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<INPUT type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<INPUT type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
@ -88,7 +88,10 @@ if (!$rowid && $stripeaccount)
print '<INPUT type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<INPUT type="hidden" name="page" value="'.$page.'">';
print_barre_liste($langs->trans("StripeChargeList"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $totalnboflines, 'title_accountancy.png', 0, '', '', $limit);
$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 '<DIV class="div-table-responsive">';
print '<TABLE class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
@ -106,7 +109,14 @@ if (!$rowid && $stripeaccount)
print "</TR>\n";
$list=\Stripe\Charge::all(array("limit" => $limit), array("stripe_account" => $stripeaccount));
if ($stripeaccount)
{
$list=\Stripe\Charge::all(array("limit" => $limit), array("stripe_account" => $stripeaccount));
}
else
{
$list=\Stripe\Charge::all(array("limit" => $limit));
}
//print $list;
foreach ($list->data as $charge)

View File

@ -71,9 +71,9 @@ if (empty($stripeaccount))
print $langs->trans('ErrorStripeAccountNotDefined');
}
if (! $rowid && $stripeaccount) {
if (! $rowid) {
print '<FORM method="GET" action="' . $_SERVER["PHP_SELF"] . '">';
print '<FORM method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
if ($optioncss != '')
print '<INPUT type="hidden" name="optioncss" value="' . $optioncss . '">';
print '<INPUT type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
@ -83,7 +83,10 @@ if (! $rowid && $stripeaccount) {
print '<INPUT type="hidden" name="sortorder" value="' . $sortorder . '">';
print '<INPUT type="hidden" name="page" value="' . $page . '">';
print_barre_liste($langs->trans("StripeTransactionList"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, 'title_accountancy.png', 0, '', '', $limit);
$title=$langs->trans("StripeTransactionList");
$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 '<DIV class="div-table-responsive">';
print '<TABLE class="tagtable liste' . ($moreforfilter ? " listwithfilterbefore" : "") . '">' . "\n";
@ -101,9 +104,14 @@ if (! $rowid && $stripeaccount) {
print "</TR>\n";
$stripeaccount = $stripe->getStripeAccount($service);
$txn = \Stripe\BalanceTransaction::all(array("limit" => $limit), array("stripe_account" => $stripeaccount));
if ($stripeaccount)
{
$txn = \Stripe\BalanceTransaction::all(array("limit" => $limit), array("stripe_account" => $stripeaccount));
}
else
{
$txn = \Stripe\BalanceTransaction::all(array("limit" => $limit));
}
foreach ($txn->data as $txn) {
print '<TR class="oddeven">';