Try to fix regression
This commit is contained in:
parent
06689bb79f
commit
5b0dd0e31b
@ -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;
|
||||
|
||||
@ -150,24 +150,17 @@ print "</tr>\n";
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="titlefield">';
|
||||
print $langs->trans("StripeLiveEnabled").'</td><td>';
|
||||
if (empty($conf->global->STRIPECONNECT_LIVE) && ! empty($conf->stripeconnect->enabled)) {
|
||||
if (!empty($conf->global->STRIPE_LIVE))
|
||||
print '<A href="'.$_SERVER['PHP_SELF'].'?action=setlive&value=0">';
|
||||
print img_picto($langs->trans("Disabled"),'switch_off');
|
||||
print '</A>';
|
||||
}
|
||||
else {
|
||||
if (!empty($conf->global->STRIPE_LIVE))
|
||||
{
|
||||
print '<A href="'.$_SERVER['PHP_SELF'].'?action=setlive&value=0">';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=setlive&value=0">';
|
||||
print img_picto($langs->trans("Activated"),'switch_on');
|
||||
print '</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<A href="'.$_SERVER['PHP_SELF'].'?action=setlive&value=1">';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=setlive&value=1">';
|
||||
print img_picto($langs->trans("Disabled"),'switch_off');
|
||||
}
|
||||
print '</A>';
|
||||
print '</a>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
@ -191,22 +184,24 @@ if (empty($conf->stripeconnect->enabled))
|
||||
print ' '.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr class="oddeven"><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 ' '.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx';
|
||||
print '</td></tr>';
|
||||
print '<tr class="oddeven"><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 ' '.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx';
|
||||
print '</td></tr>';
|
||||
} else {
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("StripeConnect").'</td>';
|
||||
print '<td><b>'.$langs->trans("StripeConnect_Mode").'</b><br/>';
|
||||
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).' </td></tr>';
|
||||
print '</td></tr>';
|
||||
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).' </td></tr>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
if (empty($conf->stripeconnect->enabled))
|
||||
{
|
||||
print '<tr class="oddeven"><td>';
|
||||
print '<span class="fieldrequired">'.$langs->trans("STRIPE_LIVE_SECRET_KEY").'</span></td><td>';
|
||||
print '<input class="minwidth300" type="text" name="STRIPE_LIVE_SECRET_KEY" value="'.$conf->global->STRIPE_LIVE_SECRET_KEY.'">';
|
||||
@ -233,7 +228,7 @@ print '<br>';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("UsageParameter").'</td>';
|
||||
print '<td class="titlefield">'.$langs->trans("UsageParameter").'</td>';
|
||||
print '<td>'.$langs->trans("Value").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user