Changeset 2678957
- Timestamp:
- 02/15/2022 10:18:05 AM (4 years ago)
- Location:
- napps
- Files:
-
- 54 added
- 4 edited
-
tags/1.0.3 (added)
-
tags/1.0.3/composer.json (added)
-
tags/1.0.3/composer.lock (added)
-
tags/1.0.3/includes (added)
-
tags/1.0.3/includes/class-auth.php (added)
-
tags/1.0.3/includes/class-core.php (added)
-
tags/1.0.3/includes/class-exclusivecoupons.php (added)
-
tags/1.0.3/includes/class-setup.php (added)
-
tags/1.0.3/includes/class-smartbanner.php (added)
-
tags/1.0.3/includes/class-woocommerce.php (added)
-
tags/1.0.3/index.php (added)
-
tags/1.0.3/napps.php (added)
-
tags/1.0.3/phpcs.xml (added)
-
tags/1.0.3/public (added)
-
tags/1.0.3/public/css (added)
-
tags/1.0.3/public/css/napps.css (added)
-
tags/1.0.3/public/css/smartbanner.min.css (added)
-
tags/1.0.3/public/fonts (added)
-
tags/1.0.3/public/fonts/Montserrat-Medium.ttf (added)
-
tags/1.0.3/public/fonts/Montserrat-Regular.ttf (added)
-
tags/1.0.3/public/images (added)
-
tags/1.0.3/public/images/google-play-get.png (added)
-
tags/1.0.3/public/images/napps-logo.svg (added)
-
tags/1.0.3/public/images/star.svg (added)
-
tags/1.0.3/public/images/welcome_background.svg (added)
-
tags/1.0.3/public/js (added)
-
tags/1.0.3/public/js/smartbanner.min.js (added)
-
tags/1.0.3/readme.txt (added)
-
tags/1.0.3/vendor (added)
-
tags/1.0.3/vendor/autoload.php (added)
-
tags/1.0.3/vendor/composer (added)
-
tags/1.0.3/vendor/composer/ClassLoader.php (added)
-
tags/1.0.3/vendor/composer/InstalledVersions.php (added)
-
tags/1.0.3/vendor/composer/LICENSE (added)
-
tags/1.0.3/vendor/composer/autoload_classmap.php (added)
-
tags/1.0.3/vendor/composer/autoload_namespaces.php (added)
-
tags/1.0.3/vendor/composer/autoload_psr4.php (added)
-
tags/1.0.3/vendor/composer/autoload_real.php (added)
-
tags/1.0.3/vendor/composer/autoload_static.php (added)
-
tags/1.0.3/vendor/composer/installed.json (added)
-
tags/1.0.3/vendor/composer/installed.php (added)
-
tags/1.0.3/vendor/composer/platform_check.php (added)
-
tags/1.0.3/vendor/firebase (added)
-
tags/1.0.3/vendor/firebase/php-jwt (added)
-
tags/1.0.3/vendor/firebase/php-jwt/LICENSE (added)
-
tags/1.0.3/vendor/firebase/php-jwt/README.md (added)
-
tags/1.0.3/vendor/firebase/php-jwt/composer.json (added)
-
tags/1.0.3/vendor/firebase/php-jwt/src (added)
-
tags/1.0.3/vendor/firebase/php-jwt/src/BeforeValidException.php (added)
-
tags/1.0.3/vendor/firebase/php-jwt/src/ExpiredException.php (added)
-
tags/1.0.3/vendor/firebase/php-jwt/src/JWK.php (added)
-
tags/1.0.3/vendor/firebase/php-jwt/src/JWT.php (added)
-
tags/1.0.3/vendor/firebase/php-jwt/src/Key.php (added)
-
tags/1.0.3/vendor/firebase/php-jwt/src/SignatureInvalidException.php (added)
-
trunk/includes/class-core.php (modified) (2 diffs)
-
trunk/includes/class-smartbanner.php (modified) (2 diffs)
-
trunk/napps.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
napps/trunk/includes/class-core.php
r2672465 r2678957 7 7 8 8 namespace NAPPS; 9 10 use Exception; 9 11 use WP_REST_Request; 10 12 use WP_REST_Response; … … 35 37 36 38 if($orderID == null || !$customer) { 37 return new WP_REST_Response("You are not authenticated", 401); 39 wp_redirect(home_url('/napps/order/failed')); 40 exit; 38 41 } 39 42 40 43 $order = wc_get_order($orderID); 41 44 if(!$order || $customer != $order->get_customer_id()) { 42 return new WP_REST_Response("You dont have access to pay this order", 401); 45 wp_redirect(home_url('/napps/order/failed')); 46 exit; 43 47 } 44 48 45 if($order && $order->has_status( 'pending' )) { 46 $pay_now_url = $order->get_checkout_payment_url(); 47 $pay_now_url = $order->get_checkout_payment_url(); 48 49 wp_clear_auth_cookie(); 50 wp_set_current_user( $customer ); 51 wp_set_auth_cookie($customer, true, is_ssl()); 52 wp_redirect($pay_now_url); 49 if($order && ( $order->has_status( 'pending' ) || $order->has_status( 'unpaid' ) )) { 50 51 try { 52 // Retrieve order payment url 53 $pay_now_url = wc_get_endpoint_url( 'order-pay', $orderID, wc_get_checkout_url() ); 54 $pay_now_url = add_query_arg( 55 array( 56 'pay_for_order' => 'true', 57 'key' => $order->get_order_key(), 58 ), 59 $pay_now_url 60 ); 61 62 // Auth current customer based on his jwt token 63 wp_clear_auth_cookie(); 64 wp_set_current_user( $customer ); 65 wp_set_auth_cookie($customer, true, is_ssl()); 66 67 // Redirect to payment page 68 wp_redirect($pay_now_url); 69 exit; 70 } catch(Exception $ex) { 71 wp_redirect(home_url('/napps/order/failed')); 72 exit; 73 } 53 74 54 75 } else { 55 return new WP_REST_Response(null, 404); 76 wp_redirect(home_url('/napps/order/failed')); 77 exit; 56 78 } 57 79 } -
napps/trunk/includes/class-smartbanner.php
r2672465 r2678957 154 154 public function smartbanner_info( WP_REST_Request $request ) { 155 155 156 157 156 $user = get_current_user_id(); 158 157 if(!$user || !current_user_can("manage_woocommerce")) { … … 325 324 } 326 325 326 $fileNameSplit = explode('.',$file['name']); 327 $file_ext = end($fileNameSplit); 328 327 329 // Check valid extension 328 $file_ext =strtolower(end(explode('.',$file['name'])));329 $extensions = array("jpeg","jpg","png");330 $file_ext = strtolower($file_ext); 331 $extensions = array("jpeg","jpg","png"); 330 332 if(in_array($file_ext,$extensions) === false){ 331 333 return false; -
napps/trunk/napps.php
r2672465 r2678957 3 3 * Plugin Name: NAPPS 4 4 * Description: Plugin to complement the napps E-commerce solution. More on https://napps.pt 5 * Version: 1.0. 25 * Version: 1.0.3 6 6 * Author: NAPPS 7 7 * Author URI: https://napps.pt … … 36 36 define( 'NAPPS_PLUGIN_DIR_URL', plugin_dir_url( __FILE__ ) ); 37 37 define( 'NAPPS_PLUGIN_FILE', __FILE__ ); 38 define( 'NAPPS_VERSION', '1.0. 2' );38 define( 'NAPPS_VERSION', '1.0.3' ); 39 39 define( 'NAPPS_REST_PREFIX', 'napps/v1' ); 40 40 -
napps/trunk/readme.txt
r2672465 r2678957 5 5 Requires at least: 4.7 6 6 Tested up to: 5.8 7 Stable tag: 1.0. 27 Stable tag: 1.0.3 8 8 Requires PHP: 5.6 9 9 License: GPLv2 … … 77 77 == Changelog == 78 78 79 = 1.0.3 = 80 81 * Fix - Order redirect page 82 79 83 = 1.0.2 = 80 84
Note: See TracChangeset
for help on using the changeset viewer.