Plugin Directory

Changeset 2919181


Ignore:
Timestamp:
05/30/2023 03:13:09 PM (3 years ago)
Author:
tripleatechnology
Message:

Updating to newer version 2.0.5

Location:
triplea-cryptocurrency-payment-gateway-for-woocommerce
Files:
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • triplea-cryptocurrency-payment-gateway-for-woocommerce/tags/2.0.5/includes/WooCommerce/TripleA_Payment_Gateway.php

    r2820420 r2919181  
    479479                );
    480480
     481                if(is_string($payment_form_data)){
     482                    $payment_form_data = json_decode($payment_form_data);
     483                }
     484
    481485                if (isset($payment_form_data->error) || !isset($payment_form_data->payment_reference)) {
    482486
     
    484488                    echo json_encode(
    485489                        [
    486                             'status'  => 'notok',
     490                            'status'  => 'failed',
    487491                            'code'    => isset($payment_form_data->code) ? $payment_form_data->code : 'Unknown error code.',
    488492                            'message' => isset($payment_form_data->message) ? $payment_form_data->message : 'Unknown error message.',
     
    587591        }
    588592    }
    589 
     593    private function refreshOauthTokensForForms($refresh_for_api_id = FALSE) {
     594
     595        $date_now          = (new DateTime())->getTimestamp();
     596        $date_expiry_limit = $date_now - 600;   // 10 minutes before expiry token
     597
     598        $new_token_data = $this->getOauthToken($this->clientID, $this->clientSecret);
     599        $this->logger->write_log( 'refreshOauthTokensForForms() OAuth token data received : ' . wc_print_r(json_encode($new_token_data), TRUE), $this->debugLog );
     600
     601        if ($new_token_data !== FALSE
     602            && isset($new_token_data->access_token)
     603            && !empty($new_token_data->access_token)
     604            && isset($new_token_data->expires_in)
     605            && !empty($new_token_data->expires_in)) {
     606            $this->oauthToken       = $new_token_data->access_token;
     607            $this->oauthTokenExpiry = $date_now + $new_token_data->expires_in;
     608            $this->update_option('oauth_token', $this->oauthToken);
     609            $this->update_option('oauth_token_expiry', $this->oauthTokenExpiry);
     610            $this->logger->write_log( 'refreshOauthTokensForForms() Obtained and saved a new oauth token.', $this->debugLog );
     611
     612            return $new_token_data->access_token;
     613        } else {
     614            $this->logger->write_log( 'refreshOauthTokensForForms() A problem happened, could not get a new oauth token. \n' . wc_print_r(json_encode($new_token_data), TRUE), $this->debugLog );
     615            $this->oauthToken       = NULL;
     616            $this->oauthTokenExpiry = NULL;
     617            $this->update_option('oauth_token', $this->oauthToken);
     618            $this->update_option('oauth_token_expiry', $this->oauthTokenExpiry);
     619
     620            return false;
     621        }
     622
     623    }
    590624    private function getOauthToken( $client_id, $client_secret ) {
    591625
     
    636670    ) {
    637671        $self = new TripleA_Payment_Gateway();
    638         $oauth_token = $this->get_option('oauth_token');
     672
     673        // Refresh oauth tokens, Actually generating new tokens
     674        $oauth_token = $self->refreshOauthTokensForForms();
    639675
    640676        if (empty($oauth_token)) {
     
    642678        }
    643679
    644         // Refresh oauth tokens
    645         $self->refreshOauthTokens();
     680
    646681
    647682        $post_url = 'https://api.triple-a.io/api/v2/payment';
  • triplea-cryptocurrency-payment-gateway-for-woocommerce/tags/2.0.5/readme.txt

    r2820420 r2919181  
    77Requires at least: 5.5
    88Tested up to: 6.1.1
    9 Stable tag: 2.0.4
     9Stable tag: 2.0.5
    1010Requires PHP: 7.0
    1111License: GPLv2 or later
     
    109109== Changelog ==
    110110
     111= 2.0.5 =
     112Fixed: Payment form loading after clicking "Pay with Cryptocurrency" issue fixed
     113
    111114= 2.0.4 =
    112115Removed: Payment Method description is removed
     
    261264== Upgrade Notice ==
    262265
     266= 2.0.5 =
     267Simply install the update. No further action is needed.
     268
    263269= 2.0.4 =
    264270Simply install the update. No further action is needed.
  • triplea-cryptocurrency-payment-gateway-for-woocommerce/tags/2.0.5/triplea-cryptocurrency-payment-gateway-for-woocommerce.php

    r2820420 r2919181  
    1717 * Plugin URI:        https://wordpress.org/plugins/triplea-cryptocurrency-payment-gateway-for-woocommerce/
    1818 * Description:       Offer cryptocurrency as a payment option on your website and get access to even more clients. Receive payments in cryptocurrency or in your local currency, directly in your bank account. Enjoy an easy setup, no cryptocurrency expertise required. Powered by TripleA.
    19  * Version:           2.0.4
     19 * Version:           2.0.5
    2020 * Author:            TripleA Team
    2121 * Author URI:        https://triple-a.io
     
    4545     * $var string
    4646     */
    47     const version = '2.0.4';
     47    const version = '2.0.5';
    4848
    4949    /*
  • triplea-cryptocurrency-payment-gateway-for-woocommerce/trunk/includes/WooCommerce/TripleA_Payment_Gateway.php

    r2820420 r2919181  
    479479                );
    480480
     481                if(is_string($payment_form_data)){
     482                    $payment_form_data = json_decode($payment_form_data);
     483                }
     484
    481485                if (isset($payment_form_data->error) || !isset($payment_form_data->payment_reference)) {
    482486
     
    484488                    echo json_encode(
    485489                        [
    486                             'status'  => 'notok',
     490                            'status'  => 'failed',
    487491                            'code'    => isset($payment_form_data->code) ? $payment_form_data->code : 'Unknown error code.',
    488492                            'message' => isset($payment_form_data->message) ? $payment_form_data->message : 'Unknown error message.',
     
    587591        }
    588592    }
    589 
     593    private function refreshOauthTokensForForms($refresh_for_api_id = FALSE) {
     594
     595        $date_now          = (new DateTime())->getTimestamp();
     596        $date_expiry_limit = $date_now - 600;   // 10 minutes before expiry token
     597
     598        $new_token_data = $this->getOauthToken($this->clientID, $this->clientSecret);
     599        $this->logger->write_log( 'refreshOauthTokensForForms() OAuth token data received : ' . wc_print_r(json_encode($new_token_data), TRUE), $this->debugLog );
     600
     601        if ($new_token_data !== FALSE
     602            && isset($new_token_data->access_token)
     603            && !empty($new_token_data->access_token)
     604            && isset($new_token_data->expires_in)
     605            && !empty($new_token_data->expires_in)) {
     606            $this->oauthToken       = $new_token_data->access_token;
     607            $this->oauthTokenExpiry = $date_now + $new_token_data->expires_in;
     608            $this->update_option('oauth_token', $this->oauthToken);
     609            $this->update_option('oauth_token_expiry', $this->oauthTokenExpiry);
     610            $this->logger->write_log( 'refreshOauthTokensForForms() Obtained and saved a new oauth token.', $this->debugLog );
     611
     612            return $new_token_data->access_token;
     613        } else {
     614            $this->logger->write_log( 'refreshOauthTokensForForms() A problem happened, could not get a new oauth token. \n' . wc_print_r(json_encode($new_token_data), TRUE), $this->debugLog );
     615            $this->oauthToken       = NULL;
     616            $this->oauthTokenExpiry = NULL;
     617            $this->update_option('oauth_token', $this->oauthToken);
     618            $this->update_option('oauth_token_expiry', $this->oauthTokenExpiry);
     619
     620            return false;
     621        }
     622
     623    }
    590624    private function getOauthToken( $client_id, $client_secret ) {
    591625
     
    636670    ) {
    637671        $self = new TripleA_Payment_Gateway();
    638         $oauth_token = $this->get_option('oauth_token');
     672
     673        // Refresh oauth tokens, Actually generating new tokens
     674        $oauth_token = $self->refreshOauthTokensForForms();
    639675
    640676        if (empty($oauth_token)) {
     
    642678        }
    643679
    644         // Refresh oauth tokens
    645         $self->refreshOauthTokens();
     680
    646681
    647682        $post_url = 'https://api.triple-a.io/api/v2/payment';
  • triplea-cryptocurrency-payment-gateway-for-woocommerce/trunk/readme.txt

    r2820420 r2919181  
    77Requires at least: 5.5
    88Tested up to: 6.1.1
    9 Stable tag: 2.0.4
     9Stable tag: 2.0.5
    1010Requires PHP: 7.0
    1111License: GPLv2 or later
     
    109109== Changelog ==
    110110
     111= 2.0.5 =
     112Fixed: Payment form loading after clicking "Pay with Cryptocurrency" issue fixed
     113
    111114= 2.0.4 =
    112115Removed: Payment Method description is removed
     
    261264== Upgrade Notice ==
    262265
     266= 2.0.5 =
     267Simply install the update. No further action is needed.
     268
    263269= 2.0.4 =
    264270Simply install the update. No further action is needed.
  • triplea-cryptocurrency-payment-gateway-for-woocommerce/trunk/triplea-cryptocurrency-payment-gateway-for-woocommerce.php

    r2820420 r2919181  
    1717 * Plugin URI:        https://wordpress.org/plugins/triplea-cryptocurrency-payment-gateway-for-woocommerce/
    1818 * Description:       Offer cryptocurrency as a payment option on your website and get access to even more clients. Receive payments in cryptocurrency or in your local currency, directly in your bank account. Enjoy an easy setup, no cryptocurrency expertise required. Powered by TripleA.
    19  * Version:           2.0.4
     19 * Version:           2.0.5
    2020 * Author:            TripleA Team
    2121 * Author URI:        https://triple-a.io
     
    4545     * $var string
    4646     */
    47     const version = '2.0.4';
     47    const version = '2.0.5';
    4848
    4949    /*
Note: See TracChangeset for help on using the changeset viewer.