|
|
|
@@ -87,38 +87,18 @@ if (!$rowid) {
|
|
|
|
$option = array('limit' => $limit + 1);
|
|
|
|
$option = array('limit' => $limit + 1);
|
|
|
|
$num = 0;
|
|
|
|
$num = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$param = '';
|
|
|
|
|
|
|
|
$totalnboflines = '';
|
|
|
|
|
|
|
|
$moreforfilter = '';
|
|
|
|
|
|
|
|
$list = null;
|
|
|
|
if (GETPOSTISSET('starting_after_'.$page)) {
|
|
|
|
if (GETPOSTISSET('starting_after_'.$page)) {
|
|
|
|
$option['starting_after'] = GETPOST('starting_after_'.$page, 'alphanohtml');
|
|
|
|
$option['starting_after'] = GETPOST('starting_after_'.$page, 'alphanohtml');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
if ($stripeacc) {
|
|
|
|
|
|
|
|
$list = \Stripe\Charge::all($option, array("stripe_account" => $stripeacc));
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$list = \Stripe\Charge::all($option);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$num = count($list->data);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$totalnboflines = '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$param = '';
|
|
|
|
|
|
|
|
//if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
|
|
|
|
|
|
|
if ($limit > 0 && $limit != $conf->liste_limit) {
|
|
|
|
|
|
|
|
$param .= '&limit='.urlencode($limit);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$param .= '&starting_after_'.($page + 1).'='.$list->data[($limit - 1)]->id;
|
|
|
|
|
|
|
|
//$param.='&ending_before_'.($page+1).'='.$list->data[($limit-1)]->id;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$moreforfilter = '';
|
|
|
|
|
|
|
|
} catch (Exception $e) {
|
|
|
|
|
|
|
|
print $e->getMessage();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
|
|
|
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
|
|
|
if ($optioncss != '') {
|
|
|
|
if ($optioncss != '') {
|
|
|
|
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
|
|
|
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
|
|
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
|
|
|
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
|
|
|
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
|
|
|
print '<input type="hidden" name="action" value="list">';
|
|
|
|
print '<input type="hidden" name="action" value="list">';
|
|
|
|
@@ -145,146 +125,168 @@ if (!$rowid) {
|
|
|
|
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", "", '', '', '', 'right ');
|
|
|
|
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", "", '', '', '', 'right ');
|
|
|
|
print "</tr>\n";
|
|
|
|
print "</tr>\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
if ($stripeacc) {
|
|
|
|
|
|
|
|
$list = \Stripe\Charge::all($option, array("stripe_account" => $stripeacc));
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$list = \Stripe\Charge::all($option);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$num = count($list->data);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
|
|
|
|
|
|
|
if ($limit > 0 && $limit != $conf->liste_limit) {
|
|
|
|
|
|
|
|
$param .= '&limit='.urlencode($limit);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$param .= '&starting_after_'.($page + 1).'='.$list->data[($limit - 1)]->id;
|
|
|
|
|
|
|
|
//$param.='&ending_before_'.($page+1).'='.$list->data[($limit-1)]->id;
|
|
|
|
|
|
|
|
} catch (Exception $e) {
|
|
|
|
|
|
|
|
print '<tr><td colspan="6">'.$e->getMessage().'</td></td>';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//print $list;
|
|
|
|
//print $list;
|
|
|
|
$i = 0;
|
|
|
|
$i = 0;
|
|
|
|
foreach ($list->data as $charge) {
|
|
|
|
if (!empty($list)) {
|
|
|
|
if ($i >= $limit) {
|
|
|
|
foreach ($list->data as $charge) {
|
|
|
|
break;
|
|
|
|
if ($i >= $limit) {
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ($charge->refunded == '1') {
|
|
|
|
if ($charge->refunded == '1') {
|
|
|
|
$status = img_picto($langs->trans("refunded"), 'statut6');
|
|
|
|
$status = img_picto($langs->trans("refunded"), 'statut6');
|
|
|
|
} elseif ($charge->paid == '1') {
|
|
|
|
} elseif ($charge->paid == '1') {
|
|
|
|
$status = img_picto($langs->trans((string) $charge->status), 'statut4');
|
|
|
|
$status = img_picto($langs->trans((string) $charge->status), 'statut4');
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$label = $langs->trans("Message").": ".$charge->failure_message."<br>";
|
|
|
|
$label = $langs->trans("Message").": ".$charge->failure_message."<br>";
|
|
|
|
$label .= $langs->trans("Network").": ".$charge->outcome->network_status."<br>";
|
|
|
|
$label .= $langs->trans("Network").": ".$charge->outcome->network_status."<br>";
|
|
|
|
$label .= $langs->trans("Status").": ".$langs->trans((string) $charge->outcome->seller_message);
|
|
|
|
$label .= $langs->trans("Status").": ".$langs->trans((string) $charge->outcome->seller_message);
|
|
|
|
$status = $form->textwithpicto(img_picto($langs->trans((string) $charge->status), 'statut8'), $label, -1);
|
|
|
|
$status = $form->textwithpicto(img_picto($langs->trans((string) $charge->status), 'statut8'), $label, -1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (isset($charge->payment_method_details->type) && $charge->payment_method_details->type == 'card') {
|
|
|
|
if (isset($charge->payment_method_details->type) && $charge->payment_method_details->type == 'card') {
|
|
|
|
$type = $langs->trans("card");
|
|
|
|
$type = $langs->trans("card");
|
|
|
|
} elseif (isset($charge->source->type) && $charge->source->type == 'card') {
|
|
|
|
} elseif (isset($charge->source->type) && $charge->source->type == 'card') {
|
|
|
|
$type = $langs->trans("card");
|
|
|
|
$type = $langs->trans("card");
|
|
|
|
} elseif (isset($charge->payment_method_details->type) && $charge->payment_method_details->type == 'three_d_secure') {
|
|
|
|
} elseif (isset($charge->payment_method_details->type) && $charge->payment_method_details->type == 'three_d_secure') {
|
|
|
|
$type = $langs->trans("card3DS");
|
|
|
|
$type = $langs->trans("card3DS");
|
|
|
|
} elseif (isset($charge->payment_method_details->type) && $charge->payment_method_details->type == 'sepa_debit') {
|
|
|
|
} elseif (isset($charge->payment_method_details->type) && $charge->payment_method_details->type == 'sepa_debit') {
|
|
|
|
$type = $langs->trans("sepadebit");
|
|
|
|
$type = $langs->trans("sepadebit");
|
|
|
|
} elseif (isset($charge->payment_method_details->type) && $charge->payment_method_details->type == 'ideal') {
|
|
|
|
} elseif (isset($charge->payment_method_details->type) && $charge->payment_method_details->type == 'ideal') {
|
|
|
|
$type = $langs->trans("iDEAL");
|
|
|
|
$type = $langs->trans("iDEAL");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Why this ?
|
|
|
|
// Why this ?
|
|
|
|
/*if (!empty($charge->payment_intent)) {
|
|
|
|
/*if (!empty($charge->payment_intent)) {
|
|
|
|
if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage
|
|
|
|
if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage
|
|
|
|
$charge = \Stripe\PaymentIntent::retrieve($charge->payment_intent);
|
|
|
|
$charge = \Stripe\PaymentIntent::retrieve($charge->payment_intent);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$charge = \Stripe\PaymentIntent::retrieve($charge->payment_intent, array("stripe_account" => $stripeacc));
|
|
|
|
$charge = \Stripe\PaymentIntent::retrieve($charge->payment_intent, array("stripe_account" => $stripeacc));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}*/
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
|
|
// The metadata FULLTAG is defined by the online payment page
|
|
|
|
// The metadata FULLTAG is defined by the online payment page
|
|
|
|
$FULLTAG = $charge->metadata->FULLTAG;
|
|
|
|
$FULLTAG = $charge->metadata->FULLTAG;
|
|
|
|
|
|
|
|
|
|
|
|
// Save into $tmparray all metadata
|
|
|
|
// Save into $tmparray all metadata
|
|
|
|
$tmparray = dolExplodeIntoArray($FULLTAG, '.', '=');
|
|
|
|
$tmparray = dolExplodeIntoArray($FULLTAG, '.', '=');
|
|
|
|
// Load origin object according to metadata
|
|
|
|
// Load origin object according to metadata
|
|
|
|
if (!empty($tmparray['CUS']) && $tmparray['CUS'] > 0) {
|
|
|
|
if (!empty($tmparray['CUS']) && $tmparray['CUS'] > 0) {
|
|
|
|
$societestatic->fetch($tmparray['CUS']);
|
|
|
|
$societestatic->fetch($tmparray['CUS']);
|
|
|
|
} elseif (!empty($charge->metadata->dol_thirdparty_id) && $charge->metadata->dol_thirdparty_id > 0) {
|
|
|
|
} elseif (!empty($charge->metadata->dol_thirdparty_id) && $charge->metadata->dol_thirdparty_id > 0) {
|
|
|
|
$societestatic->fetch($charge->metadata->dol_thirdparty_id);
|
|
|
|
$societestatic->fetch($charge->metadata->dol_thirdparty_id);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$societestatic->id = 0;
|
|
|
|
$societestatic->id = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!empty($tmparray['MEM']) && $tmparray['MEM'] > 0) {
|
|
|
|
if (!empty($tmparray['MEM']) && $tmparray['MEM'] > 0) {
|
|
|
|
$memberstatic->fetch($tmparray['MEM']);
|
|
|
|
$memberstatic->fetch($tmparray['MEM']);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$memberstatic->id = 0;
|
|
|
|
$memberstatic->id = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
print '<tr class="oddeven">';
|
|
|
|
print '<tr class="oddeven">';
|
|
|
|
|
|
|
|
|
|
|
|
if (!empty($stripeacc)) {
|
|
|
|
if (!empty($stripeacc)) {
|
|
|
|
$connect = $stripeacc.'/';
|
|
|
|
$connect = $stripeacc.'/';
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$connect = '';
|
|
|
|
$connect = '';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Ref
|
|
|
|
// Ref
|
|
|
|
$url = 'https://dashboard.stripe.com/'.$connect.'test/payments/'.$charge->id;
|
|
|
|
$url = 'https://dashboard.stripe.com/'.$connect.'test/payments/'.$charge->id;
|
|
|
|
if ($servicestatus) {
|
|
|
|
if ($servicestatus) {
|
|
|
|
$url = 'https://dashboard.stripe.com/'.$connect.'payments/'.$charge->id;
|
|
|
|
$url = 'https://dashboard.stripe.com/'.$connect.'payments/'.$charge->id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
print "<td>";
|
|
|
|
print "<td>";
|
|
|
|
print "<a href='".$url."' target='_stripe'>".img_picto($langs->trans('ShowInStripe'), 'globe')." ".$charge->id."</a>";
|
|
|
|
print "<a href='".$url."' target='_stripe'>".img_picto($langs->trans('ShowInStripe'), 'globe')." ".$charge->id."</a>";
|
|
|
|
if ($charge->payment_intent) {
|
|
|
|
if ($charge->payment_intent) {
|
|
|
|
print '<br><span class="opacitymedium">'.$charge->payment_intent.'</span>';
|
|
|
|
print '<br><span class="opacitymedium">'.$charge->payment_intent.'</span>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
print "</td>\n";
|
|
|
|
print "</td>\n";
|
|
|
|
|
|
|
|
|
|
|
|
// Stripe customer
|
|
|
|
// Stripe customer
|
|
|
|
print "<td>";
|
|
|
|
print "<td>";
|
|
|
|
if (isModEnabled('stripe') && !empty($stripeacc)) {
|
|
|
|
if (isModEnabled('stripe') && !empty($stripeacc)) {
|
|
|
|
$connect = $stripeacc.'/';
|
|
|
|
$connect = $stripeacc.'/';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$url = 'https://dashboard.stripe.com/'.$connect.'test/customers/'.$charge->customer;
|
|
|
|
$url = 'https://dashboard.stripe.com/'.$connect.'test/customers/'.$charge->customer;
|
|
|
|
if ($servicestatus) {
|
|
|
|
if ($servicestatus) {
|
|
|
|
$url = 'https://dashboard.stripe.com/'.$connect.'customers/'.$charge->customer;
|
|
|
|
$url = 'https://dashboard.stripe.com/'.$connect.'customers/'.$charge->customer;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!empty($charge->customer)) {
|
|
|
|
if (!empty($charge->customer)) {
|
|
|
|
print '<a href="'.$url.'" target="_stripe">'.img_picto($langs->trans('ShowInStripe'), 'globe').' '.$charge->customer.'</a>';
|
|
|
|
print '<a href="'.$url.'" target="_stripe">'.img_picto($langs->trans('ShowInStripe'), 'globe').' '.$charge->customer.'</a>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
print "</td>\n";
|
|
|
|
print "</td>\n";
|
|
|
|
|
|
|
|
|
|
|
|
// Link
|
|
|
|
// Link
|
|
|
|
print "<td>";
|
|
|
|
print "<td>";
|
|
|
|
if ($societestatic->id > 0) {
|
|
|
|
if ($societestatic->id > 0) {
|
|
|
|
print $societestatic->getNomUrl(1);
|
|
|
|
print $societestatic->getNomUrl(1);
|
|
|
|
} elseif ($memberstatic->id > 0) {
|
|
|
|
} elseif ($memberstatic->id > 0) {
|
|
|
|
print $memberstatic->getNomUrl(1);
|
|
|
|
print $memberstatic->getNomUrl(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
print "</td>\n";
|
|
|
|
print "</td>\n";
|
|
|
|
|
|
|
|
|
|
|
|
// Origin
|
|
|
|
// Origin
|
|
|
|
print "<td>";
|
|
|
|
print "<td>";
|
|
|
|
if ($charge->metadata->dol_type == "order" || $charge->metadata->dol_type == "commande") {
|
|
|
|
if ($charge->metadata->dol_type == "order" || $charge->metadata->dol_type == "commande") {
|
|
|
|
$object = new Commande($db);
|
|
|
|
$object = new Commande($db);
|
|
|
|
$object->fetch($charge->metadata->dol_id);
|
|
|
|
$object->fetch($charge->metadata->dol_id);
|
|
|
|
if ($object->id > 0) {
|
|
|
|
if ($object->id > 0) {
|
|
|
|
print "<a href='".DOL_URL_ROOT."/commande/card.php?id=".$object->id."'>".img_picto('', 'order')." ".$object->ref."</a>";
|
|
|
|
print "<a href='".DOL_URL_ROOT."/commande/card.php?id=".$object->id."'>".img_picto('', 'order')." ".$object->ref."</a>";
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
print $FULLTAG;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} elseif ($charge->metadata->dol_type == "invoice" || $charge->metadata->dol_type == "facture") {
|
|
|
|
|
|
|
|
$object = new Facture($db);
|
|
|
|
|
|
|
|
$object->fetch($charge->metadata->dol_id);
|
|
|
|
|
|
|
|
if ($object->id > 0) {
|
|
|
|
|
|
|
|
print "<a href='".DOL_URL_ROOT."/compta/facture/card.php?facid=".$charge->metadata->dol_id."'>".img_picto('', 'bill')." ".$object->ref."</a>";
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
print $FULLTAG;
|
|
|
|
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
print $FULLTAG;
|
|
|
|
print $FULLTAG;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} elseif ($charge->metadata->dol_type == "invoice" || $charge->metadata->dol_type == "facture") {
|
|
|
|
print "</td>\n";
|
|
|
|
$object = new Facture($db);
|
|
|
|
|
|
|
|
$object->fetch($charge->metadata->dol_id);
|
|
|
|
// Date payment
|
|
|
|
if ($object->id > 0) {
|
|
|
|
print '<td class="center">'.dol_print_date($charge->created, 'dayhour')."</td>\n";
|
|
|
|
print "<a href='".DOL_URL_ROOT."/compta/facture/card.php?facid=".$charge->metadata->dol_id."'>".img_picto('', 'bill')." ".$object->ref."</a>";
|
|
|
|
// Type
|
|
|
|
} else {
|
|
|
|
print '<td>';
|
|
|
|
print $FULLTAG;
|
|
|
|
print $type;
|
|
|
|
}
|
|
|
|
print '</td>';
|
|
|
|
} else {
|
|
|
|
// Amount
|
|
|
|
print $FULLTAG;
|
|
|
|
print '<td class="right"><span class="amount">'.price(($charge->amount - $charge->amount_refunded) / 100, 0, '', 1, - 1, - 1, strtoupper($charge->currency))."</span></td>";
|
|
|
|
|
|
|
|
// Status
|
|
|
|
|
|
|
|
print '<td class="right">';
|
|
|
|
|
|
|
|
print $status;
|
|
|
|
|
|
|
|
print "</td>\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print "</tr>\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
print "</td>\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Date payment
|
|
|
|
|
|
|
|
print '<td class="center">'.dol_print_date($charge->created, 'dayhour')."</td>\n";
|
|
|
|
|
|
|
|
// Type
|
|
|
|
|
|
|
|
print '<td>';
|
|
|
|
|
|
|
|
print $type;
|
|
|
|
|
|
|
|
print '</td>';
|
|
|
|
|
|
|
|
// Amount
|
|
|
|
|
|
|
|
print '<td class="right"><span class="amount">'.price(($charge->amount - $charge->amount_refunded) / 100, 0, '', 1, - 1, - 1, strtoupper($charge->currency))."</span></td>";
|
|
|
|
|
|
|
|
// Status
|
|
|
|
|
|
|
|
print '<td class="right">';
|
|
|
|
|
|
|
|
print $status;
|
|
|
|
|
|
|
|
print "</td>\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print "</tr>\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$i++;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
print '</table>';
|
|
|
|
print '</table>';
|
|
|
|
|