diff --git a/plugins/cipf_plugin/php/paypal/update_user_payment.php b/plugins/cipf_plugin/php/paypal/update_user_payment.php index 6e6cd18..b793d4b 100644 --- a/plugins/cipf_plugin/php/paypal/update_user_payment.php +++ b/plugins/cipf_plugin/php/paypal/update_user_payment.php @@ -130,6 +130,7 @@ function failure_payment_for_user_CIPF($user_id, $order_id, $status) { PLGNTLS_class::debug_infos(); $acf_card_state = PLGNTLS_class::ACF_CARD_STATE; + $acf_account_state = PLGNTLS_class::ACF_ACCOUNT_STATE; $acf_card_expiration = PLGNTLS_class::ACF_CARD_EXPIRATION; $card_duration = PLGNTLS_class::CARD_VALIDITY_TIME; $prof_is_activ = PLGNTLS_class::ACF_PROF_IS_ACTIV; @@ -159,10 +160,12 @@ function failure_payment_for_user_CIPF($user_id, $order_id, $status) { /* * other changes on user : - * - pofil is inactive + * //- pofil is inactive + * - account_stat is to_pay * */ - update_field($prof_is_activ['_name'], $prof_is_activ['inactiv'], $acf_id); + //update_field($prof_is_activ['_name'], $prof_is_activ['inactiv'], $acf_id); + update_field($acf_account_state['_name'], $acf_account_state['to_pay'], $acf_id); } @@ -174,6 +177,7 @@ function validate_payment_for_user_CIPF($user_id, $order_id) { PLGNTLS_class::debug_infos(); $acf_card_state = PLGNTLS_class::ACF_CARD_STATE; + $acf_account_state = PLGNTLS_class::ACF_ACCOUNT_STATE; $acf_card_expiration = PLGNTLS_class::ACF_CARD_EXPIRATION; $acf_card_number = PLGNTLS_class::ACF_CARD_NUMBER; $card_duration = PLGNTLS_class::CARD_VALIDITY_TIME; @@ -256,13 +260,14 @@ function validate_payment_for_user_CIPF($user_id, $order_id) { /* * change user : - * - profile is active - * - card state is renewal + * //- profile is active * - payement status is success + * - account_state is valid * */ - update_field($prof_is_activ['_name'], $prof_is_activ['activ'], $acf_id); + //update_field($prof_is_activ['_name'], $prof_is_activ['activ'], $acf_id); update_field($acf_payment_status['_name'], $acf_payment_status['success'], $acf_id); + update_field($acf_account_state['_name'], $acf_account_state['valid'], $acf_id); /* * reset some fields for the form to buy the card diff --git a/plugins/cipf_plugin/php/profs_form.php b/plugins/cipf_plugin/php/profs_form.php index 098ad35..d8fe1f0 100644 --- a/plugins/cipf_plugin/php/profs_form.php +++ b/plugins/cipf_plugin/php/profs_form.php @@ -12,15 +12,21 @@ if (!defined('ABSPATH')) { /* -* when form is validated, reset some fields +* when form is validated +* - reset some fields +* - change account state * */ function prof_form_reset_fields_CIPF($form_id, $post_array, $form_type) { PLGNTLS_class::debug_infos(); $acf_cgv = PLGNTLS_class::ACF_PROF_CGV; + $acf_account_state = PLGNTLS_class::ACF_ACCOUNT_STATE; $user_id = get_current_user_id(); - update_field($acf_cgv['_name'], array(""), 'user_'.$user_id); + $acf_id = 'user_'.$user_id; + + update_field($acf_cgv['_name'], array(""), $acf_id); + update_field($acf_account_state['_name'], $acf_account_state['to_pay'], $acf_id); } //add_action('df_before_process', 'prof_form_reset_fields_CIPF', 10, 3); add_action('df_after_process', 'prof_form_reset_fields_CIPF', 10, 3); diff --git a/plugins/cipf_plugin/php/profs_profil.php b/plugins/cipf_plugin/php/profs_profil.php index 2ff01b5..295ae40 100644 --- a/plugins/cipf_plugin/php/profs_profil.php +++ b/plugins/cipf_plugin/php/profs_profil.php @@ -43,13 +43,13 @@ function handle_prof_is_activ_CIPF($author_id) { * if prof is activ * redirect to waiting page * - */ $redirection_prof_inactiv = home_url() . '/' . $slug_wait_activation; // Set up nocache headers before redirecting : https://developer.wordpress.org/reference/functions/wp_safe_redirect/#user-contributed-notes nocache_headers(); wp_redirect($redirection_prof_inactiv, 301); exit; + */ } diff --git a/plugins/cipf_plugin/utils/plgntls_class.php b/plugins/cipf_plugin/utils/plgntls_class.php index 7a8ca63..1003d4e 100644 --- a/plugins/cipf_plugin/utils/plgntls_class.php +++ b/plugins/cipf_plugin/utils/plgntls_class.php @@ -70,6 +70,7 @@ class PLGNTLS_class { const ACF_CARD_NUMBER = ['_name'=>'numero_de_la_carte']; // number 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'=>'en attente', 'expired'=>'carte expiree', ]; // META const META_PAYEMENT_STATUS = 'cipf_payement_status'; @@ -82,7 +83,7 @@ class PLGNTLS_class { const SLUG_PAYPAL_REDIRECTION_SUCCESS = self::SLUG_PAGE_REDIRECTION; const SLUG_PAYPAL_REDIRECTION_FAILURE = self::SLUG_PAGE_REDIRECTION; const SLUG_ADMIN_VALIDATE_PROF = 'admin_activate_prof_cipf'; // for admin_modif_prof.php - const SLUG_PARTNER_REGISTRATION = 'creation-du-compte-partenaire'; + const SLUG_PARTNER_REGISTRATION = 'compte-partenaire'; // URL const URL_BASE_REST_ROUTE = 'cipf_plugin/api/v1'; // for routes, in php/paypal/routes.php && php/admin_modif_prof.php // QUERY