diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index e6008e01a92..c7621ab75c4 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1490,6 +1490,7 @@ class Facture extends CommonInvoice $this->pos_source = $object->pos_source; $this->origin = $object->element; + $this->origin_type = $object->element; $this->origin_id = $object->id; $this->fk_user_author = $user->id; diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 306e7b5bf72..a0d2fe0b05e 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1010,6 +1010,7 @@ if (isModEnabled('paybox')) { } if (isModEnabled('stripe')) { print ''."\n"; + print ''."\n"; } print ''."\n"; print ''."\n"; @@ -2368,7 +2369,7 @@ if (preg_match('/^dopayment/', $action)) { // If we chose/clicked on the payme print ''."\n"; print ''."\n"; print ''."\n"; - print ''; + print ''."\n"; print ''."\n"; print ''."\n"; print ''; @@ -2376,7 +2377,28 @@ if (preg_match('/^dopayment/', $action)) { // If we chose/clicked on the payme print ''; print ''; - if (getDolGlobalString('STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION') || getDolGlobalString('STRIPE_USE_NEW_CHECKOUT')) { // Use a SCA ready method + // Make some check on amount: We accept an amount that is different to allow to pay an existing invoice partially or + // to allow to pay a membership with open amount, but for a payment of an order, we have no reason to accept partial payment. + $checkamount = 1; + $tmptag = dolExplodeIntoArray($fulltag, '.', '='); + if (array_key_exists('ORD', $tmptag) && (int) $tmptag['ORD'] > 0) { + include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; + $object = new Commande($db); + $result = $object->fetch((int) $tmptag['ORD']); + if ($result > 0) { + if ($object->total_ttc != $amount) { + $checkamount = 0; + } + } else { + $checkamount = 0; + } + } + if (!$checkamount) { + dol_syslog("Hack attempt detected", LOG_WARNING); + setEventMessages('Bad value for amount. Reported as a hack attempt.', null, 'errors'); + } + + if ($checkamount && (getDolGlobalString('STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION') || getDolGlobalString('STRIPE_USE_NEW_CHECKOUT'))) { // Use a SCA ready method require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; $service = 'StripeLive'; @@ -2449,7 +2471,7 @@ if (preg_match('/^dopayment/', $action)) { // If we chose/clicked on the payme if (getDolGlobalString('STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION')) { if (empty($paymentintent)) { - print '