Code comment

This commit is contained in:
Laurent Destailleur 2018-06-15 15:29:19 +02:00
parent df28be443b
commit 79cbdf7fd1
2 changed files with 5 additions and 3 deletions

View File

@ -444,10 +444,12 @@ if ($action == 'charge' && ! empty($conf->stripe->enabled))
$thirdparty = new Societe($db); $thirdparty = new Societe($db);
$thirdparty->fetch($thirdparty_id); $thirdparty->fetch($thirdparty_id);
// Create Stripe customer
include_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; include_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php';
$stripe = new Stripe($db); $stripe = new Stripe($db);
$customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 1); $customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 1);
// Create Stripe card from Token
$card = $customer->sources->create(array("source" => $stripeToken, "metadata" => $metadata)); $card = $customer->sources->create(array("source" => $stripeToken, "metadata" => $metadata));
if (empty($card)) if (empty($card))
@ -1559,7 +1561,7 @@ if (preg_match('/^dopayment/',$action))
?> ?>
// Create a Stripe client // Create a Stripe client.
var stripe = Stripe('<?php echo $stripearrayofkeys['publishable_key']; // Defined into config.php ?>'); var stripe = Stripe('<?php echo $stripearrayofkeys['publishable_key']; // Defined into config.php ?>');
// Create an instance of Elements // Create an instance of Elements

View File

@ -46,11 +46,11 @@ $stripearrayofkeysbyenv = array(
$stripearrayofkeys = array(); $stripearrayofkeys = array();
if (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox','alpha')) if (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox','alpha'))
{ {
$stripearrayofkeys = $stripearrayofkeysbyenv[0]; $stripearrayofkeys = $stripearrayofkeysbyenv[0]; // Test
} }
else else
{ {
$stripearrayofkeys = $stripearrayofkeysbyenv[1]; $stripearrayofkeys = $stripearrayofkeysbyenv[1]; // Live
} }
\Stripe\Stripe::setApiKey($stripearrayofkeys['secret_key']); \Stripe\Stripe::setApiKey($stripearrayofkeys['secret_key']);