File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1208,15 +1208,15 @@ public static function ppmfwc_retourpinReturn()
12081208 public static function ppmfwc_onPinRefund ()
12091209 {
12101210 $ security = PPMFWC_Helper_Data::getPostTextField ('security ' );
1211- check_ajax_referer ( $ security , 'security ' );
1212-
1213- // If execution reaches here, the nonce is valid.
1214- if (AjaxSecurityHelper:: isUserAdminAjax ()) {
1215- wp_send_json_success ([ ' message ' => ' Nonce valid and user is Admin! ' ] );
1216- } else {
1217- wp_send_json_error ([ ' message ' => ' Unauthorized User ' ], 403 );
1211+ if (( empty ( $ security) || ! wp_verify_nonce ( $ security , 'ajax_nonce ' )) || (! current_user_can ( ' manage_woocommerce ' ) && ! current_user_can ( ' manage_options ' ))) {
1212+ $ returnArray = array (
1213+ ' success ' => false ,
1214+ ' message ' => __ ( ' You do not have permission to perform this action. ' , PPMFWC_WOOCOMMERCE_TEXTDOMAIN ),
1215+ );
1216+ header ( ' Content-Type: application/json;charset=UTF-8 ' );
1217+ die ( json_encode ( $ returnArray ) );
12181218 }
1219-
1219+
12201220 try {
12211221 $ amount = PPMFWC_Helper_Data::getPostTextField ('amount ' );
12221222 $ terminal = PPMFWC_Helper_Data::getPostTextField ('terminal ' );
You can’t perform that action at this time.
0 commit comments