Skip to content
Snippets Groups Projects
Commit d0f01085 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Add more information on stripe payment

parent e5fe629a
Branches
Tags
No related merge requests found
...@@ -181,6 +181,13 @@ if (! empty($conf->global->STRIPE_SECURITY_TOKEN)) ...@@ -181,6 +181,13 @@ if (! empty($conf->global->STRIPE_SECURITY_TOKEN))
} }
} }
// Common variables
$creditor=$mysoc->name;
$paramcreditor='STRIPE_CREDITOR_'.$suffix;
if (! empty($conf->global->$paramcreditor)) $creditor=$conf->global->$paramcreditor;
else if (! empty($conf->global->STRIPE_CREDITOR)) $creditor=$conf->global->STRIPE_CREDITOR;
/* /*
* Actions * Actions
...@@ -218,9 +225,11 @@ if ($action == 'charge') ...@@ -218,9 +225,11 @@ if ($action == 'charge')
dol_syslog("Create customer", LOG_DEBUG, 0, '_stripe'); dol_syslog("Create customer", LOG_DEBUG, 0, '_stripe');
$customer = \Stripe\Customer::create(array( $customer = \Stripe\Customer::create(array(
'email' => $email, 'email' => $email,
'card' => $stripeToken 'description' => ($email?'Customer for '.$email:null),
// TODO 'metadata' => array('ipaddress'=>$_SERVER['REMOTE_ADDR']),
'source' => $stripeToken // source can be a token OR array('object'=>'card', 'exp_month'=>xx, 'exp_year'=>xxxx, 'number'=>xxxxxxx, 'cvc'=>xxx, 'name'=>'Cardholder's full name', zip ?)
)); ));
// TODO Add 'business_vat_id' ?
dol_syslog("Create charge", LOG_DEBUG, 0, '_stripe'); dol_syslog("Create charge", LOG_DEBUG, 0, '_stripe');
$charge = \Stripe\Charge::create(array( $charge = \Stripe\Charge::create(array(
...@@ -228,7 +237,8 @@ if ($action == 'charge') ...@@ -228,7 +237,8 @@ if ($action == 'charge')
'amount' => price2num($amount, 'MU'), 'amount' => price2num($amount, 'MU'),
'currency' => $currency, 'currency' => $currency,
'description' => 'Stripe payment: '.$FULLTAG, 'description' => 'Stripe payment: '.$FULLTAG,
'statement_descriptor' => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 6, 'right', 'UTF-8', 1).' '.$FULLTAG, 22, 'right', 'UTF-8', 1) // 22 chars 'metadata' => array("FULLTAG" => $FULLTAG, 'Recipient' => $mysoc->name),
'statement_descriptor' => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 6, 'right', 'UTF-8', 1).' '.$FULLTAG, 22, 'right', 'UTF-8', 1) // 22 chars that appears on bank receipt
)); ));
} catch(\Stripe\Error\Card $e) { } catch(\Stripe\Error\Card $e) {
// Since it's a decline, \Stripe\Error\Card will be caught // Since it's a decline, \Stripe\Error\Card will be caught
...@@ -330,12 +340,6 @@ if (empty($conf->global->STRIPE_LIVE)) ...@@ -330,12 +340,6 @@ if (empty($conf->global->STRIPE_LIVE))
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode'),'','warning'); dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode'),'','warning');
} }
// Common variables
$creditor=$mysoc->name;
$paramcreditor='STRIPE_CREDITOR_'.$suffix;
if (! empty($conf->global->$paramcreditor)) $creditor=$conf->global->$paramcreditor;
else if (! empty($conf->global->STRIPE_CREDITOR)) $creditor=$conf->global->STRIPE_CREDITOR;
print '<span id="dolpaymentspan"></span>'."\n"; print '<span id="dolpaymentspan"></span>'."\n";
print '<div class="center">'."\n"; print '<div class="center">'."\n";
print '<form id="dolpaymentform" class="center" name="paymentform" action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n"; print '<form id="dolpaymentform" class="center" name="paymentform" action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment