Skip to content

Commit

Permalink
Fix missing statement descriptor
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Jun 7, 2019
1 parent 9511a66 commit 9314bb4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions htdocs/public/payment/newpayment.php
Expand Up @@ -1872,7 +1872,21 @@
$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(
Expand All @@ -1886,6 +1900,7 @@
'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');
Expand Down
2 changes: 1 addition & 1 deletion htdocs/public/stripe/ipn.php
Expand Up @@ -106,7 +106,7 @@

$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();
Expand Down

0 comments on commit 9314bb4

Please sign in to comment.