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';
44$langs->loadLangs(array(
'compta',
'salaries',
'bills',
'hrm',
'stripe'));
49 $socid = $user->socid;
54$rowid =
GETPOST(
"rowid",
'alpha');
55$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
56$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
58if (empty($page) || $page == -1) {
61$offset = $limit * $page;
66$optioncss =
GETPOST(
'optioncss',
'alpha');
73$societestatic =
new Societe($db);
78llxHeader(
'', $langs->trans(
"StripeChargeList"));
81 $service =
'StripeTest';
83 dol_htmloutput_mesg($langs->trans(
'YouAreCurrentlyInSandboxMode',
'Stripe'), [],
'warning');
85 $service =
'StripeLive';
89$stripeacc = $stripe->getStripeAccount($service);
96 $option = array(
'limit' => $limit + 1);
100 $totalnboflines =
'';
103 if (GETPOSTISSET(
'starting_after_'.$page)) {
104 $option[
'starting_after'] =
GETPOST(
'starting_after_'.$page,
'alphanohtml');
106 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
107 if ($optioncss !=
'') {
108 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
111 print
'<input type="hidden" name="token" value="'.newToken().
'">';
112 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
113 print
'<input type="hidden" name="action" value="list">';
114 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
115 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
116 print
'<input type="hidden" name="page" value="'.$page.
'">';
118 $title = $langs->trans(
"StripeChargeList");
119 $title .= ($stripeacc ?
' (Stripe connection with Stripe OAuth Connect account '.$stripeacc.
')' :
' (Stripe connection with keys from Stripe module setup)');
121 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $totalnboflines,
'title_accountancy.png', 0,
'',
'hidepaginationprevious', $limit);
123 print
'<div class="div-table-responsive">';
124 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
126 print
'<tr class="liste_titre">';
131 print_liste_field_titre(
"DatePayment", $_SERVER[
"PHP_SELF"],
"",
"",
"",
'', $sortfield, $sortorder,
'center ');
139 $list = \Stripe\Charge::all($option, array(
"stripe_account" => $stripeacc));
141 $list = \Stripe\Charge::all($option);
144 '@phan-var-force \Stripe\Charge $list';
145 $num = count($list->data);
149 if ($limit > 0 && $limit !=
$conf->liste_limit) {
150 $param .=
'&limit='.((int) $limit);
152 $param .=
'&starting_after_'.($page + 1).
'='.$list->data[($limit - 1)]->id;
155 print
'<tr><td colspan="8">'.$e->getMessage().
'</td></td>';
161 foreach ($list->data as $charge) {
162 '@phan-var-force \Stripe\Charge $charge';
167 if ($charge->refunded ==
'1') {
168 $status =
img_picto($langs->trans(
"refunded"),
'statut6');
169 } elseif ($charge->paid ==
'1') {
170 $status =
img_picto($langs->trans((
string) $charge->status),
'statut4');
172 $label = $langs->trans(
"Message").
": ".$charge->failure_message.
"<br>";
173 $label .= $langs->trans(
"Network").
": ".$charge->outcome->network_status.
"<br>";
174 $label .= $langs->trans(
"Status").
": ".$langs->trans((
string) $charge->outcome->seller_message);
175 $status = $form->textwithpicto(
img_picto($langs->trans((
string) $charge->status),
'statut8'), $label, -1);
178 if (isset($charge->payment_method_details->type) && $charge->payment_method_details->type ==
'card') {
179 $type = $langs->trans(
"card");
180 } elseif (isset($charge->source->type) && $charge->source->type ==
'card') {
181 $type = $langs->trans(
"card");
182 } elseif (isset($charge->payment_method_details->type) && $charge->payment_method_details->type ==
'three_d_secure') {
183 $type = $langs->trans(
"card3DS");
184 } elseif (isset($charge->payment_method_details->type) && $charge->payment_method_details->type ==
'sepa_debit') {
185 $type = $langs->trans(
"sepadebit");
186 } elseif (isset($charge->payment_method_details->type) && $charge->payment_method_details->type ==
'ideal') {
187 $type = $langs->trans(
"iDEAL");
200 $FULLTAG = $charge->metadata->FULLTAG;
205 if (!empty($tmparray[
'CUS']) && $tmparray[
'CUS'] > 0) {
206 $societestatic->fetch($tmparray[
'CUS']);
207 } elseif (!empty($charge->metadata->dol_thirdparty_id) && $charge->metadata->dol_thirdparty_id > 0) {
208 $societestatic->fetch($charge->metadata->dol_thirdparty_id);
210 $societestatic->id = 0;
212 if (!empty($tmparray[
'MEM']) && $tmparray[
'MEM'] > 0) {
213 $memberstatic->fetch($tmparray[
'MEM']);
215 $memberstatic->id = 0;
218 print
'<tr class="oddeven">';
220 if (!empty($stripeacc)) {
221 $connect = $stripeacc.
'/';
227 $url =
'https://dashboard.stripe.com/'.$connect.
'test/payments/'.$charge->id;
228 if ($servicestatus) {
229 $url =
'https://dashboard.stripe.com/'.$connect.
'payments/'.$charge->id;
232 print
"<a href='".$url.
"' target='_stripe'>".
img_picto($langs->trans(
'ShowInStripe'),
'globe').
" ".$charge->id.
"</a>";
233 if ($charge->payment_intent) {
234 print
'<br><span class="opacitymedium">'.$charge->payment_intent.
'</span>';
240 if (isModEnabled(
'stripe') && !empty($stripeacc)) {
241 $connect = $stripeacc.
'/';
243 $url =
'https://dashboard.stripe.com/'.$connect.
'test/customers/'.$charge->customer;
244 if ($servicestatus) {
245 $url =
'https://dashboard.stripe.com/'.$connect.
'customers/'.$charge->customer;
247 if (!empty($charge->customer)) {
248 print
'<a href="'.$url.
'" target="_stripe">'.
img_picto($langs->trans(
'ShowInStripe'),
'globe').
' '.$charge->customer.
'</a>';
254 if ($societestatic->id > 0) {
255 print $societestatic->getNomUrl(1);
256 } elseif ($memberstatic->id > 0) {
257 print $memberstatic->getNomUrl(1);
263 if ($charge->metadata->dol_type ==
"order" || $charge->metadata->dol_type ==
"commande") {
265 $object->fetch($charge->metadata->dol_id);
267 print
"<a href='".DOL_URL_ROOT.
"/commande/card.php?id=".
$object->id.
"'>".
img_picto(
'',
'order').
" ".
$object->ref.
"</a>";
271 } elseif ($charge->metadata->dol_type ==
"invoice" || $charge->metadata->dol_type ==
"facture") {
273 $object->fetch($charge->metadata->dol_id);
275 print
"<a href='".DOL_URL_ROOT.
"/compta/facture/card.php?facid=".$charge->metadata->dol_id.
"'>".
img_picto(
'',
'bill').
" ".
$object->ref.
"</a>";
285 print
'<td class="center">'.dol_print_date($charge->created,
'dayhour').
"</td>\n";
291 print
'<td class="right"><span class="amount">'.price(($charge->amount - $charge->amount_refunded) / 100, 0,
'', 1, - 1, - 1, strtoupper($charge->currency)).
"</span></td>";
293 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.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
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.
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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.