diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index 9ecbf424e1f..bbd2d46a12f 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -48,7 +48,8 @@ if (isset($_GET['connect'])){ $endpoint_secret = $conf->global->STRIPE_LIVE_WEBHOOK_CONNECT_KEY; $service = 'StripeLive'; } -}else { +} +else { if (isset($_GET['test'])) { $endpoint_secret = $conf->global->STRIPE_TEST_WEBHOOK_KEY; @@ -90,7 +91,7 @@ $user->getrights(); if (! empty($conf->multicompany->enabled) && ! empty($conf->stripeconnect->enabled)) { $sql = "SELECT entity"; $sql.= " FROM ".MAIN_DB_PREFIX."oauth_token"; - $sql.= " WHERE service = '$service' and tokenstring = '%".$event->account."%'"; + $sql.= " WHERE service = '".$db->escape($service)."' and tokenstring = '%".$db->escape($event->account)."%'"; dol_syslog(get_class($db) . "::fetch", LOG_DEBUG); $result = $db->query($sql); @@ -116,10 +117,11 @@ $stripe=new Stripe($db); if ($event->type == 'payout.created') { $error=0; - $result=dolibarr_set_const($db, $service."_NEXTPAYOUT",date('Y-m-d H:i:s',$event->data->object->arrival_date),'chaine',0,'',$conf->entity); + $result=dolibarr_set_const($db, $service."_NEXTPAYOUT", date('Y-m-d H:i:s',$event->data->object->arrival_date), 'chaine', 0, '', $conf->entity); if ($result > 0) { + // TODO Use CMail and translation $body = "Un virement de ".price2num($event->data->object->amount/100)." ".$event->data->object->currency." est attendu sur votre compte le ".date('d-m-Y H:i:s',$event->data->object->arrival_date); $subject = '[NOTIFICATION] Virement programmĂ©e'; $headers = 'From: "'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'" <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>'; // TODO convert in dolibarr standard @@ -180,9 +182,10 @@ elseif ($event->type == 'payout.paid') { if (! ($result > 0)) $error++; } + // TODO Use CMail and translation $body = "Un virement de ".price2num($event->data->object->amount/100)." ".$event->data->object->currency." a ete effectue sur votre compte le ".date('d-m-Y H:i:s',$event->data->object->arrival_date); $subject = '[NOTIFICATION] Virement effectuĂ©'; - $headers = 'From: "'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'" <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>'; // TODO convert in dolibarr standard + $headers = 'From: "'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'" <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>'; mail(''.$conf->global->MAIN_INFO_SOCIETE_MAIL.'', $subject, $body, $headers); return 1; diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index 67698093b90..b82fcb34f58 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -150,24 +150,17 @@ print "\n"; print ''; print ''; print $langs->trans("StripeLiveEnabled").''; -if (empty($conf->global->STRIPECONNECT_LIVE) && ! empty($conf->stripeconnect->enabled)) { -if (!empty($conf->global->STRIPE_LIVE)) - print ''; - print img_picto($langs->trans("Disabled"),'switch_off'); -print ''; -} -else { if (!empty($conf->global->STRIPE_LIVE)) { - print ''; + print ''; print img_picto($langs->trans("Activated"),'switch_on'); + print ''; } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"),'switch_off'); -} -print ''; + print ''; } print ''; @@ -191,22 +184,24 @@ if (empty($conf->stripeconnect->enabled)) print '   '.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx'; print ''; - print ''; - print ''.$langs->trans("STRIPE_LIVE_WEBHOOK_KEY").''; - print ''; - print '   '.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx'; - print ''; + print ''; + print ''.$langs->trans("STRIPE_LIVE_WEBHOOK_KEY").''; + print ''; + print '   '.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx'; + print ''; } else { print ''.$langs->trans("StripeConnect").''; print ''.$langs->trans("StripeConnect_Mode").'
'; - print $langs->trans("STRIPE_APPLICATION_FEE_PLATFORM").' '; - print price($conf->global->STRIPE_APPLICATION_FEE_PERCENT); - print '% + '; - print price($conf->global->STRIPE_APPLICATION_FEE); - print ' '.$langs->getCurrencySymbol($conf->currency).' '.$langs->trans("minimum").' '.price($conf->global->STRIPE_APPLICATION_FEE_MINIMAL).' '.$langs->getCurrencySymbol($conf->currency).' '; - print ''; + print $langs->trans("STRIPE_APPLICATION_FEE_PLATFORM").' '; + print price($conf->global->STRIPE_APPLICATION_FEE_PERCENT); + print '% + '; + print price($conf->global->STRIPE_APPLICATION_FEE); + print ' '.$langs->getCurrencySymbol($conf->currency).' '.$langs->trans("minimum").' '.price($conf->global->STRIPE_APPLICATION_FEE_MINIMAL).' '.$langs->getCurrencySymbol($conf->currency).' '; + print ''; } +if (empty($conf->stripeconnect->enabled)) +{ print ''; print ''.$langs->trans("STRIPE_LIVE_SECRET_KEY").''; print ''; @@ -233,7 +228,7 @@ print '
'; print ''; print ''; -print ''; +print ''; print ''; print "\n";
'.$langs->trans("UsageParameter").''.$langs->trans("UsageParameter").''.$langs->trans("Value").'