update payment validation by changing prof to active

This commit is contained in:
asus
2024-03-07 19:21:11 +01:00
parent afd34e5296
commit 5e28bf3059

View File

@@ -81,8 +81,8 @@ function validate_payment_for_user_FIPF($user_id, $order_id) {
$acf_card_state = PLGNTLS_class::ACF_CARD_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;
error_log("---");
$acf_date_format = 'Y-m-d H:i:s';
$acf_id = 'user_'.$user_id;
@@ -108,16 +108,13 @@ error_log("---");
$current_date_limit_object = get_field_object($acf_card_expiration, $acf_id);
if ($current_date_limit_object === false) {
error_log("current_date_limit_object === false");
$current_date_limit = $date_now;
}
else if (empty($current_date_limit_object['value'])) {
error_log("empty current_date_limit_object['value']");
$current_date_limit = $date_now;
}
else
{
error_log("else");
$current_date_limit_string = $current_date_limit_object['value'];
$current_format_field = $current_date_limit_object['return_format'];
// compare 2 dates : https://stackoverflow.com/q/8722806/9497573
@@ -135,11 +132,14 @@ error_log("---");
* update date limit validity to add 1 year
*
*/
error_log("current_date_limit");
error_log($current_date_limit);
$date_plus_one_year = $current_date_limit->add(date_interval_create_from_date_string('+'.$card_duration));;
update_field($acf_card_expiration, $date_plus_one_year->format($acf_date_format), $acf_id);
/*
* change user profil to active
*
*/
update_field($prof_is_activ, 'Active', $acf_id)
}