diff --git a/plugins/cipf_plugin/php/paypal/payment_page.php b/plugins/cipf_plugin/php/paypal/payment_page.php index 96ab4d1..694b175 100644 --- a/plugins/cipf_plugin/php/paypal/payment_page.php +++ b/plugins/cipf_plugin/php/paypal/payment_page.php @@ -91,4 +91,3 @@ add_action('wp_enqueue_scripts', 'payment_page_scripts_CIPF'); ?> - diff --git a/plugins/cipf_plugin/php/profs_form.php b/plugins/cipf_plugin/php/profs_form.php index ed5d97d..ebe9b77 100644 --- a/plugins/cipf_plugin/php/profs_form.php +++ b/plugins/cipf_plugin/php/profs_form.php @@ -28,7 +28,7 @@ function prof_after_form_CIPF($form_id, $post_array, $form_type) { * reset cgv * */ - update_field($acf_cgv['_key'], array(""), $acf_id); + update_field($acf_cgv['_name'], array(""), $acf_id); /* diff --git a/plugins/cipf_plugin/php/profs_profil.php b/plugins/cipf_plugin/php/profs_profil.php index e12227a..d20920a 100644 --- a/plugins/cipf_plugin/php/profs_profil.php +++ b/plugins/cipf_plugin/php/profs_profil.php @@ -125,6 +125,7 @@ function prof_profil_check_CIPF() { /* * in case event didn't fire, change account to expire here + * also check for waiting transfert : valid -> invalid * */ if (card_date_exists_CIPF()) { @@ -132,6 +133,9 @@ function prof_profil_check_CIPF() { if (!is_account_expired_CIPF()) { set_account_expired_CIPF(); } + if (is_account_waiting_valid_CIPF()) { + set_account_waiting_invalid_CIPF(); + } } } } diff --git a/plugins/cipf_plugin/php/profs_states.php b/plugins/cipf_plugin/php/profs_states.php index 3c81825..441c2eb 100644 --- a/plugins/cipf_plugin/php/profs_states.php +++ b/plugins/cipf_plugin/php/profs_states.php @@ -14,16 +14,14 @@ if (!defined('ABSPATH')) { * 1. new . 'nouveau prof' -> ok 1/1 : [1: at inscription - ok] * 2. to_pay . 'doit payer' -> ko 3/4 : [1: after form & new - ok], [2: after form choose paypal & expired - ok], [3: after payment failed - ok], [4: after transfert failed - ko] * 3. valid . 'carte valide' -> ko 1/2 : [1: after payment success - ok], [2: after transfert success - ko] -* 4. expired . 'carte expiree' -> ko 1/2 : [1: when prof access profil & expired - ok], [2: when event card expired fire - ko] +* 4. waiting_invalid . 'en attente invalide' -> ko 3/4 : [1: after form choose transfert & expired - ok], [2: after card changes to expired & was waiting valid - ok], [3: verify at prof profil page - ok], [4: when event for expire fire - ko] +* 5. waiting_valid . 'en attente valide' -> ok 1/1 : [1: after form choose transfert & not expired - ok] +* 6. expired . 'carte expiree' -> ko 1/2 : [1: when prof access profil & expired - ok], [2: when event card expired fire - ko] * * [/] etat carte ('etat_carte') : * - 'Commande' -> ok 1/1 : [1: at inscription - ok] * - 'Renouvellement' -> ko 1/1 : [1: after succees payement - ok] * -* [/] etat virement ('etat_virement') : -* - 'en attente' -> ko 0/1 : [1: after form validation $ transfert choose - ok] -* - 'reçu' -> ko 0/1 : [1: after admin change it from front - ko] -* * [ ] activation du compte ('compte-actif') : * - 'Actif' -> equivalent a etat compte [3] carte valide * - 'Inactif' -> equivalent a etat compte [2] doit payer @@ -62,6 +60,9 @@ function get_field_init_CIPF($acf_field_name, $acf_id) { $default = $acf_object['default_value']; if (empty($default)) { $choices = $acf_object['choices']; + if (!is_array($choices)) { + return false; + } $default = reset($choices); } update_field($acf_field_name, $default, $acf_id); @@ -213,7 +214,7 @@ function is_card_new_CIPF($user_id = null) { } function is_card_renew_CIPF($user_id = null) { PLGNTLS_class::debug_infos(); - $acf_card_payment_method = PLGNTLS_class::ACF_CARD_PAYMENT_METHOD; + $acf_card_state = PLGNTLS_class::ACF_CARD_STATE; return is_acf_state_CIPF($user_id, $acf_card_state, 'renew'); } function set_card_new_CIPF($user_id = null) { @@ -223,7 +224,7 @@ function set_card_new_CIPF($user_id = null) { } function set_card_renew_CIPF($user_id = null) { PLGNTLS_class::debug_infos(); - $acf_card_payment_method = PLGNTLS_class::ACF_CARD_PAYMENT_METHOD; + $acf_card_state = PLGNTLS_class::ACF_CARD_STATE; set_acf_state_CIPF($user_id, $acf_card_state, 'renew'); } @@ -314,35 +315,6 @@ function set_payment_nothing_CIPF($user_id = null) { -/* -* etat virement ('etat_virement') : -* - 'en attente' -* - 'reçu' -* -*/ -function is_transfert_waiting_CIPF($user_id = null) { - PLGNTLS_class::debug_infos(); - $acf_transfert_state = PLGNTLS_class::ACF_TRANSFERT_STATE; - return is_acf_state_CIPF($user_id, $acf_transfert_state, 'waiting'); -} -function is_transfert_done_CIPF($user_id = null) { - PLGNTLS_class::debug_infos(); - $acf_transfert_state = PLGNTLS_class::ACF_TRANSFERT_STATE; - return is_acf_state_CIPF($user_id, $acf_transfert_state, 'done'); -} -function set_transfert_waiting_CIPF($user_id = null) { - PLGNTLS_class::debug_infos(); - $acf_transfert_state = PLGNTLS_class::ACF_TRANSFERT_STATE; - set_acf_state_CIPF($user_id, $acf_transfert_state, 'waiting'); -} -function set_transfert_done_CIPF($user_id = null) { - PLGNTLS_class::debug_infos(); - $acf_transfert_state = PLGNTLS_class::ACF_TRANSFERT_STATE; - set_acf_state_CIPF($user_id, $acf_transfert_state, 'done'); -} - - - /* diff --git a/plugins/cipf_plugin/utils/plgntls_class.php b/plugins/cipf_plugin/utils/plgntls_class.php index 625d15a..253887d 100644 --- a/plugins/cipf_plugin/utils/plgntls_class.php +++ b/plugins/cipf_plugin/utils/plgntls_class.php @@ -71,7 +71,6 @@ class PLGNTLS_class { const ACF_CARD_EXPIRATION = ['_name'=>'fin_de_validite']; // date picker const ACF_CARD_PAYMENT_STATE = ['_name'=>'etat_paiement', 'started'=>'en_cours', 'success'=>'reussi', 'failure'=>'echec', 'nothing'=>'aucun']; // radio button const ACF_ACCOUNT_STATE = ['_name'=>'etat_compte', 'new'=>'nouveau prof', 'to_pay'=>'doit payer', 'valid'=>'carte valide', 'waiting_invalid'=>'en attente invalide', 'waiting_valid'=>'en attente valide', 'expired'=>'carte expiree']; - const ACF_TRANSFERT_STATE = ['_name'=>'etat_virement', 'waiting'=>'en attente', 'done'=>'reçu']; // META const META_PAYEMENT_STATUS = 'cipf_payement_status';