Plugin Directory

Changeset 3190678


Ignore:
Timestamp:
11/17/2024 02:48:43 PM (17 months ago)
Author:
inspireui
Message:

version 4.15.8

Location:
mstore-api
Files:
488 added
4 edited

Legend:

Unmodified
Added
Removed
  • mstore-api/trunk/controllers/flutter-auction.php

    r3189145 r3190678  
    4040            ),
    4141        ));
     42
     43        register_rest_route(
     44            $this->namespace,
     45            '/history' . '/(?P<id>[\d]+)',
     46            array(
     47                'args' => array(
     48                    'id' => array(
     49                        'description' => __('Unique identifier for the resource.', 'woocommerce'),
     50                        'type' => 'integer',
     51                    ),
     52                ),
     53                array(
     54                    'methods' => "GET",
     55                    'callback' => array($this, 'get_auction_history'),
     56                    'permission_callback' => function () {
     57                        return parent::checkApiPermission();
     58                    }
     59                ),
     60            )
     61        );
    4262    }
    4363
     
    92112        return true;
    93113    }
     114
     115    public function get_auction_history($request)
     116    {
     117        if (!class_exists('WooCommerce_simple_auction')) {
     118            return parent::send_invalid_plugin_error("You need to install WooCommerce Simple Auction plugin to use this api");
     119        }
     120
     121        $product = wc_get_product($request['id']);
     122        if ($product) {
     123            if ($product->is_sealed()) {
     124                return parent::sendError("is_sealed", 'This auction is sealed. Upon auction finish auction history and winner will be available to the public.' , 200);
     125            }else{
     126                $datetimeformat = get_option('date_format').' '.get_option('time_format');
     127                $results = [];
     128                $auction_history = apply_filters('woocommerce__auction_history_data', $product->auction_history());
     129                if (!empty($auction_history)) {
     130                    foreach ($auction_history as $history_value) {
     131                        $results[] = [
     132                            'date' => $history_value->date,
     133                            'bid' => $history_value->bid,
     134                            'displayname' => apply_filters( 'woocommerce_simple_auctions_displayname', get_userdata($history_value->userid)->display_name, $product )
     135                        ];
     136                    }
     137                }
     138                return $results;
     139            }
     140        }else{
     141            return parent::sendError("invalid", $request['id'] . ' not found' , 400);
     142        }
     143    }
    94144}
    95145
  • mstore-api/trunk/controllers/helpers/vendor-admin-wcfm-helper.php

    r3089753 r3190678  
    822822        }
    823823        $offset = ($offset - 1) * $length;
     824
     825        //validate order param
     826        if(!empty($request["order"]) && $request["order"] != 'asc' && $request["order"] != 'desc'){
     827            return $this->sendError("request_failed", "order is invalid", 400);
     828        }
     829
     830        //validate status_type param
     831        if(!empty($request["status_type"]) && $request["status_type"] != 'approved' && $request["status_type"] != 'pending'){
     832            return $this->sendError("request_failed", "status_type is invalid", 400);
     833        }
    824834
    825835        $the_orderby = !empty($request["orderby"])
  • mstore-api/trunk/mstore-api.php

    r3189145 r3190678  
    44 * Plugin URI: https://github.com/inspireui/mstore-api
    55 * Description: The MStore API Plugin which is used for the FluxBuilder and FluxStore Mobile App
    6  * Version: 4.15.7
     6 * Version: 4.15.8
    77 * Author: FluxBuilder
    88 * Author URI: https://fluxbuilder.com
     
    5858class MstoreCheckOut
    5959{
    60     public $version = '4.15.7';
     60    public $version = '4.15.8';
    6161
    6262    public function __construct()
  • mstore-api/trunk/readme.txt

    r3189145 r3190678  
    44Requires at least: 4.4
    55Tested up to:      6.5.3
    6 Stable tag:        4.15.7
     6Stable tag:        4.15.8
    77License:           GPL-2.0
    88License URI:       https://www.gnu.org/licenses/gpl-2.0.html
     
    4949
    5050== Changelog ==
     51= 4.15.8 =
     52  * Validate order and status_type params for reviews api
     53
    5154= 4.15.7 =
    5255  * Support WooCommerce Simple Auctions
Note: See TracChangeset for help on using the changeset viewer.