Changeset 2703352
- Timestamp:
- 04/01/2022 01:39:16 PM (4 years ago)
- Location:
- napps
- Files:
-
- 54 added
- 5 edited
-
tags/1.0.4 (added)
-
tags/1.0.4/composer.json (added)
-
tags/1.0.4/composer.lock (added)
-
tags/1.0.4/includes (added)
-
tags/1.0.4/includes/class-auth.php (added)
-
tags/1.0.4/includes/class-core.php (added)
-
tags/1.0.4/includes/class-exclusivecoupons.php (added)
-
tags/1.0.4/includes/class-setup.php (added)
-
tags/1.0.4/includes/class-smartbanner.php (added)
-
tags/1.0.4/includes/class-woocommerce.php (added)
-
tags/1.0.4/index.php (added)
-
tags/1.0.4/napps.php (added)
-
tags/1.0.4/phpcs.xml (added)
-
tags/1.0.4/public (added)
-
tags/1.0.4/public/css (added)
-
tags/1.0.4/public/css/napps.css (added)
-
tags/1.0.4/public/css/smartbanner.min.css (added)
-
tags/1.0.4/public/fonts (added)
-
tags/1.0.4/public/fonts/Montserrat-Medium.ttf (added)
-
tags/1.0.4/public/fonts/Montserrat-Regular.ttf (added)
-
tags/1.0.4/public/images (added)
-
tags/1.0.4/public/images/google-play-get.png (added)
-
tags/1.0.4/public/images/napps-logo.svg (added)
-
tags/1.0.4/public/images/star.svg (added)
-
tags/1.0.4/public/images/welcome_background.svg (added)
-
tags/1.0.4/public/js (added)
-
tags/1.0.4/public/js/smartbanner.min.js (added)
-
tags/1.0.4/readme.txt (added)
-
tags/1.0.4/vendor (added)
-
tags/1.0.4/vendor/autoload.php (added)
-
tags/1.0.4/vendor/composer (added)
-
tags/1.0.4/vendor/composer/ClassLoader.php (added)
-
tags/1.0.4/vendor/composer/InstalledVersions.php (added)
-
tags/1.0.4/vendor/composer/LICENSE (added)
-
tags/1.0.4/vendor/composer/autoload_classmap.php (added)
-
tags/1.0.4/vendor/composer/autoload_namespaces.php (added)
-
tags/1.0.4/vendor/composer/autoload_psr4.php (added)
-
tags/1.0.4/vendor/composer/autoload_real.php (added)
-
tags/1.0.4/vendor/composer/autoload_static.php (added)
-
tags/1.0.4/vendor/composer/installed.json (added)
-
tags/1.0.4/vendor/composer/installed.php (added)
-
tags/1.0.4/vendor/composer/platform_check.php (added)
-
tags/1.0.4/vendor/firebase (added)
-
tags/1.0.4/vendor/firebase/php-jwt (added)
-
tags/1.0.4/vendor/firebase/php-jwt/LICENSE (added)
-
tags/1.0.4/vendor/firebase/php-jwt/README.md (added)
-
tags/1.0.4/vendor/firebase/php-jwt/composer.json (added)
-
tags/1.0.4/vendor/firebase/php-jwt/src (added)
-
tags/1.0.4/vendor/firebase/php-jwt/src/BeforeValidException.php (added)
-
tags/1.0.4/vendor/firebase/php-jwt/src/ExpiredException.php (added)
-
tags/1.0.4/vendor/firebase/php-jwt/src/JWK.php (added)
-
tags/1.0.4/vendor/firebase/php-jwt/src/JWT.php (added)
-
tags/1.0.4/vendor/firebase/php-jwt/src/Key.php (added)
-
tags/1.0.4/vendor/firebase/php-jwt/src/SignatureInvalidException.php (added)
-
trunk/includes/class-core.php (modified) (6 diffs)
-
trunk/includes/class-smartbanner.php (modified) (1 diff)
-
trunk/includes/class-woocommerce.php (modified) (4 diffs)
-
trunk/napps.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
napps/trunk/includes/class-core.php
r2678957 r2703352 24 24 25 25 } 26 26 27 27 /** 28 28 * From a order query param, auth current user and redirect to the payment page if allowed … … 33 33 */ 34 34 public function get_woocommerce_checkout( WP_REST_Request $request ) { 35 36 // Get order id 35 37 $orderID = $request->get_param("order"); 38 39 // Get current auth user 36 40 $customer = get_current_user_id(); 37 41 42 // Check if user is not loggedIn 38 43 if($orderID == null || !$customer) { 39 44 wp_redirect(home_url('/napps/order/failed')); … … 42 47 43 48 $order = wc_get_order($orderID); 49 50 // If order is not from auth user 44 51 if(!$order || $customer != $order->get_customer_id()) { 45 52 wp_redirect(home_url('/napps/order/failed')); … … 47 54 } 48 55 49 if($order && ( $order->has_status( 'pending' ) || $order->has_status( 'unpaid' ) )) { 56 57 // Auth current customer based on his jwt token 58 wp_clear_auth_cookie(); 59 wp_set_current_user( $customer ); 60 wp_set_auth_cookie($customer, true, is_ssl()); 61 62 // If we failed to set cookie for napps_mobile ignore 63 // Some wordpress sites were reporting that COOKIEPATH was not correctly set 64 try { 65 setcookie('napps_mobile', 'true', strtotime('+1 day'), COOKIEPATH, COOKIE_DOMAIN, true, true); 66 } catch(Exception $e) {} 67 68 if( $order->has_status( 'pending' ) || $order->has_status( 'unpaid' ) ) { 50 69 51 70 try { … … 60 79 ); 61 80 62 // Auth current customer based on his jwt token63 wp_clear_auth_cookie();64 wp_set_current_user( $customer );65 wp_set_auth_cookie($customer, true, is_ssl());66 67 81 // Redirect to payment page 68 82 wp_redirect($pay_now_url); … … 74 88 75 89 } else { 76 wp_redirect(home_url('/napps/order/failed'));90 wp_redirect($order->get_view_order_url()); 77 91 exit; 78 92 } -
napps/trunk/includes/class-smartbanner.php
r2678957 r2703352 48 48 $this->options = get_option('nappsSmartAppBanner'); 49 49 50 if(function_exists('is_checkout')) {51 $isPaymentPage = is_checkout(); 52 } else{53 $ isPaymentPage= false;54 } 55 56 if( !$isPaymentPage) {50 $showSmartbanner = true; 51 52 if (isset($_COOKIE['napps_mobile']) && $_COOKIE['napps_mobile'] == 'true') { 53 $showSmartbanner = false; 54 } 55 56 if($showSmartbanner) { 57 57 58 58 //Hooks -
napps/trunk/includes/class-woocommerce.php
r2672465 r2703352 10 10 use WC_Shipping_Zones; 11 11 use WC_Webhook; 12 12 use WC_Order; 13 13 14 14 if (!class_exists('NappsWooCommerce')) { … … 39 39 add_filter( 'woocommerce_webhook_topic_hooks', array($this, 'add_new_topic_hooks') ); 40 40 41 add_action( 'woocommerce_rest_insert_shop_order_object', array( $this, 'on_rest_new_order' ), 10, 2); 42 41 43 if(is_admin()) 42 44 { … … 54 56 add_action( 'woocommerce_init', array( $this, 'woocommerce_init' ), 10, 0 ); 55 57 add_action( 'woocommerce_admin_order_data_after_order_details', array( $this, 'woocommerce_is_napps_admin_order_fields'), 10, 1 ); 58 56 59 } 57 60 … … 61 64 } 62 65 63 function woocommerce_is_napps_admin_order_fields($order) { 66 /* 67 * Integration with third party plugins 68 * Some plugins only take in account orders created using website checkout 69 * Trigger this event for orders created from the rest api 70 */ 71 public function on_rest_new_order($order, $request) { 72 73 if( $order instanceof WC_Order ){ 74 $order_id = $order->get_id(); 75 }else{ 76 $order_id = $order->ID; 77 } 78 79 do_action('woocommerce_checkout_order_processed', $order_id, $request, $order); 80 } 81 82 public function woocommerce_is_napps_admin_order_fields($order) { 64 83 ?> 65 84 -
napps/trunk/napps.php
r2678957 r2703352 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. 35 * Version: 1.0.4 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. 3' );38 define( 'NAPPS_VERSION', '1.0.4' ); 39 39 define( 'NAPPS_REST_PREFIX', 'napps/v1' ); 40 40 -
napps/trunk/readme.txt
r2678957 r2703352 5 5 Requires at least: 4.7 6 6 Tested up to: 5.8 7 Stable tag: 1.0. 37 Stable tag: 1.0.4 8 8 Requires PHP: 5.6 9 9 License: GPLv2 … … 77 77 == Changelog == 78 78 79 = 1.0.4 = 80 81 * New - Order detail redirect page 82 79 83 = 1.0.3 = 80 84
Note: See TracChangeset
for help on using the changeset viewer.