Skip to content

Commit

Permalink
Fix display payment intent in stripe's charge list
Browse files Browse the repository at this point in the history
  • Loading branch information
ptibogxiv committed Aug 3, 2019
1 parent b40f2cb commit 07cc21a
Showing 1 changed file with 27 additions and 20 deletions.
47 changes: 27 additions & 20 deletions htdocs/stripe/charge.php
Expand Up @@ -121,6 +121,31 @@
//print $list;
foreach ($list->data as $charge)
{
if ($charge->refunded=='1'){
$status = img_picto($langs->trans("refunded"), 'statut6');
} elseif ($charge->paid=='1'){
$status = img_picto($langs->trans("".$charge->status.""), 'statut4');
} else {
$label="Message: ".$charge->failure_message."<br>";
$label.="Réseau: ".$charge->outcome->network_status."<br>";
$label.="Statut: ".$langs->trans("".$charge->outcome->seller_message."");
$status = $form->textwithpicto(img_picto($langs->trans("".$charge->status.""), 'statut8'), $label, 1);
}

if ($charge->payment_method_details->type=='card')
{
$type = $langs->trans("card");
}
elseif ($charge->source->type=='card'){
$type = $langs->trans("card");
} elseif ($charge->payment_method_details->type=='three_d_secure'){
$type = $langs->trans("card3DS");
}

if (! empty($charge->payment_intent)) {
$charge = \Stripe\PaymentIntent::retrieve($charge->payment_intent);
}

// The metadata FULLTAG is defined by the online payment page
$FULLTAG=$charge->metadata->FULLTAG;

Expand Down Expand Up @@ -205,31 +230,13 @@
print '<td class="center">'.dol_print_date($charge->created, '%d/%m/%Y %H:%M')."</td>\n";
// Type
print '<td>';
if ($charge->source->object=='card')
{
print $langs->trans("card");
}
elseif ($charge->source->type=='card'){
print $langs->trans("card");
} elseif ($charge->source->type=='three_d_secure'){
print $langs->trans("card3DS");
}
print $type;
print '</td>';
// Amount
print '<td class="right">'.price(($charge->amount-$charge->amount_refunded)/100, 0, '', 1, - 1, - 1, strtoupper($charge->currency))."</td>";
// Status
print '<td class="right">';
if ($charge->refunded=='1'){
print img_picto($langs->trans("refunded"), 'statut6');
} elseif ($charge->paid=='1'){

print img_picto($langs->trans("".$charge->status.""), 'statut4');
} else {
$label="Message: ".$charge->failure_message."<br>";
$label.="Réseau: ".$charge->outcome->network_status."<br>";
$label.="Statut: ".$langs->trans("".$charge->outcome->seller_message."");
print $form->textwithpicto(img_picto($langs->trans("".$charge->status.""), 'statut8'), $label, 1);
}
print $status;
print "</td>\n";

print "</tr>\n";
Expand Down

0 comments on commit 07cc21a

Please sign in to comment.