mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Debug v21
This commit is contained in:
parent
1fd212cc16
commit
8f7881a871
|
|
@ -12,6 +12,7 @@ YourEMail=Email to receive payment confirmation
|
|||
STRIPE_PAYONLINE_SENDEMAIL=Email notification after a payment attempt (success or fail)
|
||||
Creditor=Creditor
|
||||
PaymentCode=Payment code
|
||||
StripeAutoRecordPayout=Enable the auto recording of payout (when Stripe do a payout and call the webhook payout.create/payout.paid)
|
||||
StripeDoPayment=Pay with Stripe
|
||||
YouWillBeRedirectedOnStripe=You will be redirected on secured Stripe page to input you credit card information
|
||||
Continue=Next
|
||||
|
|
|
|||
|
|
@ -178,14 +178,14 @@ top_httphead();
|
|||
dol_syslog("***** Stripe IPN was called with event->type=".$event->type." service=".$service);
|
||||
|
||||
|
||||
if ($event->type == 'payout.created') {
|
||||
// When a payout is create by Stripe to transfer money to your account
|
||||
if ($event->type == 'payout.created' && getDolGlobalString('STRIPE_AUTO_RECORD_PAYOUT')) {
|
||||
// When a payout is created by Stripe to transfer money to your account
|
||||
$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);
|
||||
|
||||
if ($result > 0) {
|
||||
$subject = $societeName.' - [NOTIFICATION] Stripe payout scheduled';
|
||||
$subject = '['.$societeName.'] Notification - Stripe payout scheduled';
|
||||
if (!empty($user->email)) {
|
||||
$sendto = dolGetFirstLastname($user->firstname, $user->lastname)." <".$user->email.">";
|
||||
} else {
|
||||
|
|
@ -221,7 +221,7 @@ if ($event->type == 'payout.created') {
|
|||
http_response_code(500);
|
||||
return -1;
|
||||
}
|
||||
} elseif ($event->type == 'payout.paid') {
|
||||
} elseif ($event->type == 'payout.paid' && getDolGlobalString('STRIPE_AUTO_RECORD_PAYOUT')) {
|
||||
// When a payout to transfer money to your account is completely done
|
||||
$error = 0;
|
||||
$result = dolibarr_set_const($db, $service."_NEXTPAYOUT", 0, 'chaine', 0, '', $conf->entity);
|
||||
|
|
@ -249,6 +249,8 @@ if ($event->type == 'payout.created') {
|
|||
$typefrom = 'PRE';
|
||||
$typeto = 'VIR';
|
||||
|
||||
$db->begin();
|
||||
|
||||
if (!$error) {
|
||||
$bank_line_id_from = $accountfrom->addline($dateo, $typefrom, $label, -1 * (float) price2num($amount), '', '', $user);
|
||||
}
|
||||
|
|
@ -274,38 +276,47 @@ if ($event->type == 'payout.created') {
|
|||
if (!($result > 0)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
} else {
|
||||
$db->rollback();
|
||||
}
|
||||
|
||||
// Send email
|
||||
if (!$error) {
|
||||
$subject = '['.$societeName.'] - NotificationOTIFICATION] Stripe payout done';
|
||||
if (!empty($user->email)) {
|
||||
$sendto = dolGetFirstLastname($user->firstname, $user->lastname)." <".$user->email.">";
|
||||
} else {
|
||||
$sendto = getDolGlobalString('MAIN_INFO_SOCIETE_MAIL') . '" <' . getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>';
|
||||
}
|
||||
$replyto = $sendto;
|
||||
$sendtocc = '';
|
||||
if (getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL')) {
|
||||
$sendtocc = getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL') . '" <' . getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL').'>';
|
||||
}
|
||||
|
||||
$message = "A bank transfer of ".price2num($event->data->object->amount / 100)." ".$event->data->object->currency." has been done to your account the ".dol_print_date($event->data->object->arrival_date, 'dayhour');
|
||||
|
||||
$mailfile = new CMailFile(
|
||||
$subject,
|
||||
$sendto,
|
||||
$replyto,
|
||||
$message,
|
||||
array(),
|
||||
array(),
|
||||
array(),
|
||||
$sendtocc,
|
||||
'',
|
||||
0,
|
||||
-1
|
||||
);
|
||||
|
||||
$ret = $mailfile->sendfile();
|
||||
}
|
||||
}
|
||||
|
||||
$subject = $societeName.' - [NOTIFICATION] Stripe payout done';
|
||||
if (!empty($user->email)) {
|
||||
$sendto = dolGetFirstLastname($user->firstname, $user->lastname)." <".$user->email.">";
|
||||
} else {
|
||||
$sendto = getDolGlobalString('MAIN_INFO_SOCIETE_MAIL') . '" <' . getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>';
|
||||
}
|
||||
$replyto = $sendto;
|
||||
$sendtocc = '';
|
||||
if (getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL')) {
|
||||
$sendtocc = getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL') . '" <' . getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL').'>';
|
||||
}
|
||||
|
||||
$message = "A bank transfer of ".price2num($event->data->object->amount / 100)." ".$event->data->object->currency." has been done to your account the ".dol_print_date($event->data->object->arrival_date, 'dayhour');
|
||||
|
||||
$mailfile = new CMailFile(
|
||||
$subject,
|
||||
$sendto,
|
||||
$replyto,
|
||||
$message,
|
||||
array(),
|
||||
array(),
|
||||
array(),
|
||||
$sendtocc,
|
||||
'',
|
||||
0,
|
||||
-1
|
||||
);
|
||||
|
||||
$ret = $mailfile->sendfile();
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
$error++;
|
||||
|
|
|
|||
|
|
@ -379,18 +379,30 @@ print '<input class="minwidth300" type="text" name="ONLINE_PAYMENT_CREDITOR" val
|
|||
print ' <span class="opacitymedium">'.$langs->trans("Example").': '.$mysoc->name.'</span>';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("StripeUserAccountForActions").'</td><td>';
|
||||
print img_picto('', 'user', 'class="pictofixedwidth"').$form->select_dolusers(getDolGlobalString('STRIPE_USER_ACCOUNT_FOR_ACTIONS'), 'STRIPE_USER_ACCOUNT_FOR_ACTIONS', 0);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("BankAccount").'</td><td>';
|
||||
print img_picto('', 'bank_account', 'class="pictofixedwidth"');
|
||||
$form->select_comptes(getDolGlobalString('STRIPE_BANK_ACCOUNT_FOR_PAYMENTS'), 'STRIPE_BANK_ACCOUNT_FOR_PAYMENTS', 0, '', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { // What is this for ?
|
||||
|
||||
// Param to record automatically payouts (received from IPN payout.payed and payout.created)
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("StripeAutoRecordPayout").'</td><td>';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('STRIPE_AUTO_RECORD_PAYOUT', array(), null, 0, 0, 1);
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("STRIPE_AUTO_RECORD_PAYOUT", $arrval, getDolGlobalInt('STRIPE_AUTO_RECORD_PAYOUT'));
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
if (getDolGlobalInt('STRIPE_AUTO_RECORD_PAYOUT')) {
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("StripeUserAccountForActions").'</td><td>';
|
||||
print img_picto('', 'user', 'class="pictofixedwidth"').$form->select_dolusers(getDolGlobalString('STRIPE_USER_ACCOUNT_FOR_ACTIONS'), 'STRIPE_USER_ACCOUNT_FOR_ACTIONS', 0);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("BankAccountForBankTransfer").'</td><td>';
|
||||
print img_picto('', 'bank_account', 'class="pictofixedwidth"');
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user