diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php
index fdd4f54b6c8..4a34a2b360f 100644
--- a/htdocs/societe/paymentmodes.php
+++ b/htdocs/societe/paymentmodes.php
@@ -822,7 +822,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
print '
';
// List of Stripe payment modes
- if (! (empty($conf->stripe->enabled)))
+ if (! (empty($conf->stripe->enabled)) && $object->client)
{
$morehtmlright='';
if (! empty($conf->global->STRIPE_ALLOW_LOCAL_CARD))
@@ -1184,11 +1184,10 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
}
print "";
print "";
+ print '
';
}
-
// List of bank accounts
- print '
';
$morehtmlright= dolGetButtonTitle($langs->trans('Add'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=create');
diff --git a/htdocs/stripe/charge.php b/htdocs/stripe/charge.php
index e8823119e30..9d4bf71c040 100644
--- a/htdocs/stripe/charge.php
+++ b/htdocs/stripe/charge.php
@@ -121,6 +121,30 @@ if (!$rowid)
//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."
";
+ $label.="Réseau: ".$charge->outcome->network_status."
";
+ $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;
@@ -205,31 +229,13 @@ if (!$rowid)
print '
'.dol_print_date($charge->created, '%d/%m/%Y %H:%M')." | \n";
// Type
print '';
- 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 ' | ';
// Amount
print ''.price(($charge->amount-$charge->amount_refunded)/100, 0, '', 1, - 1, - 1, strtoupper($charge->currency))." | ";
// Status
print '';
- 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." ";
- $label.="Réseau: ".$charge->outcome->network_status." ";
- $label.="Statut: ".$langs->trans("".$charge->outcome->seller_message."");
- print $form->textwithpicto(img_picto($langs->trans("".$charge->status.""), 'statut8'), $label, 1);
- }
+ print $status;
print " | \n";
print "\n";
diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php
index c731637fce6..28ba74fa91b 100644
--- a/htdocs/stripe/class/stripe.class.php
+++ b/htdocs/stripe/class/stripe.class.php
@@ -319,14 +319,14 @@ class Stripe extends CommonObject
if (! in_array($currency_code, $arrayzerounitcurrency)) $stripeamount = $amount * 100;
else $stripeamount = $amount;
- $fee = round($amount * ($conf->global->STRIPE_APPLICATION_FEE_PERCENT / 100) + $conf->global->STRIPE_APPLICATION_FEE);
+ $fee = $amount * ($conf->global->STRIPE_APPLICATION_FEE_PERCENT / 100) + $conf->global->STRIPE_APPLICATION_FEE;
if ($fee >= $conf->global->STRIPE_APPLICATION_FEE_MAXIMAL && $conf->global->STRIPE_APPLICATION_FEE_MAXIMAL > $conf->global->STRIPE_APPLICATION_FEE_MINIMAL) {
- $fee = round($conf->global->STRIPE_APPLICATION_FEE_MAXIMAL);
+ $fee = $conf->global->STRIPE_APPLICATION_FEE_MAXIMAL;
} elseif ($fee < $conf->global->STRIPE_APPLICATION_FEE_MINIMAL) {
- $fee = round($conf->global->STRIPE_APPLICATION_FEE_MINIMAL);
+ $fee = $conf->global->STRIPE_APPLICATION_FEE_MINIMAL;
}
- if (! in_array($currency_code, $arrayzerounitcurrency)) $stripefee = $fee * 100;
- else $stripefee = $fee;
+ if (! in_array($currency, $arrayzerounitcurrency)) $stripefee = round($fee * 100);
+ else $stripefee = round($fee);
$paymentintent = null;
@@ -708,15 +708,14 @@ class Stripe extends CommonObject
$charge = \Stripe\Charge::create($paymentarray, array("idempotency_key" => "$description"));
}
} else {
- $fee = round($amount * ($conf->global->STRIPE_APPLICATION_FEE_PERCENT / 100) + $conf->global->STRIPE_APPLICATION_FEE);
- if ($fee >= $conf->global->STRIPE_APPLICATION_FEE_MAXIMAL && $conf->global->STRIPE_APPLICATION_FEE_MAXIMAL > $conf->global->STRIPE_APPLICATION_FEE_MINIMAL) {
- $fee = round($conf->global->STRIPE_APPLICATION_FEE_MAXIMAL);
- }
- elseif ($fee < $conf->global->STRIPE_APPLICATION_FEE_MINIMAL) {
- $fee = round($conf->global->STRIPE_APPLICATION_FEE_MINIMAL);
- }
- if (! in_array($currency, $arrayzerounitcurrency)) $stripefee = $fee * 100;
- else $stripefee = $fee;
+ $fee = $amount * ($conf->global->STRIPE_APPLICATION_FEE_PERCENT / 100) + $conf->global->STRIPE_APPLICATION_FEE;
+ if ($fee >= $conf->global->STRIPE_APPLICATION_FEE_MAXIMAL && $conf->global->STRIPE_APPLICATION_FEE_MAXIMAL > $conf->global->STRIPE_APPLICATION_FEE_MINIMAL) {
+ $fee = $conf->global->STRIPE_APPLICATION_FEE_MAXIMAL;
+ } elseif ($fee < $conf->global->STRIPE_APPLICATION_FEE_MINIMAL) {
+ $fee = $conf->global->STRIPE_APPLICATION_FEE_MINIMAL;
+ }
+ if (! in_array($currency, $arrayzerounitcurrency)) $stripefee = round($fee * 100);
+ else $stripefee = round($fee);
$paymentarray = array(
"amount" => "$stripeamount",