card number id created
This commit is contained in:
@@ -174,7 +174,7 @@ function validate_payment_for_user_CIPF($user_id, $order_id) {
|
|||||||
PLGNTLS_class::debug_infos();
|
PLGNTLS_class::debug_infos();
|
||||||
$acf_card_state = PLGNTLS_class::ACF_CARD_STATE;
|
$acf_card_state = PLGNTLS_class::ACF_CARD_STATE;
|
||||||
$acf_card_expiration = PLGNTLS_class::ACF_CARD_EXPIRATION;
|
$acf_card_expiration = PLGNTLS_class::ACF_CARD_EXPIRATION;
|
||||||
// $acf_prof_can_renew = PLGNTLS_class::ACF_PROF_CAN_RENEW;
|
$acf_card_number = PLGNTLS_class::ACF_CARD_NUMBER;
|
||||||
$card_duration = PLGNTLS_class::CARD_VALIDITY_TIME;
|
$card_duration = PLGNTLS_class::CARD_VALIDITY_TIME;
|
||||||
$prof_is_activ = PLGNTLS_class::ACF_PROF_IS_ACTIV;
|
$prof_is_activ = PLGNTLS_class::ACF_PROF_IS_ACTIV;
|
||||||
$acf_payment_status = PLGNTLS_class::ACF_CARD_PAYMENT_STATE;
|
$acf_payment_status = PLGNTLS_class::ACF_CARD_PAYMENT_STATE;
|
||||||
@@ -197,12 +197,6 @@ function validate_payment_for_user_CIPF($user_id, $order_id) {
|
|||||||
|
|
||||||
$date_now = date_create('today');
|
$date_now = date_create('today');
|
||||||
|
|
||||||
/*
|
|
||||||
* update purchase date to now
|
|
||||||
*
|
|
||||||
update_field(CARD_DATE_PURCHASE, $date_now, $acf_id);
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* get current date limit
|
* get current date limit
|
||||||
* if no date, use now
|
* if no date, use now
|
||||||
@@ -239,6 +233,20 @@ function validate_payment_for_user_CIPF($user_id, $order_id) {
|
|||||||
$date_plus_one_year = $current_date_limit->add(date_interval_create_from_date_string('+'.$card_duration));
|
$date_plus_one_year = $current_date_limit->add(date_interval_create_from_date_string('+'.$card_duration));
|
||||||
update_field($acf_card_expiration['_name'], $date_plus_one_year->format($acf_date_format), $acf_id);
|
update_field($acf_card_expiration['_name'], $date_plus_one_year->format($acf_date_format), $acf_id);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* - if card status is command, create card id
|
||||||
|
* - make card status to renewal
|
||||||
|
*/
|
||||||
|
$card_status = get_field($acf_card_state['_name'], $acf_id);
|
||||||
|
if ($card_status === $acf_card_state['new']) {
|
||||||
|
$card_id = $date_now->format('Ymd') . $user_id;
|
||||||
|
error_log("-------");
|
||||||
|
error_log("card_id");
|
||||||
|
error_log($card_id);
|
||||||
|
update_field($acf_card_number['_name'], $card_id, $acf_id);
|
||||||
|
}
|
||||||
|
update_field($acf_card_state['_name'], $acf_card_state['renew'], $acf_id);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* change user :
|
* change user :
|
||||||
* - profile is active
|
* - profile is active
|
||||||
@@ -247,7 +255,6 @@ function validate_payment_for_user_CIPF($user_id, $order_id) {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
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_card_state['_name'], $acf_card_state['renew'], $acf_id);
|
|
||||||
update_field($acf_payment_status['_name'], $acf_payment_status['success'], $acf_id);
|
update_field($acf_payment_status['_name'], $acf_payment_status['success'], $acf_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,10 +55,10 @@ function check_can_pay_CIPF() {
|
|||||||
*/
|
*/
|
||||||
$price = get_field($acf_card_price_total['_name'], $acf_id);
|
$price = get_field($acf_card_price_total['_name'], $acf_id);
|
||||||
if (empty($price)) {
|
if (empty($price)) {
|
||||||
return WP_Error('cannot_purchase', "no price selected");
|
return new WP_Error('cannot_purchase', "no price selected");
|
||||||
}
|
}
|
||||||
if ($price === 0) {
|
if ($price === 0) {
|
||||||
return WP_Error('cannot_purchase', "price is 0, nothing to purchase");
|
return new WP_Error('cannot_purchase', "price is 0, nothing to purchase");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ function check_can_pay_CIPF() {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// date end of validity is in more than renew perdio (ex: 3 month)
|
// date end of validity is in more than renew perdio (ex: 3 month)
|
||||||
return WP_Error('cannot_purchase', "it's too soon to renew your card");
|
return new WP_Error('cannot_purchase', "it's too soon to renew your card");
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -67,9 +67,8 @@ class PLGNTLS_class
|
|||||||
const ACF_CARD_PRICE_DELIVERY = ['_name'=>'livraison', 'pdf'=>'PDF', 'post'=>'Fabrication']; // radio button
|
const ACF_CARD_PRICE_DELIVERY = ['_name'=>'livraison', 'pdf'=>'PDF', 'post'=>'Fabrication']; // radio button
|
||||||
const ACF_PROF_IS_ACTIV = ['_name'=>'compte-actif', 'activ'=>'Actif', 'inactiv'=>'Inactif']; // radio button
|
const ACF_PROF_IS_ACTIV = ['_name'=>'compte-actif', 'activ'=>'Actif', 'inactiv'=>'Inactif']; // radio button
|
||||||
const ACF_PROF_CGV = ['_name'=>'cgv', 'cgv'=>'cgv']; // checkbox
|
const ACF_PROF_CGV = ['_name'=>'cgv', 'cgv'=>'cgv']; // checkbox
|
||||||
// const ACF_PROF_CAN_RENEW = ['_name'=>'renouvellement_possible', 'can'=>true, 'cannot'=>false]; // true/false
|
|
||||||
const ACF_CARD_PRICE_TOTAL = ['_name'=>'somme_a_regler']; // number
|
const ACF_CARD_PRICE_TOTAL = ['_name'=>'somme_a_regler']; // number
|
||||||
const ACF_CARD_CARD_NUMBER = ['_name'=>'numero_de_la_carte']; // number
|
const ACF_CARD_NUMBER = ['_name'=>'numero_de_la_carte']; // number
|
||||||
const ACF_CARD_EXPIRATION = ['_name'=>'fin_de_validite']; // date picker
|
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_CARD_PAYMENT_STATE = ['_name'=>'etat_paiement', 'started'=>'en_cours', 'success'=>'reussi', 'failure'=>'echec', 'nothing'=>'aucun']; // radio button
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user