Plugin Directory

Changeset 2543847


Ignore:
Timestamp:
06/07/2021 05:56:36 PM (5 years ago)
Author:
transact
Message:

version 5.4.1: fix for gift subscriptions

Location:
transact
Files:
3 edited
15 copied

Legend:

Unmodified
Added
Removed
  • transact/tags/5.4.1/frontend/controllers/account_meta.php

    r2420344 r2543847  
    8383                    // if the subscription needs to be re-validated, check to see if they still have a subscription on xsact
    8484                    $valid = $this->refresh_subscription($user_id, $subscription_info, $post_id);
     85
    8586                    return $valid;
    8687                }
     
    187188            }
    188189            $this->subscription_info_meta = $new_subscription_info;
     190
     191            return true;
     192        } else {
     193            return false;
    189194        }
    190195    }
  • transact/tags/5.4.1/frontend/controllers/transact-single-post.php

    r2439226 r2543847  
    413413                return new WP_REST_Response( $response, 200 );
    414414            }
    415 
     415           
    416416            /**
    417417             * If it is a subscription, create a subscription record
    418418             */
     419            $subscription_success = false;
    419420            if (isset($decoded->sub) && ($decoded->sub)) {
    420421                $tableModel = new transactSubscriptionTransactionsModel();
     
    423424
    424425                // Record the subscription in the user account meta
    425                 $accountMeta->add_subscription($post_id, $decoded->sub_expires, $decoded->uid, $decoded->iat * 1000, $wp_userid);
     426                $subscription_success = $accountMeta->add_subscription($post_id, $decoded->sub_expires, $decoded->uid, $decoded->iat * 1000, $wp_userid);
    426427            /**
    427428             * If it is an ala carte purchase, create a transaction record
    428429             */
    429             } else if (isset($post_id)) {
     430            }
     431           
     432            if (!$subscription_success && isset($post_id)) {
    430433                $tableModel = new transactTransactionsModel();
    431434                $tableModel->create_transaction($post_id, $decoded->uid, $decoded->iat);
  • transact/tags/5.4.1/readme.txt

    r2439226 r2543847  
    55Requires at least: 5.0
    66Requires PHP: 5.6
    7 Tested up to: 5.6.0
    8 Stable tag: 5.4.0
     7Tested up to: 5.7.2
     8Stable tag: 5.4.1
    99License: APACHE-2.0
    1010License URI: https://www.apache.org/licenses/LICENSE-2.0
     
    8383
    8484
     85= 5.4.1 =
     86* Fix validation of gift subscriptions
     87
    8588= 5.4.0 =
    8689* Add tags for Google Tag Manager
  • transact/trunk/frontend/controllers/account_meta.php

    r2420344 r2543847  
    8383                    // if the subscription needs to be re-validated, check to see if they still have a subscription on xsact
    8484                    $valid = $this->refresh_subscription($user_id, $subscription_info, $post_id);
     85
    8586                    return $valid;
    8687                }
     
    187188            }
    188189            $this->subscription_info_meta = $new_subscription_info;
     190
     191            return true;
     192        } else {
     193            return false;
    189194        }
    190195    }
  • transact/trunk/frontend/controllers/transact-single-post.php

    r2439226 r2543847  
    413413                return new WP_REST_Response( $response, 200 );
    414414            }
    415 
     415           
    416416            /**
    417417             * If it is a subscription, create a subscription record
    418418             */
     419            $subscription_success = false;
    419420            if (isset($decoded->sub) && ($decoded->sub)) {
    420421                $tableModel = new transactSubscriptionTransactionsModel();
     
    423424
    424425                // Record the subscription in the user account meta
    425                 $accountMeta->add_subscription($post_id, $decoded->sub_expires, $decoded->uid, $decoded->iat * 1000, $wp_userid);
     426                $subscription_success = $accountMeta->add_subscription($post_id, $decoded->sub_expires, $decoded->uid, $decoded->iat * 1000, $wp_userid);
    426427            /**
    427428             * If it is an ala carte purchase, create a transaction record
    428429             */
    429             } else if (isset($post_id)) {
     430            }
     431           
     432            if (!$subscription_success && isset($post_id)) {
    430433                $tableModel = new transactTransactionsModel();
    431434                $tableModel->create_transaction($post_id, $decoded->uid, $decoded->iat);
  • transact/trunk/readme.txt

    r2439226 r2543847  
    55Requires at least: 5.0
    66Requires PHP: 5.6
    7 Tested up to: 5.6.0
    8 Stable tag: 5.4.0
     7Tested up to: 5.7.2
     8Stable tag: 5.4.1
    99License: APACHE-2.0
    1010License URI: https://www.apache.org/licenses/LICENSE-2.0
     
    8383
    8484
     85= 5.4.1 =
     86* Fix validation of gift subscriptions
     87
    8588= 5.4.0 =
    8689* Add tags for Google Tag Manager
Note: See TracChangeset for help on using the changeset viewer.