23require
'../main.inc.php';
24require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
25require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
26require_once DOL_DOCUMENT_ROOT.
'/stripe/class/stripe.class.php';
28require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
29require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
31if (isModEnabled(
'accounting')) {
32 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
36$langs->loadLangs(array(
'compta',
'salaries',
'bills',
'hrm',
'stripe'));
41 $socid = $user->socid;
46$rowid =
GETPOST(
"rowid",
'alpha');
47$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
48$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
50if (empty($page) || $page == -1) {
53$offset = $limit * $page;
58$optioncss =
GETPOST(
'optioncss',
'alpha');
65$societestatic =
new Societe($db);
70llxHeader(
'', $langs->trans(
"StripeChargeList"));
73 $service =
'StripeTest';
75 dol_htmloutput_mesg($langs->trans(
'YouAreCurrentlyInSandboxMode',
'Stripe'), [],
'warning');
77 $service =
'StripeLive';
81$stripeacc = $stripe->getStripeAccount($service);
88 $option = array(
'limit' => $limit + 1);
95 if (GETPOSTISSET(
'starting_after_'.$page)) {
96 $option[
'starting_after'] =
GETPOST(
'starting_after_'.$page,
'alphanohtml');
98 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
99 if ($optioncss !=
'') {
100 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
103 print
'<input type="hidden" name="token" value="'.newToken().
'">';
104 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
105 print
'<input type="hidden" name="action" value="list">';
106 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
107 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
108 print
'<input type="hidden" name="page" value="'.$page.
'">';
110 $title = $langs->trans(
"StripeChargeList");
111 $title .= ($stripeacc ?
' (Stripe connection with Stripe OAuth Connect account '.$stripeacc.
')' :
' (Stripe connection with keys from Stripe module setup)');
113 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $totalnboflines,
'title_accountancy.png', 0,
'',
'hidepaginationprevious', $limit);
115 print
'<div class="div-table-responsive">';
116 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
118 print
'<tr class="liste_titre">';
123 print_liste_field_titre(
"DatePayment", $_SERVER[
"PHP_SELF"],
"",
"",
"",
'', $sortfield, $sortorder,
'center ');
131 $list = \Stripe\Charge::all($option, array(
"stripe_account" => $stripeacc));
133 $list = \Stripe\Charge::all($option);
136 '@phan-var-force \Stripe\Charge $list';
137 $num = count($list->data);
141 if ($limit > 0 && $limit != $conf->liste_limit) {
142 $param .=
'&limit='.((int) $limit);
144 $param .=
'&starting_after_'.($page + 1).
'='.$list->data[($limit - 1)]->id;
147 print
'<tr><td colspan="8">'.$e->getMessage().
'</td></td>';
153 foreach ($list->data as $charge) {
154 '@phan-var-force \Stripe\Charge $charge';
159 if ($charge->refunded ==
'1') {
160 $status =
img_picto($langs->trans(
"refunded"),
'statut6');
161 } elseif ($charge->paid ==
'1') {
162 $status =
img_picto($langs->trans((
string) $charge->status),
'statut4');
164 $label = $langs->trans(
"Message").
": ".$charge->failure_message.
"<br>";
165 $label .= $langs->trans(
"Network").
": ".$charge->outcome->network_status.
"<br>";
166 $label .= $langs->trans(
"Status").
": ".$langs->trans((
string) $charge->outcome->seller_message);
167 $status = $form->textwithpicto(
img_picto($langs->trans((
string) $charge->status),
'statut8'), $label, -1);
170 if (isset($charge->payment_method_details->type) && $charge->payment_method_details->type ==
'card') {
171 $type = $langs->trans(
"card");
172 } elseif (isset($charge->source->type) && $charge->source->type ==
'card') {
173 $type = $langs->trans(
"card");
174 } elseif (isset($charge->payment_method_details->type) && $charge->payment_method_details->type ==
'three_d_secure') {
175 $type = $langs->trans(
"card3DS");
176 } elseif (isset($charge->payment_method_details->type) && $charge->payment_method_details->type ==
'sepa_debit') {
177 $type = $langs->trans(
"sepadebit");
178 } elseif (isset($charge->payment_method_details->type) && $charge->payment_method_details->type ==
'ideal') {
179 $type = $langs->trans(
"iDEAL");
192 $FULLTAG = $charge->metadata->FULLTAG;
197 if (!empty($tmparray[
'CUS']) && $tmparray[
'CUS'] > 0) {
198 $societestatic->fetch($tmparray[
'CUS']);
199 } elseif (!empty($charge->metadata->dol_thirdparty_id) && $charge->metadata->dol_thirdparty_id > 0) {
200 $societestatic->fetch($charge->metadata->dol_thirdparty_id);
202 $societestatic->id = 0;
204 if (!empty($tmparray[
'MEM']) && $tmparray[
'MEM'] > 0) {
205 $memberstatic->fetch($tmparray[
'MEM']);
207 $memberstatic->id = 0;
210 print
'<tr class="oddeven">';
212 if (!empty($stripeacc)) {
213 $connect = $stripeacc.
'/';
219 $url =
'https://dashboard.stripe.com/'.$connect.
'test/payments/'.$charge->id;
220 if ($servicestatus) {
221 $url =
'https://dashboard.stripe.com/'.$connect.
'payments/'.$charge->id;
224 print
"<a href='".$url.
"' target='_stripe'>".
img_picto($langs->trans(
'ShowInStripe'),
'globe').
" ".$charge->id.
"</a>";
225 if ($charge->payment_intent) {
226 print
'<br><span class="opacitymedium">'.$charge->payment_intent.
'</span>';
232 if (isModEnabled(
'stripe') && !empty($stripeacc)) {
233 $connect = $stripeacc.
'/';
235 $url =
'https://dashboard.stripe.com/'.$connect.
'test/customers/'.$charge->customer;
236 if ($servicestatus) {
237 $url =
'https://dashboard.stripe.com/'.$connect.
'customers/'.$charge->customer;
239 if (!empty($charge->customer)) {
240 print
'<a href="'.$url.
'" target="_stripe">'.
img_picto($langs->trans(
'ShowInStripe'),
'globe').
' '.$charge->customer.
'</a>';
246 if ($societestatic->id > 0) {
247 print $societestatic->getNomUrl(1);
248 } elseif ($memberstatic->id > 0) {
249 print $memberstatic->getNomUrl(1);
255 if ($charge->metadata->dol_type ==
"order" || $charge->metadata->dol_type ==
"commande") {
257 $object->fetch($charge->metadata->dol_id);
259 print
"<a href='".DOL_URL_ROOT.
"/commande/card.php?id=".
$object->id.
"'>".
img_picto(
'',
'order').
" ".
$object->ref.
"</a>";
263 } elseif ($charge->metadata->dol_type ==
"invoice" || $charge->metadata->dol_type ==
"facture") {
265 $object->fetch($charge->metadata->dol_id);
267 print
"<a href='".DOL_URL_ROOT.
"/compta/facture/card.php?facid=".$charge->metadata->dol_id.
"'>".
img_picto(
'',
'bill').
" ".
$object->ref.
"</a>";
277 print
'<td class="center">'.dol_print_date($charge->created,
'dayhour').
"</td>\n";
283 print
'<td class="right"><span class="amount">'.price(($charge->amount - $charge->amount_refunded) / 100, 0,
'', 1, - 1, - 1, strtoupper($charge->currency)).
"</span></td>";
285 print
'<td class="right">';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage bank accounts.
Class to manage members of a foundation.
Class to manage customers orders.
Class to manage invoices.
Class to manage third parties objects (customers, suppliers, prospects...)
Stripe class @TODO No reason to extends CommonObject.
dolExplodeIntoArray($string, $delimiter=';', $kv='=')
Split a string with 2 keys into key array.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
print_barre_liste($title, $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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_htmloutput_mesg($mesgstring='', $mesgarray=array(), $style='ok', $keepembedded=0)
Print formatted messages to output (Used to show messages on html output).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.