Add more information on stripe payment
This commit is contained in:
parent
e5fe629a0e
commit
d0f01085d8
@ -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,17 +225,20 @@ 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(
|
||||||
'customer' => $customer->id,
|
'customer' => $customer->id,
|
||||||
'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))
|
|||||||
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";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user