Merge branch '10.0' of git@github.com:Dolibarr/dolibarr.git into 10.0

This commit is contained in:
Laurent Destailleur 2019-08-10 01:26:18 +02:00
commit 6089547e0e
3 changed files with 41 additions and 37 deletions

View File

@ -822,7 +822,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
print '<br>';
// 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 "</table>";
print "</div>";
print '<br>';
}
// List of bank accounts
print '<br>';
$morehtmlright= dolGetButtonTitle($langs->trans('Add'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&amp;action=create');

View File

@ -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."<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;
@ -205,31 +229,13 @@ if (!$rowid)
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";

View File

@ -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",