diff --git a/plugins/cipf_plugin/cipf_plugin.php b/plugins/cipf_plugin/cipf_plugin.php
index 17d466a..f88abb6 100644
--- a/plugins/cipf_plugin/cipf_plugin.php
+++ b/plugins/cipf_plugin/cipf_plugin.php
@@ -161,6 +161,7 @@ contactez la fipf directement",
'_default'=>[
// 1. profs : email : payment_success : validation payment prof reussi, send email
'payment_success'=>[
+ 'name'=>'le paiement a réussi',
'notification_send'=>true,
'notification_to'=>'$$__admin_email__$$',
'notification_subject'=>"paiement réussi",
@@ -171,6 +172,7 @@ contactez la fipf directement",
],
// 2. profs : email : payment_failure : validation payment prof echec, send email
'payment_echec'=>[
+ 'name'=>'le paiement a echoué',
'notification_send'=>true,
'notification_to'=>'$$__admin_email__$$',
'notification_subject'=>"",
@@ -181,6 +183,7 @@ contactez la fipf directement",
],
// 3. profs : email : transfert_success : validation transfert prof reussi, send email
'transfert_success'=>[
+ 'name'=>'le virement a été validé',
'notification_send'=>true,
'notification_to'=>'$$__admin_email__$$',
'notification_subject'=>"",
@@ -191,6 +194,7 @@ contactez la fipf directement",
],
// 4. profs : email : transfert_failures : validation transfert prof echec, send email
'transfert_echec'=>[
+ 'name'=>'le virement a échoué',
'notification_send'=>true,
'notification_to'=>'$$__admin_email__$$',
'notification_subject'=>"",
@@ -201,6 +205,7 @@ contactez la fipf directement",
],
// 5. partners : email : offer_expired : offres temporaires -> gerer qu'elles disparaissent apres la date de validite -> la passer en masquer
'offer_expired'=>[
+ 'name'=>"l'offre a expirée",
'notification_send'=>true,
'notification_to'=>'$$__admin_email__$$',
'notification_subject'=>"",
@@ -211,6 +216,7 @@ contactez la fipf directement",
],
// 6. partners : email : offer_will_expire : la gestion des offres à échéance
'offer_will_expire'=>[
+ 'name'=>"l'offre arrive bientot a expiration",
'notification_send'=>true,
'notification_to'=>'$$__admin_email__$$',
'notification_subject'=>"",
@@ -221,6 +227,7 @@ contactez la fipf directement",
],
// 7. payments : email : account_deleted : schedule event pour supprimer le compte xx temps (6 mois ?) apres fin de validite de la carte
'account_deleted'=>[
+ 'name'=>'le compte a ete supprimé',
'notification_send'=>true,
'notification_to'=>'$$__admin_email__$$',
'notification_subject'=>"",
@@ -230,7 +237,8 @@ contactez la fipf directement",
'confirmation_message'=>"",
],
// 8. payments : email : account_will_expire : faire rappels emails avant expiration
- 'eccount_will_expire'=>[
+ 'account_will_expire'=>[
+ 'name'=>'le compte va bientot expirer',
'notification_send'=>true,
'notification_to'=>'$$__admin_email__$$',
'notification_subject'=>"",
@@ -241,6 +249,7 @@ contactez la fipf directement",
],
// 9. payments : email : account_expired : desactiver carte expiree
'account_expired'=>[
+ 'name'=>'le compte a expiré',
'notification_send'=>true,
'notification_to'=>'$$__admin_email__$$',
'notification_subject'=>"",
diff --git a/plugins/cipf_plugin/html/menu/cipf_menu.html b/plugins/cipf_plugin/html/menu/cipf_menu.html
index 69b3764..967060d 100644
--- a/plugins/cipf_plugin/html/menu/cipf_menu.html
+++ b/plugins/cipf_plugin/html/menu/cipf_menu.html
@@ -75,3 +75,40 @@
+
+
+
+
+
emails :
+
+
+ $email_options) { ?>
+
+
+
:
+
+ />
+
+
+
+ />
+
+
+
+
+
+
+
+
+
diff --git a/plugins/cipf_plugin/php/admin_menu.php b/plugins/cipf_plugin/php/admin_menu.php
index b97fdb9..b1b01e0 100644
--- a/plugins/cipf_plugin/php/admin_menu.php
+++ b/plugins/cipf_plugin/php/admin_menu.php
@@ -29,6 +29,7 @@ function add_plugin_content_CIPF() {
Plgntls::debug_infos();
$option_paypal_object = Cipf::OPTION_PAYPAL;
$option_payment_object = Cipf::OPTION_PAYMENT;
+ $option_emails_object = Cipf::OPTION_EMAILS;
/*
* options
@@ -38,6 +39,8 @@ function add_plugin_content_CIPF() {
$option_paypal = Plgntls::get_option_safe($option_paypal_object);
$option_payment_name = $option_payment_object['_name'];
$option_payment = Plgntls::get_option_safe($option_payment_object);
+ $option_emails_name = $option_emails_object['_name'];
+ $option_emails = Plgntls::get_option_safe($option_emails_object);
ob_start();
include(Plgntls::root_path() . '/html/menu/cipf_menu.html');
@@ -157,5 +160,90 @@ function update_paypal_credentials_CIPF($request, $option_name, $option_data, $o
+function update_emails_settings_option_CIPF($request, $option_name, $option_data, $option_default) {
+ Plgntls::debug_infos();
+
+ /*
+ *
+ *
+ */
+error_log("request: " . json_encode($request));
+error_log("option_data: " . json_encode($option_data));
+ foreach ($option_data as $email => $email_options) {
+ error_log("email: " . $email);
+ error_log("email_options: " . json_encode($email_options));
+ if (isset($request[$email])) {
+ error_log("email is set");
+ }
+ }
+
+
+// $is_sandbox = false;
+// if (!isset($request['sandbox_or_live'])) {
+// return;
+// }
+// if ($request['sandbox_or_live'] === 'sandbox') {
+// $is_sandbox = true;
+// }
+// else if ($request['sandbox_or_live'] === 'live') {
+// $is_sandbox = false;
+// }
+// else {
+// return;
+// }
+//
+//
+// /*
+// * client id
+// *
+// */
+// $client_id = '';
+// if (!isset($request['client_id'])) {
+// return;
+// }
+// else {
+// $client_id = $request['client_id'];
+// }
+//
+//
+// /*
+// * client secret
+// *
+// */
+// $client_secret = '';
+// if (!isset($request['client_secret'])) {
+// return;
+// }
+// else {
+// $client_secret = $request['client_secret'];
+// }
+//
+//
+// /*
+// * update the option with new credentials
+// *
+// set_paypal_options_CIPF($is_sandbox, $client_id, $client_secret);
+// */
+// $data = array(
+// 'is_sandbox' => $is_sandbox,
+// 'client_id' => $client_id,
+// 'client_secret' => $client_secret,
+// );
+// Plgntls::update_option_safe($option_name, $data);
+}
+
+/*
+ 'payment_success'=>[
+ 'notification_send'=>true,
+ 'notification_to'=>'$$__admin_email__$$',
+ 'notification_subject'=>"paiement réussi",
+ 'notification_message'=>"par ici la monnaie",
+ 'confirmation_send'=>true,
+ 'confirmation_subject'=>"paiement réussi",
+ 'confirmation_message'=>"donne l'argent",
+*/
+
+
+
?>
diff --git a/plugins/cipf_plugin/php/emails.php b/plugins/cipf_plugin/php/emails.php
index 6e666c2..ae8b1c7 100644
--- a/plugins/cipf_plugin/php/emails.php
+++ b/plugins/cipf_plugin/php/emails.php
@@ -37,6 +37,8 @@ function prepare_emails_CIPF($email_name, $user_id) {
if (is_null($user_id)) {
$user_id = get_current_user_id();
}
+ $user = get_user_by('id', $user_id);
+ $user_email = $user->user_email;
$emails_option = Plgntls::get_option_safe($emails_option_object);
@@ -60,7 +62,7 @@ function prepare_emails_CIPF($email_name, $user_id) {
}
if ($email['confirmation_send']) {
$tmp_email = array();
- $tmp_email['to'] = $user_id;
+ $tmp_email['to'] = $user_email;
$tmp_email['subject'] = $email['confirmation_subject'];
$tmp_email['message'] = $email['confirmation_message'];
$tmp_email['headers'] = array('Content-Type: text/html; charset=UTF-8');
diff --git a/plugins/cipf_plugin/php/paypal/route_api_orders_capture.php b/plugins/cipf_plugin/php/paypal/route_api_orders_capture.php
index 4619122..1becd75 100644
--- a/plugins/cipf_plugin/php/paypal/route_api_orders_capture.php
+++ b/plugins/cipf_plugin/php/paypal/route_api_orders_capture.php
@@ -55,7 +55,6 @@ function handle_orders_capture_request_CIPF($request) {
try {
update_user_post_capture_CIPF($json_response, 'end');
-throw new HttpException('cannot find user with this order_id', 502);
return new WP_REST_Response($json_response, $http_status_code);
}
catch (HttpException $error) {