21 require
'../main.inc.php';
22 require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
23 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
24 require_once DOL_DOCUMENT_ROOT.
'/stripe/class/stripe.class.php';
26 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
27 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
28 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
29 if (!empty($conf->accounting->enabled)) {
30 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
34 $langs->loadLangs(array(
'compta',
'salaries',
'bills',
'hrm',
'stripe'));
37 $socid =
GETPOST(
"socid",
"int");
39 $socid = $user->socid;
43 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
44 $rowid =
GETPOST(
"rowid",
'alpha');
45 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
46 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
48 if (empty($page) || $page == -1) {
51 $offset = $limit * $page;
52 $pageprev = $page - 1;
53 $pagenext = $page + 1;
63 $societestatic =
new Societe($db);
68 llxHeader(
'', $langs->trans(
"StripePayoutList"));
70 if (!empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) ||
GETPOST(
'forcesandbox',
'alpha'))) {
71 $service =
'StripeTest';
73 dol_htmloutput_mesg($langs->trans(
'YouAreCurrentlyInSandboxMode',
'Stripe'),
'',
'warning');
75 $service =
'StripeLive';
79 $stripeacc = $stripe->getStripeAccount($service);
86 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
87 if ($optioncss !=
'') {
88 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
90 print
'<input type="hidden" name="token" value="'.newToken().
'">';
91 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
92 print
'<input type="hidden" name="action" value="list">';
93 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
94 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
95 print
'<input type="hidden" name="page" value="'.$page.
'">';
97 $title = $langs->trans(
"StripePayoutList");
98 $title .= ($stripeaccount ?
' (Stripe connection with Stripe OAuth Connect account '.$stripeacc.
')' :
' (Stripe connection with keys from Stripe module setup)');
100 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $totalnboflines,
'title_accountancy.png', 0,
'',
'', $limit);
102 print
'<div class="div-table-responsive">';
103 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
105 print
'<tr class="liste_titre">';
110 print_liste_field_titre(
"DatePayment", $_SERVER[
"PHP_SELF"],
"",
"",
"",
'', $sortfield, $sortorder,
'center ');
111 print_liste_field_titre(
"DateOperation", $_SERVER[
"PHP_SELF"],
"",
"",
"",
'', $sortfield, $sortorder,
'center ');
121 $payout = \Stripe\Payout::all(array(
"limit" => $limit), array(
"stripe_account" => $stripeacc));
123 $payout = \Stripe\Payout::all(array(
"limit" => $limit));
126 foreach ($payout->data as $payout) {
153 $societestatic->fetch($charge->metadata->idcustomer);
154 $societestatic->id = $charge->metadata->idcustomer;
155 $societestatic->lastname = $obj->lastname;
156 $societestatic->firstname = $obj->firstname;
157 $societestatic->admin = $obj->admin;
158 $societestatic->login = $obj->login;
159 $societestatic->email = $obj->email;
160 $societestatic->socid = $obj->fk_soc;
162 print
'<tr class="oddeven">';
165 if (!empty($stripeacc)) {
166 $connect = $stripeacc.
'/';
169 $url =
'https://dashboard.stripe.com/'.$connect.
'test/payouts/'.$payout->id;
170 if ($servicestatus) {
171 $url =
'https://dashboard.stripe.com/'.$connect.
'payouts/'.$payout->id;
174 print
"<td><a href='".$url.
"' target='_stripe'>".
img_picto($langs->trans(
'ShowInStripe'),
'globe').
" ".$payout->id.
"</a></td>\n";
203 print
'<td class="center">'.dol_print_date($payout->created,
'dayhour').
"</td>\n";
205 print
'<td class="center">'.dol_print_date($payout->arrival_date,
'dayhour').
"</td>\n";
207 print
'<td>'.$payout->description.
'</td>';
209 print
'<td class="right"><span class="amount">'.price(($payout->amount) / 100, 0,
'', 1, -1, -1, strtoupper($payout->currency)).
"</span></td>";
211 print
"<td class='right'>";
212 if ($payout->status ==
'paid') {
213 print
img_picto($langs->trans(
"".$payout->status.
""),
'statut4');
214 } elseif ($payout->status ==
'pending') {
215 print
img_picto($langs->trans(
"".$payout->status.
""),
'statut7');
216 } elseif ($payout->status ==
'in_transit') {
217 print
img_picto($langs->trans(
"".$payout->status.
""),
'statut7');
218 } elseif ($payout->status ==
'failed') {
219 print
img_picto($langs->trans(
"".$payout->status.
""),
'statut7');
220 } elseif ($payout->status ==
'canceled') {
221 print
img_picto($langs->trans(
"".$payout->status.
""),
'statut8');
227 print
'<tr><td colspan="6">'.$e->getMessage().
'</td></td>';