Skip to content

Commit

Permalink
Debug stripe
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Mar 7, 2018
1 parent 64b0d1d commit e242dba
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 27 deletions.
3 changes: 3 additions & 0 deletions htdocs/langs/en_US/stripe.lang
Expand Up @@ -35,8 +35,11 @@ NewStripePaymentReceived=New Stripe payment received
NewStripePaymentFailed=New Stripe payment tried but failed
STRIPE_TEST_SECRET_KEY=Secret test key
STRIPE_TEST_PUBLISHABLE_KEY=Publishable test key
STRIPE_TEST_WEBHOOK_KEY=Webhook test key
STRIPE_LIVE_SECRET_KEY=Secret live key
STRIPE_LIVE_PUBLISHABLE_KEY=Publishable live key
STRIPE_LIVE_WEBHOOK_KEY=Webhook live key
ONLINE_PAYMENT_WAREHOUSE=Stock to use for stock decrease when payment online payment is done (TODO When option to decrease stock is done on an action on invoice and the online payment generate itself the invoice ?)
StripeLiveEnabled=Stripe live enabled (otherwise test/sandbox mode)
StripeImportPayment=Import Stripe payments
ExampleOfTestCreditCard=Example of credit card for test: %s (valid), %s (error CVC), %s (expired), %s (charge fails)
52 changes: 25 additions & 27 deletions htdocs/stripe/admin/stripe.php
Expand Up @@ -49,26 +49,26 @@

$result=dolibarr_set_const($db, "STRIPE_LIVE",GETPOST('STRIPE_LIVE','alpha'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
if (empty($conf->stripeconnect->enabled)) {
if (empty($conf->stripeconnect->enabled)) {
$result=dolibarr_set_const($db, "STRIPE_TEST_PUBLISHABLE_KEY",GETPOST('STRIPE_TEST_PUBLISHABLE_KEY','alpha'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "STRIPE_TEST_SECRET_KEY",GETPOST('STRIPE_TEST_SECRET_KEY','alpha'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "STRIPE_TEST_WEBHOOK_KEY",GETPOST('STRIPE_TEST_WEBHOOK_KEY','alpha'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "STRIPE_LIVE_PUBLISHABLE_KEY",GETPOST('STRIPE_LIVE_PUBLISHABLE_KEY','alpha'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "STRIPE_LIVE_SECRET_KEY",GETPOST('STRIPE_LIVE_SECRET_KEY','alpha'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "STRIPE_LIVE_WEBHOOK_KEY",GETPOST('STRIPE_LIVE_WEBHOOK_KEY','alpha'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
}
if (! $result > 0) $error++;
}
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_CREDITOR",GETPOST('ONLINE_PAYMENT_CREDITOR','alpha'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "STRIPE_BANK_ACCOUNT_FOR_PAYMENTS",GETPOST('STRIPE_BANK_ACCOUNT_FOR_PAYMENTS','int'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS",GETPOST('STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS','int'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_CSS_URL",GETPOST('ONLINE_PAYMENT_CSS_URL','alpha'),'chaine',0,'',$conf->entity);
if (! $result > 0) $error++;
$result=dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_FORM",GETPOST('ONLINE_PAYMENT_MESSAGE_FORM','alpha'),'chaine',0,'',$conf->entity);
Expand Down Expand Up @@ -180,10 +180,10 @@
print '<span class="titlefield fieldrequired">'.$langs->trans("STRIPE_TEST_SECRET_KEY").'</span></td><td>';
print '<input class="minwidth300" type="text" name="STRIPE_TEST_SECRET_KEY" value="'.$conf->global->STRIPE_TEST_SECRET_KEY.'">';
print ' &nbsp; '.$langs->trans("Example").': sk_test_xxxxxxxxxxxxxxxxxxxxxxxx';
print '</td></tr>';
print '</td></tr>';

print '<tr class="oddeven"><td>';
print '<span class="fieldrequired">'.$langs->trans("STRIPE_TEST_WEBHOOK_KEY").'</span></td><td>';
print '<span>'.$langs->trans("STRIPE_TEST_WEBHOOK_KEY").'</span></td><td>';
print '<input class="minwidth300" type="text" name="STRIPE_TEST_WEBHOOK_KEY" value="'.$conf->global->STRIPE_TEST_WEBHOOK_KEY.'">';
print ' &nbsp; '.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx';
print '</td></tr>';
Expand All @@ -201,7 +201,7 @@
print '</td></tr>';

print '<tr class="oddeven"><td>';
print '<span class="fieldrequired">'.$langs->trans("STRIPE_LIVE_WEBHOOK_KEY").'</span></td><td>';
print '<span>'.$langs->trans("STRIPE_LIVE_WEBHOOK_KEY").'</span></td><td>';
print '<input class="minwidth300" type="text" name="STRIPE_LIVE_WEBHOOK_KEY" value="'.$conf->global->STRIPE_LIVE_WEBHOOK_KEY.'">';
print ' &nbsp; '.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx';
print '</td></tr>';
Expand All @@ -210,19 +210,6 @@
print '<td>Ce module est configuré en mode marketplace</td></tr>';
}

if (! empty($conf->banque->enabled))
{
print '<tr class="oddeven"><td>';
print $langs->trans("BankAccount").'</td><td>';
print $form->select_comptes($conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS, 'STRIPE_BANK_ACCOUNT_FOR_PAYMENTS', 0, '', 1);
print '</td></tr>';

print '<tr class="oddeven"><td>';
print $langs->trans("BankAccount").'</td><td>';
print $form->select_comptes($conf->global->STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS, 'STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS', 0, '', 1);
print '</td></tr>';
}

print '</table>';

print '<br>';
Expand All @@ -245,6 +232,23 @@
print $langs->trans("BankAccount").'</td><td>';
print $form->select_comptes($conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS, 'STRIPE_BANK_ACCOUNT_FOR_PAYMENTS', 0, '', 1);
print '</td></tr>';

if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // What is this for ?
{
print '<tr class="oddeven"><td>';
print $langs->trans("BankAccountForBankTransfer").'</td><td>';
print $form->select_comptes($conf->global->STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS, 'STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS', 0, '', 1);
print '</td></tr>';
}
}

if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // What is this for ?
{
// Stock for automatic decrement
print '<tr class="oddeven"><td>';
print $langs->trans("ONLINE_PAYMENT_WAREHOUSE").'</td><td>';
print $formproduct->selectWarehouses($conf->global->ONLINE_PAYMENT_WAREHOUSE,'ONLINE_PAYMENT_WAREHOUSE','',1,$disabled);
print '</td></tr>';
}

print '<tr class="oddeven"><td>';
Expand Down Expand Up @@ -277,12 +281,6 @@
print ' &nbsp; '.$langs->trans("Example").': myemail@myserver.com';
print '</td></tr>';

// stock for automatic decrement
print '<tr class="oddeven"><td>';
print $langs->trans("ONLINE_PAYMENT_WAREHOUSE").'</td><td>';
print $formproduct->selectWarehouses($conf->global->ONLINE_PAYMENT_WAREHOUSE,'ONLINE_PAYMENT_WAREHOUSE','',1,$disabled);
print '</td></tr>';

// Payment token for URL
print '<tr class="oddeven"><td>';
print $langs->trans("SecurityToken").'</td><td>';
Expand Down

0 comments on commit e242dba

Please sign in to comment.