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)) require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
32 $langs->loadLangs(array(
'compta',
'salaries',
'bills',
'hrm',
'stripe'));
35 $socid =
GETPOST(
"socid",
"int");
36 if ($user->socid) $socid = $user->socid;
39 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
40 $rowid =
GETPOST(
"rowid",
'alpha');
41 $sortfield =
GETPOST(
"sortfield",
'alpha');
42 $sortorder =
GETPOST(
"sortorder",
'alpha');
44 if (empty($page) || $page == -1) { $page = 0; }
45 $offset = $limit * $page;
46 $pageprev = $page - 1;
47 $pagenext = $page + 1;
55 $form =
new Form($db);
56 $societestatic =
new Societe($db);
61 llxHeader(
'', $langs->trans(
"StripeChargeList"));
63 if (!empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) ||
GETPOST(
'forcesandbox',
'alpha')))
65 $service =
'StripeTest';
67 dol_htmloutput_mesg($langs->trans(
'YouAreCurrentlyInSandboxMode',
'Stripe'),
'',
'warning');
69 $service =
'StripeLive';
73 $stripeacc = $stripe->getStripeAccount($service);
80 $option = array(
'limit' => $limit + 1);
83 if (
GETPOSTISSET(
'starting_after_'.$page)) $option[
'starting_after'] =
GETPOST(
'starting_after_'.$page,
'alphanohtml');
88 $list = \Stripe\Charge::all($option, array(
"stripe_account" => $stripeacc));
90 $list = \Stripe\Charge::all($option);
93 $num = count($list->data);
99 if ($limit > 0 && $limit != $conf->liste_limit) $param .=
'&limit='.urlencode($limit);
100 $param .=
'&starting_after_'.($page + 1).
'='.$list->data[($limit - 1)]->id;
105 print $e->getMessage();
108 print '<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
109 if ($optioncss !=
'')
print '<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
110 print '<input type="hidden" name="token" value="'.newToken().
'">';
111 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
112 print '<input type="hidden" name="action" value="list">';
113 print '<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
114 print '<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
115 print '<input type="hidden" name="page" value="'.$page.
'">';
117 $title = $langs->trans(
"StripeChargeList");
118 $title .= ($stripeacc ?
' (Stripe connection with Stripe OAuth Connect account '.$stripeacc.
')' :
' (Stripe connection with keys from Stripe module setup)');
120 print_barre_liste($title, $page,
$_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $totalnboflines,
'title_accountancy.png', 0,
'',
'hidepaginationprevious', $limit);
122 print '<div class="div-table-responsive">';
123 print '<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
125 print '<tr class="liste_titre">';
138 foreach ($list->data as $charge)
144 if ($charge->refunded ==
'1') {
145 $status =
img_picto($langs->trans(
"refunded"),
'statut6');
146 } elseif ($charge->paid ==
'1') {
147 $status =
img_picto($langs->trans((
string) $charge->status),
'statut4');
149 $label = $langs->trans(
"Message").
": ".$charge->failure_message.
"<br>";
150 $label .= $langs->trans(
"Network").
": ".$charge->outcome->network_status.
"<br>";
151 $label .= $langs->trans(
"Status").
": ".$langs->trans((
string) $charge->outcome->seller_message);
152 $status = $form->textwithpicto(
img_picto($langs->trans((
string) $charge->status),
'statut8'), $label, -1);
155 if ($charge->payment_method_details->type ==
'card') {
156 $type = $langs->trans(
"card");
157 } elseif ($charge->source->type ==
'card') {
158 $type = $langs->trans(
"card");
159 } elseif ($charge->payment_method_details->type ==
'three_d_secure') {
160 $type = $langs->trans(
"card3DS");
161 } elseif ($charge->payment_method_details->type ==
'sepa_debit') {
162 $type = $langs->trans(
"sepadebit");
163 } elseif ($charge->payment_method_details->type ==
'ideal') {
164 $type = $langs->trans(
"iDEAL");
177 $FULLTAG = $charge->metadata->FULLTAG;
182 if (!empty($tmparray[
'CUS']) && $tmparray[
'CUS'] > 0)
184 $societestatic->fetch($tmparray[
'CUS']);
185 } elseif (!empty($charge->metadata->dol_thirdparty_id) && $charge->metadata->dol_thirdparty_id > 0)
187 $societestatic->fetch($charge->metadata->dol_thirdparty_id);
189 $societestatic->id = 0;
191 if (!empty($tmparray[
'MEM']) && $tmparray[
'MEM'] > 0)
193 $memberstatic->fetch($tmparray[
'MEM']);
195 $memberstatic->id = 0;
198 print
'<tr class="oddeven">';
200 if (!empty($stripeacc)) $connect = $stripeacc.
'/';
203 $url =
'https://dashboard.stripe.com/'.$connect.
'test/payments/'.$charge->id;
206 $url =
'https://dashboard.stripe.com/'.$connect.
'payments/'.$charge->id;
209 print
"<a href='".$url.
"' target='_stripe'>".
img_picto($langs->trans(
'ShowInStripe'),
'globe').
" ".$charge->id.
"</a>";
210 if ($charge->payment_intent) print
'<br><span class="opacitymedium">'.$charge->payment_intent.
'</span>';
215 if (!empty($conf->stripe->enabled) && !empty($stripeacc)) $connect = $stripeacc.
'/';
216 $url =
'https://dashboard.stripe.com/'.$connect.
'test/customers/'.$charge->customer;
219 $url =
'https://dashboard.stripe.com/'.$connect.
'customers/'.$charge->customer;
221 if (!empty($charge->customer))
223 print
'<a href="'.$url.
'" target="_stripe">'.
img_picto($langs->trans(
'ShowInStripe'),
'globe').
' '.$charge->customer.
'</a>';
229 if ($societestatic->id > 0)
231 print $societestatic->getNomUrl(1);
232 } elseif ($memberstatic->id > 0)
234 print $memberstatic->getNomUrl(1);
240 if ($charge->metadata->dol_type ==
"order" || $charge->metadata->dol_type ==
"commande") {
242 $object->fetch($charge->metadata->dol_id);
243 if ($object->id > 0) {
244 print
"<a href='".DOL_URL_ROOT.
"/commande/card.php?id=".$object->id.
"'>".
img_picto(
'',
'object_order').
" ".$object->ref.
"</a>";
248 } elseif ($charge->metadata->dol_type ==
"invoice" || $charge->metadata->dol_type ==
"facture") {
249 print $charge->metadata->dol_type.
' '.$charge->metadata->dol_id.
' - ';
251 $object->fetch($charge->metadata->dol_id);
252 if ($object->id > 0) {
253 print
"<a href='".DOL_URL_ROOT.
"/compta/facture/card.php?facid=".$charge->metadata->dol_id.
"'>".
img_picto(
'',
'object_invoice').
" ".$object->ref.
"</a>";
263 print
'<td class="center">'.dol_print_date($charge->created,
'%d/%m/%Y %H:%M').
"</td>\n";
269 print
'<td class="right">'.price(($charge->amount - $charge->amount_refunded) / 100, 0,
'', 1, - 1, - 1, strtoupper($charge->currency)).
"</td>";
271 print
'<td class="right">';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class to manage bank accounts.
print_barre_liste($titre, $page, $file, $options= '', $sortfield= '', $sortorder= '', $morehtmlcenter= '', $num=-1, $totalnboflines= '', $picto= 'generic', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow= '')
Print a title with navigation controls for pagination.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
Class to manage third parties objects (customers, suppliers, prospects...)
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
Class to manage customers orders.
Class to manage members of a foundation.
print $_SERVER["PHP_SELF"]
Edit parameters.
dolExplodeIntoArray($string, $delimiter= ';', $kv= '=')
Split a string with 2 keys into key array.
dol_htmloutput_mesg($mesgstring= '', $mesgarray=array(), $style= 'ok', $keepembedded=0)
Print formated messages to output (Used to show messages on html output).
print
Draft customers invoices.
Class to manage invoices.
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.