Plugin Directory

Changeset 2874519


Ignore:
Timestamp:
03/03/2023 11:18:07 PM (3 years ago)
Author:
fygaro
Message:

Included payment button log feature and security upgrades

Location:
fygaro/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • fygaro/trunk/Fygaro_WC_gateway_0_0_1.php

    r2827864 r2874519  
    66 * Author: Fygaro
    77 * Author URI: http://www.fygaro.com
    8  * Version: 0.0.3
     8 * Version: 0.0.4
    99 *
    1010
     
    3636        $this->method_title = 'Fygaro';
    3737        $url = home_url();
    38         $this->method_description = 'Accept Secure Payments with Fygaro. <br><br> In Fygaro set the Hook URL to '.$url.'/?wc-api=fgwcb_webhook'; // will be displayed on the options page
     38        $this->method_description = 'Accept Secure Payments with Fygaro. <br><br> In Fygaro set the Hook URL to '.$url.'/?wc-api=fgwcb_webhook <br><br> If needed, contact support@fygaro.com for assistance.'; // will be displayed on the options page
    3939     
    4040        $this->supports = array(
     
    5252        $this->private_key = $this->testmode ? $this->get_option( 'test_private_key' ) : $this->get_option( 'private_key' );
    5353        $this->publishable_key = $this->testmode ? $this->get_option( 'test_publishable_key' ) : $this->get_option( 'publishable_key' );
     54        $this->exp_date = $this->get_option( 'exp_date' );
    5455        $this->base_url = $this->get_option( 'base_url' );
    5556
     
    100101                    'type'        => 'password'
    101102                ),
     103                'exp_date' => array(
     104                    'title'       => 'Expiration time',
     105                    'description' => 'Time in minutes during which the payment link is valid. Use 0 for unlimited.',
     106                    'type'        => 'number',
     107                    'value'     => '0',
     108                    'default'     => '0'
     109                ),
    102110                'base_url' => array(
    103111                    'title'       => 'Button URL',
     
    157165            $private_key = $this->private_key;
    158166
     167            //Get JWT Expiration
     168            $exp_date = $this->exp_date;
     169
    159170            //Update language
    160171
     
    181192             */
    182193
     194            //Define NBF date
     195            $jwtNBF = time();
     196
    183197            // Create token header as a JSON string
    184198            $header = json_encode(['typ' => 'JWT', 'alg' => 'HS256', 'kid' => $public_key]);
    185199
    186200            // Create token payload as a JSON string
    187             $payload = json_encode(['amount' => $total, 'currency' => $currency, 'custom_reference' => "".$order_id.""]);   
     201            $payload = json_encode(['nbf' => $jwtNBF,'amount' => $total, 'currency' => $currency, 'custom_reference' => "".$order_id.""]); 
     202           
     203            if($exp_date > 0){
     204               
     205
     206                $payload = json_encode(['exp' => strtotime( date('c',$jwtNBF)." + ".$exp_date." minutes" ),'nbf' => $jwtNBF,'amount' => $total, 'currency' => $currency, 'custom_reference' => "".$order_id.""]);   
     207            }
    188208
    189209            // Encode Header to Base64Url String
     
    209229         
    210230            );
     231
     232            /*Include generated link and JWT as an order note for future use */         
     233
     234            $order->add_order_note( $base_url."?jwt=".$jwt );
    211235         
    212236            /*
  • fygaro/trunk/Readme.txt

    r2827864 r2874519  
    33Requires at least: 4.7
    44Tested up to: 6.1.1
    5 Stable tag: 0.0.3
     5Stable tag: 0.0.4
    66Contributors: fygaro
    77Requires PHP: 7.0
     
    6363* Security Upgrade
    6464
     65= 0.0.4 =
     66* General improvements.
     67* Order payment link log.
     68* Security Upgrades.
     69
    6570
    6671== Upgrade Notice ==
     
    7681* General improvements.
    7782* Security Upgrade
     83
     84= 0.0.4 =
     85* New features.
     86* Security Upgrades
Note: See TracChangeset for help on using the changeset viewer.