From 39749a0a2ce890022277b725b46b2fa9eba9e3af Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 7 Mar 2018 16:13:49 +0100 Subject: [PATCH] NEW function and update comment --- htdocs/stripe/admin/stripe.php | 61 +++++++++++++++++----------------- 1 file changed, 30 insertions(+), 31 deletions(-) diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index 544764b4c11..7a418a695dc 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -49,26 +49,26 @@ if ($action == 'setvalue' && $user->admin) $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); @@ -114,7 +114,7 @@ if ($action=="setlive") setEventMessages($langs->trans("Error"), null, 'errors'); } } - +//TODO: import script for stripe account saving in alone or connect mode for stripe.class.php /* * View @@ -180,10 +180,10 @@ print ''; print ''.$langs->trans("STRIPE_TEST_SECRET_KEY").''; print ''; print '   '.$langs->trans("Example").': sk_test_xxxxxxxxxxxxxxxxxxxxxxxx'; -print ''; +print ''; print ''; -print ''.$langs->trans("STRIPE_TEST_WEBHOOK_KEY").''; +print ''.$langs->trans("STRIPE_TEST_WEBHOOK_KEY").''; print ''; print '   '.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx'; print ''; @@ -201,32 +201,36 @@ print '   '.$langs->trans("Example").': sk_live_xxxxxxxxxxxxxxxxxxxxxxxx'; print ''; print ''; -print ''.$langs->trans("STRIPE_LIVE_WEBHOOK_KEY").''; +print ''.$langs->trans("STRIPE_LIVE_WEBHOOK_KEY").''; print ''; print '   '.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx'; print ''; } else { -print ''.$langs->trans("STRIPECONNECT").''; -print 'Ce module est configuré en mode marketplace'; +print ''.$langs->trans("StripeConnect").''; +print ''.$langs->trans("StripeConnect_Mode").''; } -if (! empty($conf->banque->enabled)) +if (! empty($conf->banque->enabled)) //deplace here for separate stripe setting of general and common online payment settings { -print ''; -print $langs->trans("BankAccount").''; -print $form->select_comptes($conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS, 'STRIPE_BANK_ACCOUNT_FOR_PAYMENTS', 0, '', 1); -print ''; - -print ''; -print $langs->trans("BankAccount").''; -print $form->select_comptes($conf->global->STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS, 'STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS', 0, '', 1); -print ''; + print ''; + print $langs->trans("BankAccount").''; + print $form->select_comptes($conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS, 'STRIPE_BANK_ACCOUNT_FOR_PAYMENTS', 0, '', 1); + print ''; + + if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // real bank account : automatic banktransfert with stripe webhook from stripe account (receiving funds, payment, debit fee/application fee, payment dispute) to real bank account + { + print ''; + print $langs->trans("BankAccountForBankTransfer").''; + print $form->select_comptes($conf->global->STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS, 'STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS', 0, '', 1); + print ''; + } } print ''; print '
'; + print ''; print ''; print ''; @@ -239,11 +243,12 @@ print 'name; print ''; -if (! empty($conf->banque->enabled)) +if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // autodecrement selected web stock when generate invoice or paid an order->generate linked invoice as in a POS module for a full automatic functionality (useful when there is a lot of payment) { + // Stock for automatic decrement print ''; } @@ -275,13 +280,7 @@ print ''; - -// stock for automatic decrement -print ''; +print ''; // Payment token for URL print '
'.$langs->trans("UsageParameter").'
'; - print $langs->trans("BankAccount").''; - print $form->select_comptes($conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS, 'STRIPE_BANK_ACCOUNT_FOR_PAYMENTS', 0, '', 1); + print $langs->trans("ONLINE_PAYMENT_WAREHOUSE").''; + print $formproduct->selectWarehouses($conf->global->ONLINE_PAYMENT_WAREHOUSE,'ONLINE_PAYMENT_WAREHOUSE','',1,$disabled); print '
'; print $langs->trans("ONLINE_PAYMENT_SENDEMAIL").''; print ''; print '   '.$langs->trans("Example").': myemail@myserver.com'; -print '
'; -print $langs->trans("ONLINE_PAYMENT_WAREHOUSE").''; -print $formproduct->selectWarehouses($conf->global->ONLINE_PAYMENT_WAREHOUSE,'ONLINE_PAYMENT_WAREHOUSE','',1,$disabled); -print '
';