Plugin Directory

Changeset 2678957


Ignore:
Timestamp:
02/15/2022 10:18:05 AM (4 years ago)
Author:
nappssolutions
Message:

tagging version 1.0.3

Location:
napps
Files:
54 added
4 edited

Legend:

Unmodified
Added
Removed
  • napps/trunk/includes/class-core.php

    r2672465 r2678957  
    77
    88namespace NAPPS;
     9
     10use Exception;
    911use WP_REST_Request;
    1012use WP_REST_Response;
     
    3537           
    3638            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;
    3841            }
    3942           
    4043            $order = wc_get_order($orderID);
    4144            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;
    4347            }
    4448
    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                }
    5374               
    5475            } else {
    55                 return new WP_REST_Response(null, 404);
     76                wp_redirect(home_url('/napps/order/failed'));
     77                exit;
    5678            }
    5779        }
  • napps/trunk/includes/class-smartbanner.php

    r2672465 r2678957  
    154154        public function smartbanner_info( WP_REST_Request $request ) {
    155155
    156            
    157156            $user = get_current_user_id();
    158157            if(!$user || !current_user_can("manage_woocommerce")) {
     
    325324            }
    326325
     326            $fileNameSplit = explode('.',$file['name']);
     327            $file_ext = end($fileNameSplit);
     328
    327329            // 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");
    330332            if(in_array($file_ext,$extensions) === false){
    331333                return false;
  • napps/trunk/napps.php

    r2672465 r2678957  
    33 * Plugin Name: NAPPS
    44 * Description: Plugin to complement the napps E-commerce solution. More on https://napps.pt
    5  * Version:     1.0.2
     5 * Version:     1.0.3
    66 * Author:      NAPPS
    77 * Author URI:  https://napps.pt
     
    3636define( 'NAPPS_PLUGIN_DIR_URL', plugin_dir_url( __FILE__ ) );
    3737define( 'NAPPS_PLUGIN_FILE',  __FILE__ );
    38 define( 'NAPPS_VERSION', '1.0.2' );
     38define( 'NAPPS_VERSION', '1.0.3' );
    3939define( 'NAPPS_REST_PREFIX', 'napps/v1' );
    4040
  • napps/trunk/readme.txt

    r2672465 r2678957  
    55Requires at least: 4.7
    66Tested up to: 5.8
    7 Stable tag: 1.0.2
     7Stable tag: 1.0.3
    88Requires PHP: 5.6
    99License: GPLv2
     
    7777== Changelog ==
    7878
     79= 1.0.3 =
     80
     81* Fix - Order redirect page
     82
    7983= 1.0.2 =
    8084
Note: See TracChangeset for help on using the changeset viewer.