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;
|
$endpoint_secret = $conf->global->STRIPE_LIVE_WEBHOOK_CONNECT_KEY;
|
||||||
$service = 'StripeLive';
|
$service = 'StripeLive';
|
||||||
}
|
}
|
||||||
}else {
|
}
|
||||||
|
else {
|
||||||
if (isset($_GET['test']))
|
if (isset($_GET['test']))
|
||||||
{
|
{
|
||||||
$endpoint_secret = $conf->global->STRIPE_TEST_WEBHOOK_KEY;
|
$endpoint_secret = $conf->global->STRIPE_TEST_WEBHOOK_KEY;
|
||||||
@ -90,7 +91,7 @@ $user->getrights();
|
|||||||
if (! empty($conf->multicompany->enabled) && ! empty($conf->stripeconnect->enabled)) {
|
if (! empty($conf->multicompany->enabled) && ! empty($conf->stripeconnect->enabled)) {
|
||||||
$sql = "SELECT entity";
|
$sql = "SELECT entity";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."oauth_token";
|
$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);
|
dol_syslog(get_class($db) . "::fetch", LOG_DEBUG);
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
@ -116,10 +117,11 @@ $stripe=new Stripe($db);
|
|||||||
if ($event->type == 'payout.created') {
|
if ($event->type == 'payout.created') {
|
||||||
$error=0;
|
$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)
|
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);
|
$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';
|
$subject = '[NOTIFICATION] Virement programmée';
|
||||||
$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.'>'; // TODO convert in dolibarr standard
|
||||||
@ -180,9 +182,10 @@ elseif ($event->type == 'payout.paid') {
|
|||||||
if (! ($result > 0)) $error++;
|
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);
|
$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é';
|
$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);
|
mail(''.$conf->global->MAIN_INFO_SOCIETE_MAIL.'', $subject, $body, $headers);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@ -150,24 +150,17 @@ print "</tr>\n";
|
|||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td class="titlefield">';
|
print '<td class="titlefield">';
|
||||||
print $langs->trans("StripeLiveEnabled").'</td><td>';
|
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))
|
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 img_picto($langs->trans("Activated"),'switch_on');
|
||||||
|
print '</a>';
|
||||||
}
|
}
|
||||||
else
|
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 img_picto($langs->trans("Disabled"),'switch_off');
|
||||||
}
|
print '</a>';
|
||||||
print '</A>';
|
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
@ -207,6 +200,8 @@ if (empty($conf->stripeconnect->enabled))
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($conf->stripeconnect->enabled))
|
||||||
|
{
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print '<span class="fieldrequired">'.$langs->trans("STRIPE_LIVE_SECRET_KEY").'</span></td><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.'">';
|
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 '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
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 '<td>'.$langs->trans("Value").'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user