From dd15dc56dd692cda903de4fd76a1143674e408b9 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 10 Mar 2018 14:34:10 +0100 Subject: [PATCH] Update and fix prepare integration for more callback support --- htdocs/public/stripe/ipn.php | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index 32d874eafbe..15cd2d5cc69 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -90,7 +90,7 @@ if (! empty($conf->multicompany->enabled) && ! empty($conf->stripeconnect->enabl } else {$key=1;} $ret=$mc->switchEntity($key); -if (! $res && file_exists("../../main.inc.php")) $res=@include("../../main.inc.php"); // to work if your module directory is into a subdir of root htdocs directory +if (! $res && file_exists("../../main.inc.php")) $res=@include("../../main.inc.php"); if (! $res) die("Include of main fails"); } @@ -105,7 +105,7 @@ if ($event->type == 'payout.created') { { $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.'>'; +$headers = 'From: "'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'" <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>'; TODO convert in dolibarr standard mail(''.$conf->global->MAIN_INFO_SOCIETE_MAIL.'', $subject, $body, $headers); return 1; } @@ -165,7 +165,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $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.'>'; +$headers = 'From: "'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'" <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>'; TODO convert in dolibarr standard mail(''.$conf->global->MAIN_INFO_SOCIETE_MAIL.'', $subject, $body, $headers); return 1; @@ -180,11 +180,26 @@ elseif ($event->type == 'charge.succeeded') { //TODO: create fees +} +elseif ($event->type == 'customer.source.created') { + +//TODO: save customer's source + +} +elseif ($event->type == 'customer.source.updated') { + +//TODO: update customer's source + +} +elseif ($event->type == 'customer.source.delete') { + +//TODO: delete customer's source + } elseif ($event->type == 'charge.failed') { $subject = 'Your payment has been received: '.$event->data->object->id.''; -$headers = 'From: "test webhook" '; +$headers = 'From: "'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'" <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>'; //mail('ptibogxiv@msn.com', $subject, 'test', $headers); } @@ -282,8 +297,8 @@ $invoice->set_paid($user); $body = ""; $subject = 'Facture '.$invoice->ref; -$headers = 'From: "test webhook" '; -//mail('ptibogxiv@msn.com', $subject, $body, $headers); +$headers = 'From: "'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'" <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>'; +//mail('ptibogxiv@msn.com', $subject, $body, $headers); TODO convert in dolibarr standard } elseif ($event->type == 'customer.deleted') { $db->begin();