From 9314bb4667f3d198257ecb974e29c1d6a5bfda20 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 7 Jun 2019 13:07:19 +0200 Subject: [PATCH] Fix missing statement descriptor --- htdocs/public/payment/newpayment.php | 15 +++++++++++++++ htdocs/public/stripe/ipn.php | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 93620e70c0e..32db0d99a08 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1872,7 +1872,21 @@ if (preg_match('/^dopayment/', $action)) // If we choosed/click on the payment $arrayzerounitcurrency=array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF'); if (! in_array($currency, $arrayzerounitcurrency)) $amountstripe=$amountstripe * 100; + $ipaddress=getUserRemoteIP(); + $metadata = array('dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>$ipaddress); + if (is_object($object)) + { + $metadata['dol_type'] = $object->element; + $metadata['dol_id'] = $object->id; + } + try { + $arrayforpaymentintent = array( + 'description'=>'Stripe payment: '.$FULLTAG.(is_object($object)?' ref='.$object->ref:''), + "metadata" => $metadata + ); + if ($TAG) $arrayforpaymentintent["statement_descriptor"] = dol_trunc($TAG, 10, 'right', 'UTF-8', 1); // 22 chars that appears on bank receipt (company + description) + $arrayforcheckout = array( 'payment_method_types' => array('card'), 'line_items' => array(array( @@ -1886,6 +1900,7 @@ if (preg_match('/^dopayment/', $action)) // If we choosed/click on the payment 'client_reference_id' => $FULLTAG, 'success_url' => $urlok, 'cancel_url' => $urlko, + 'payment_intent_data' => $arrayforpaymentintent ); if ($stripecu) $arrayforcheckout['customer'] = $stripecu; elseif (GETPOST('email', 'alpha') && isValidEmail(GETPOST('email', 'alpha'))) $arrayforcheckout['customer_email'] = GETPOST('email', 'alpha'); diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index 201d434e758..8795031592a 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -106,7 +106,7 @@ catch(\UnexpectedValueException $e) { $langs->load("main"); -// TODO Do we really need a user in setup just to have an name to fill an email topic when it is a technical system notification email +// TODO Do we really need a user in setup just to have a name to fill an email topic when it is a technical system notification email $user = new User($db); $user->fetch($conf->global->STRIPE_USER_ACCOUNT_FOR_ACTIONS); $user->getrights();