Changeset 2874519
- Timestamp:
- 03/03/2023 11:18:07 PM (3 years ago)
- Location:
- fygaro/trunk
- Files:
-
- 2 edited
-
Fygaro_WC_gateway_0_0_1.php (modified) (7 diffs)
-
Readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
fygaro/trunk/Fygaro_WC_gateway_0_0_1.php
r2827864 r2874519 6 6 * Author: Fygaro 7 7 * Author URI: http://www.fygaro.com 8 * Version: 0.0. 38 * Version: 0.0.4 9 9 * 10 10 … … 36 36 $this->method_title = 'Fygaro'; 37 37 $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 page38 $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 39 39 40 40 $this->supports = array( … … 52 52 $this->private_key = $this->testmode ? $this->get_option( 'test_private_key' ) : $this->get_option( 'private_key' ); 53 53 $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' ); 54 55 $this->base_url = $this->get_option( 'base_url' ); 55 56 … … 100 101 'type' => 'password' 101 102 ), 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 ), 102 110 'base_url' => array( 103 111 'title' => 'Button URL', … … 157 165 $private_key = $this->private_key; 158 166 167 //Get JWT Expiration 168 $exp_date = $this->exp_date; 169 159 170 //Update language 160 171 … … 181 192 */ 182 193 194 //Define NBF date 195 $jwtNBF = time(); 196 183 197 // Create token header as a JSON string 184 198 $header = json_encode(['typ' => 'JWT', 'alg' => 'HS256', 'kid' => $public_key]); 185 199 186 200 // 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 } 188 208 189 209 // Encode Header to Base64Url String … … 209 229 210 230 ); 231 232 /*Include generated link and JWT as an order note for future use */ 233 234 $order->add_order_note( $base_url."?jwt=".$jwt ); 211 235 212 236 /* -
fygaro/trunk/Readme.txt
r2827864 r2874519 3 3 Requires at least: 4.7 4 4 Tested up to: 6.1.1 5 Stable tag: 0.0. 35 Stable tag: 0.0.4 6 6 Contributors: fygaro 7 7 Requires PHP: 7.0 … … 63 63 * Security Upgrade 64 64 65 = 0.0.4 = 66 * General improvements. 67 * Order payment link log. 68 * Security Upgrades. 69 65 70 66 71 == Upgrade Notice == … … 76 81 * General improvements. 77 82 * Security Upgrade 83 84 = 0.0.4 = 85 * New features. 86 * Security Upgrades
Note: See TracChangeset
for help on using the changeset viewer.