diff --git a/htdocs/paypal/admin/paypal.php b/htdocs/paypal/admin/paypal.php index 6d52fea8d9980..36c8df9d0d678 100644 --- a/htdocs/paypal/admin/paypal.php +++ b/htdocs/paypal/admin/paypal.php @@ -43,6 +43,7 @@ if ($action == 'setvalue' && $user->admin) { $db->begin(); + $result=dolibarr_set_const($db, "PAYPAL_API_SANDBOX",GETPOST('PAYPAL_API_SANDBOX','alpha'),'chaine',0,'',$conf->entity); if (! $result > 0) $error++; $result=dolibarr_set_const($db, "PAYPAL_API_USER",GETPOST('PAYPAL_API_USER','alpha'),'chaine',0,'',$conf->entity); diff --git a/htdocs/public/paybox/paymentko.php b/htdocs/public/paybox/paymentko.php index e417aad12c74a..be5b388f6edcc 100644 --- a/htdocs/public/paybox/paymentko.php +++ b/htdocs/public/paybox/paymentko.php @@ -86,8 +86,21 @@ $sendto=$conf->global->PAYBOX_PAYONLINE_SENDEMAIL; $from=$conf->global->MAILING_EMAIL_FROM; + // Define link to login card + $appli=constant('DOL_APPLICATION_TITLE'); + if (! empty($conf->global->MAIN_APPLICATION_TITLE)) + { + $appli=$conf->global->MAIN_APPLICATION_TITLE; + if (preg_match('/\d\.\d/', $appli)) + { + if (! preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli.=" (".DOL_VERSION.")"; // If new title contains a version that is different than core + } + else $appli.=" ".DOL_VERSION; + } + else $appli.=" ".DOL_VERSION; + $urlback=$_SERVER["REQUEST_URI"]; - $topic='['.$conf->global->MAIN_APPLICATION_TITLE.'] '.$langs->transnoentitiesnoconv("NewPayboxPaymentFailed"); + $topic='['.$appli.'] '.$langs->transnoentitiesnoconv("NewPayboxPaymentFailed"); $content=$langs->transnoentitiesnoconv("NewPayboxPaymentFailed")."\n".$fulltag; require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; $mailfile = new CMailFile($topic, $sendto, $from, $content); diff --git a/htdocs/public/paybox/paymentok.php b/htdocs/public/paybox/paymentok.php index 5b88dcb65d725..0e91189e242a9 100644 --- a/htdocs/public/paybox/paymentok.php +++ b/htdocs/public/paybox/paymentok.php @@ -135,8 +135,21 @@ $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current + // Define link to login card + $appli=constant('DOL_APPLICATION_TITLE'); + if (! empty($conf->global->MAIN_APPLICATION_TITLE)) + { + $appli=$conf->global->MAIN_APPLICATION_TITLE; + if (preg_match('/\d\.\d/', $appli)) + { + if (! preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli.=" (".DOL_VERSION.")"; // If new title contains a version that is different than core + } + else $appli.=" ".DOL_VERSION; + } + else $appli.=" ".DOL_VERSION; + $urlback=$_SERVER["REQUEST_URI"]; - $topic='['.$conf->global->MAIN_APPLICATION_TITLE.'] '.$langs->transnoentitiesnoconv("NewPayboxPaymentReceived"); + $topic='['.$appli.'] '.$langs->transnoentitiesnoconv("NewPayboxPaymentReceived"); $tmptag=dolExplodeIntoArray($fulltag,'.','='); $content=""; if (! empty($tmptag['MEM'])) diff --git a/htdocs/public/paypal/newpayment.php b/htdocs/public/paypal/newpayment.php index e118d7694766e..cd963eec7988b 100644 --- a/htdocs/public/paypal/newpayment.php +++ b/htdocs/public/paypal/newpayment.php @@ -1,11 +1,11 @@ - * Copyright (C) 2006-2012 Laurent Destailleur + * Copyright (C) 2006-2017 Laurent Destailleur * Copyright (C) 2009-2012 Regis Houssin * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, @@ -23,7 +23,6 @@ * \file htdocs/public/paypal/newpayment.php * \ingroup paypal * \brief File to offer a way to make a payment for a particular Dolibarr entity - * \author Laurent Destailleur */ define("NOLOGIN",1); // This means this output page does not require to be logged. @@ -353,7 +352,7 @@ $var=false; // Free payment -if (! GETPOST("source") && $valid) +if (! GETPOST("source")) { $found=true; $tag=GETPOST("tag"); @@ -400,7 +399,7 @@ // Payment on customer order -if (GETPOST("source") == 'order' && $valid) +if (GETPOST("source") == 'order') { $found=true; $langs->load("orders"); @@ -507,7 +506,7 @@ // Payment on customer invoice -if (GETPOST("source") == 'invoice' && $valid) +if (GETPOST("source") == 'invoice') { $found=true; $langs->load("bills"); @@ -613,7 +612,7 @@ } // Payment on contract line -if (GETPOST("source") == 'contractline' && $valid) +if (GETPOST("source") == 'contractline') { $found=true; $langs->load("contracts"); @@ -808,7 +807,7 @@ } // Payment on member subscription -if (GETPOST("source") == 'membersubscription' && $valid) +if (GETPOST("source") == 'membersubscription') { $found=true; $langs->load("members"); diff --git a/htdocs/public/paypal/paymentko.php b/htdocs/public/paypal/paymentko.php index 2d3c67beecb27..e432db2e31747 100644 --- a/htdocs/public/paypal/paymentko.php +++ b/htdocs/public/paypal/paymentko.php @@ -108,8 +108,21 @@ $sendto=$conf->global->PAYPAL_PAYONLINE_SENDEMAIL; $from=$conf->global->MAILING_EMAIL_FROM; + // Define link to login card + $appli=constant('DOL_APPLICATION_TITLE'); + if (! empty($conf->global->MAIN_APPLICATION_TITLE)) + { + $appli=$conf->global->MAIN_APPLICATION_TITLE; + if (preg_match('/\d\.\d/', $appli)) + { + if (! preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli.=" (".DOL_VERSION.")"; // If new title contains a version that is different than core + } + else $appli.=" ".DOL_VERSION; + } + else $appli.=" ".DOL_VERSION; + $urlback=$_SERVER["REQUEST_URI"]; - $topic='['.$conf->global->MAIN_APPLICATION_TITLE.'] '.$langs->transnoentitiesnoconv("NewPaypalPaymentFailed"); + $topic='['.$appli.'] '.$langs->transnoentitiesnoconv("NewPaypalPaymentFailed"); $content=$langs->transnoentitiesnoconv("NewPaypalPaymentFailed")."\ntag=".$fulltag."\ntoken=".$token." paymentType=".$paymentType." currencycodeType=".$currencyCodeType." payerId=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt; require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; $mailfile = new CMailFile($topic, $sendto, $from, $content); diff --git a/htdocs/public/paypal/paymentok.php b/htdocs/public/paypal/paymentok.php index ddb779d621ec1..e3f2ed201e500 100644 --- a/htdocs/public/paypal/paymentok.php +++ b/htdocs/public/paypal/paymentok.php @@ -188,8 +188,21 @@ $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current + // Define link to login card + $appli=constant('DOL_APPLICATION_TITLE'); + if (! empty($conf->global->MAIN_APPLICATION_TITLE)) + { + $appli=$conf->global->MAIN_APPLICATION_TITLE; + if (preg_match('/\d\.\d/', $appli)) + { + if (! preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli.=" (".DOL_VERSION.")"; // If new title contains a version that is different than core + } + else $appli.=" ".DOL_VERSION; + } + else $appli.=" ".DOL_VERSION; + $urlback=$_SERVER["REQUEST_URI"]; - $topic='['.$conf->global->MAIN_APPLICATION_TITLE.'] '.$langs->transnoentitiesnoconv("NewPaypalPaymentReceived"); + $topic='['.$appli.'] '.$langs->transnoentitiesnoconv("NewPaypalPaymentReceived"); $tmptag=dolExplodeIntoArray($fulltag,'.','='); $content=""; if (! empty($tmptag['MEM'])) @@ -258,8 +271,21 @@ $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current + // Define link to login card + $appli=constant('DOL_APPLICATION_TITLE'); + if (! empty($conf->global->MAIN_APPLICATION_TITLE)) + { + $appli=$conf->global->MAIN_APPLICATION_TITLE; + if (preg_match('/\d\.\d/', $appli)) + { + if (! preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli.=" (".DOL_VERSION.")"; // If new title contains a version that is different than core + } + else $appli.=" ".DOL_VERSION; + } + else $appli.=" ".DOL_VERSION; + $urlback=$_SERVER["REQUEST_URI"]; - $topic='['.$conf->global->MAIN_APPLICATION_TITLE.'] '.$langs->transnoentitiesnoconv("ValidationOfPaypalPaymentFailed"); + $topic='['.$appli.'] '.$langs->transnoentitiesnoconv("ValidationOfPaypalPaymentFailed"); $content=""; $content.=$langs->transnoentitiesnoconv("PaypalConfirmPaymentPageWasCalledButFailed")."\n"; $content.="\n"; diff --git a/htdocs/public/stripe/newpayment.php b/htdocs/public/stripe/newpayment.php index 71f581000b21d..0d6cefd357a6b 100644 --- a/htdocs/public/stripe/newpayment.php +++ b/htdocs/public/stripe/newpayment.php @@ -1,6 +1,7 @@ * Copyright (C) 2017 Saasprov + * Copyright (C) 2017 Laurent Destailleur * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,6 +36,7 @@ $langs->load("main"); $langs->load("other"); +$langs->load("paybox"); // File with generic data $langs->load("stripe"); $source=GETPOST("source",'alpha'); diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index 6274197a30152..3dd238b2f1dba 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -36,8 +36,7 @@ $langs->load("paybox"); $langs->load("stripe"); -if (!$user->admin) - accessforbidden(); +if (! $user->admin) accessforbidden(); $action = GETPOST('action','alpha'); @@ -96,6 +95,8 @@ * View */ +$form=new Form($db); + $SECRET_TEST_KEY="sk_test_xxxxxxxxxxxxxxxxxxxxxxxx"; // Stripe test secret key if (empty($conf->global->STRIPE_TEST_SECRET_KEY)) $conf->global->STRIPE_TEST_SECRET_KEY = $SECRET_TEST_KEY; $PUBLISHABLE_TEST_KEY="pk_test_xxxxxxxxxxxxxxxxxxxxxxxx"; // Stripe test publishable key @@ -108,10 +109,8 @@ llxHeader('',$langs->trans("StripeSetup")); - $linkback=''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("ModuleSetup").' Stripe',$linkback); -print '
'; $head=stripeadmin_prepare_head(); @@ -119,22 +118,19 @@ print ''; print ''; -dol_fiche_head($head, 'stripeaccount', ''); +dol_fiche_head($head, 'stripeaccount', '', -1); print $langs->trans("StripeDesc")."
\n"; print '
'; -$var=true; - print ''; print ''; print ''; print ''; print "\n"; -$var=!$var; -print ''; +print ''; print ''; -$var=!$var; -print ''; -$var=!$var; -print ''; -$var=!$var; -print ''; -$var=!$var; -print ''; print "\n"; -$var=!$var; -print ''; -$var=!$var; -print ''; -$var=!$var; -print ''; -$var=!$var; -print '
'.$langs->trans("AccountParameter").''.$langs->trans("Value").'
'; print $langs->trans("StripeLiveEnabled").''; if (!empty($conf->global->STRIPE_LIVE)) @@ -149,29 +145,25 @@ } print '
'; +print '
'; print ''.$langs->trans("STRIPE_TEST_SECRET_KEY").''; print ''; print '
'.$langs->trans("Example").': sk_test_xxxxxxxxxxxxxxxxxxxxxxxx'; print '
'; +print '
'; print ''.$langs->trans("STRIPE_TEST_PUBLISHABLE_KEY").''; print ''; print '
'.$langs->trans("Example").': pk_test_xxxxxxxxxxxxxxxxxxxxxxxx'; print '
'; +print '
'; print ''.$langs->trans("STRIPE_LIVE_SECRET_KEY").''; print ''; print '
'.$langs->trans("Example").': sk_live_xxxxxxxxxxxxxxxxxxxxxxxx'; print '
'; +print '
'; print ''.$langs->trans("STRIPE_LIVE_PUBLISHABLE_KEY").''; print ''; print '
'.$langs->trans("Example").': pk_live_xxxxxxxxxxxxxxxxxxxxxxxx'; @@ -187,29 +179,25 @@ print '
'.$langs->trans("Value").'
'; +print '
'; print $langs->trans("VendorName").''; print ''; print '
'.$langs->trans("Example").': '.$mysoc->name; print '
'; +print '
'; print $langs->trans("CSSUrlForPaymentForm").''; print ''; print '
'.$langs->trans("Example").': http://mysite/mycss.css'; print '
'; +print '
'; print $langs->trans("MessageOK").''; $doleditor=new DolEditor('STRIPE_MESSAGE_OK',$conf->global->STRIPE_MESSAGE_OK,'',100,'dolibarr_details','In',false,true,true,ROWS_2,'90%'); $doleditor->Create(); print '
'; +print '
'; print $langs->trans("MessageKO").''; $doleditor=new DolEditor('STRIPE_MESSAGE_KO',$conf->global->STRIPE_MESSAGE_KO,'',100,'dolibarr_details','In',false,true,true,ROWS_2,'90%'); $doleditor->Create(); @@ -225,35 +213,128 @@ print '

'; -/* + +$token=''; + + +// Url list print ''.$langs->trans("FollowingUrlAreAvailableToMakePayments").':
'; print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnFreeAmount",$servicename).':
'; -print ''.DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?amount=9.99&tag=your_free_tag'."
\n"; +print ''.getStripePaymentUrl(1,'free')."

\n"; if (! empty($conf->commande->enabled)) { print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnOrder",$servicename).':
'; - print ''.DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?source=order&ref=order_ref'."
\n"; + print ''.getStripePaymentUrl(1,'order')."
\n"; + if (! empty($conf->global->STRIPE_SECURITY_TOKEN) && ! empty($conf->global->STRIPE_SECURITY_TOKEN_UNIQUE)) + { + $langs->load("orders"); + print '
'; + print $langs->trans("EnterRefToBuildUrl",$langs->transnoentitiesnoconv("Order")).': '; + print ''; + print ''; + if (GETPOST('generate_order_ref','alpha')) + { + print '
-> '; + $url=getStripePaymentUrl(0,'order',GETPOST('generate_order_ref','alpha')); + print $url; + print "
\n"; + } + print '
'; + } + print '
'; } if (! empty($conf->facture->enabled)) { print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnInvoice",$servicename).':
'; - print ''.DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?source=invoice&ref=invoice_ref'."
\n"; + print ''.getStripePaymentUrl(1,'invoice')."
\n"; + if (! empty($conf->global->STRIPE_SECURITY_TOKEN) && ! empty($conf->global->STRIPE_SECURITY_TOKEN_UNIQUE)) + { + $langs->load("bills"); + print '
'; + print $langs->trans("EnterRefToBuildUrl",$langs->transnoentitiesnoconv("Invoice")).': '; + print ''; + print ''; + if (GETPOST('generate_invoice_ref','alpha')) + { + print '
-> '; + $url=getPaypalPaymentUrl(0,'invoice',GETPOST('generate_invoice_ref','alpha')); + print $url; + print "
\n"; + } + print '
'; + } + print '
'; } if (! empty($conf->contrat->enabled)) { print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnContractLine",$servicename).':
'; - print ''.DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?source=contractline&ref=contractline_ref'."
\n"; + print ''.getStripePaymentUrl(1,'contractline')."
\n"; + if (! empty($conf->global->STRIPE_SECURITY_TOKEN) && ! empty($conf->global->STRIPE_SECURITY_TOKEN_UNIQUE)) + { + $langs->load("contract"); + print '
'; + print $langs->trans("EnterRefToBuildUrl",$langs->transnoentitiesnoconv("Contract")).': '; + print ''; + print ''; + if (GETPOST('generate_contract_ref')) + { + print '
-> '; + $url=getPaypalPaymentUrl(0,'contractline',GETPOST('generate_contract_ref','alpha')); + print $url; + print "
\n"; + } + print '
'; + } + print '
'; } if (! empty($conf->adherent->enabled)) { print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnMemberSubscription",$servicename).':
'; - print ''.DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?source=membersubscription&ref=member_ref'."
\n"; + print ''.getStripePaymentUrl(1,'membersubscription')."
\n"; + if (! empty($conf->global->STRIPE_SECURITY_TOKEN) && ! empty($conf->global->STRIPE_SECURITY_TOKEN_UNIQUE)) + { + $langs->load("members"); + print '
'; + print $langs->trans("EnterRefToBuildUrl",$langs->transnoentitiesnoconv("Member")).': '; + print ''; + print ''; + if (GETPOST('generate_member_ref')) + { + print '
-> '; + $url=getPaypalPaymentUrl(0,'membersubscription',GETPOST('generate_member_ref','alpha')); + print $url; + print "
\n"; + } + print '
'; + } } print "
"; print info_admin($langs->trans("YouCanAddTagOnUrl")); -*/ -llxFooter(); +if (! empty($conf->use_javascript_ajax)) +{ + print "\n".''; +} + +llxFooter(); $db->close();