wip account states
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user