PluginProbe ʕ •ᴥ•ʔ
FraudLabs Pro for WooCommerce / 2.24.2
FraudLabs Pro for WooCommerce v2.24.2
2.24.2 2.24.1 2.24.0 trunk 2.10.0 2.10.1 2.10.10 2.10.11 2.10.12 2.10.13 2.10.14 2.10.2 2.10.3 2.10.4 2.10.5 2.10.6 2.10.7 2.10.8 2.10.9 2.11.0 2.11.1 2.11.10 2.11.11 2.11.2 2.11.3 2.11.4 2.11.5 2.11.6 2.11.7 2.11.8 2.11.9 2.12.0 2.12.1 2.12.2 2.12.3 2.12.4 2.12.5 2.12.6 2.13.0 2.13.1 2.13.10 2.13.2 2.13.3 2.13.4 2.13.5 2.13.6 2.13.7 2.13.8 2.13.9 2.14.0 2.14.1 2.14.10 2.14.11 2.14.2 2.14.3 2.14.4 2.14.5 2.14.6 2.14.7 2.14.8 2.14.9 2.15.0 2.16.0 2.16.1 2.16.10 2.16.11 2.16.12 2.16.13 2.16.14 2.16.15 2.16.16 2.16.17 2.16.18 2.16.19 2.16.2 2.16.3 2.16.4 2.16.5 2.16.6 2.16.7 2.16.8 2.16.9 2.17.0 2.17.1 2.17.2 2.17.3 2.17.4 2.17.5 2.17.6 2.17.7 2.17.8 2.18.0 2.18.1 2.18.2 2.18.3 2.18.4 2.18.5 2.19.0 2.19.1 2.19.2 2.19.3 2.20.0 2.20.1 2.20.2 2.20.3 2.21.0 2.21.1 2.22.0 2.22.1 2.22.10 2.22.11 2.22.12 2.22.13 2.22.14 2.22.15 2.22.2 2.22.3 2.22.4 2.22.5 2.22.6 2.22.7 2.22.8 2.22.9 2.23.0 2.23.1 2.23.2 2.23.3 2.23.4 2.23.5 2.23.6 2.23.7 2.8.17 2.9.0 2.9.1 2.9.2 2.9.3 2.9.4 2.9.5
fraudlabs-pro-for-woocommerce / includes / flp-callback.php
fraudlabs-pro-for-woocommerce / includes Last commit date
class.wc-fraudlabspro.php 1 week ago flp-callback.php 1 year ago
flp-callback.php
159 lines
1 <?php
2 $flp_approve_status = get_setting( 'approve_status' );
3 $flp_reject_status = get_setting( 'reject_status' );
4
5 /**
6 * Get plugin settings.
7 */
8 function get_setting( $key ) {
9 return get_option( 'wc_settings_woocommerce-fraudlabs-pro_' . $key );
10 }
11
12 function verify_custom_nonce($nonce, $action, $id) {
13 if ($nonce == '') {
14 return false;
15 }
16
17 if (strpos($nonce, '|') === false) {
18 return false;
19 }
20
21 list($nonceValue, $expiryTimestamp) = explode('|', $nonce);
22 if (time() < $expiryTimestamp) {
23 if (!wp_verify_nonce($nonceValue, $action)) {
24 return false;
25 }
26 } else {
27 if ($id == '') {
28 return false;
29 } else {
30 $nonceChecks = get_post_meta( $id, '_fraudlabspro' );
31 if ($nonceChecks) {
32 if (!is_array($nonceChecks[0]) && !is_object($nonceChecks[0])) {
33 $nonceCheck = json_decode($nonceChecks[0]);
34 } else {
35 $nonceCheck = $nonceChecks[0];
36 }
37
38 if ($nonceCheck) {
39 if (is_array($nonceChecks[0])) {
40 $callbackNonce = $nonceCheck['flp_callback_nonce'] ?? '';
41 } else {
42 $callbackNonce = $nonceCheck->flp_callback_nonce ?? '';
43 }
44 if ($callbackNonce != $nonce) {
45 return false;
46 }
47 } else {
48 return false;
49 }
50 } else {
51 return false;
52 }
53 }
54 }
55
56 return true;
57 }
58
59 $id = (isset($_GET['orderid'])) ? sanitize_text_field($_GET['orderid']) : '';
60 $action = (isset($_GET['action'])) ? sanitize_text_field($_GET['action']) : '';
61 $nonce = (isset($_GET['nonce'])) ? sanitize_text_field($_GET['nonce']) : '';
62
63 if (!verify_custom_nonce($nonce, 'check-flp-callback', $id)) {
64 die;
65 }
66
67 if ( $id != '' ) {
68 $order = wc_get_order( $id );
69
70 if (empty($order)) {
71 die;
72 }
73
74 // Update for Approve case
75 if ( $action == 'APPROVE' ) {
76 if( $flp_approve_status ) {
77 // Add note and change status
78 $order->add_order_note( __( 'FraudLabs Pro status changed from Review to Approved.', 'woocommerce-fraudlabs-pro' ) );
79 $order->update_status( $flp_approve_status );
80 }else{
81 // Add the note only
82 $order->add_order_note( __( 'FraudLabs Pro status changed from Review to Approved.', 'woocommerce-fraudlabs-pro' ) );
83 }
84
85 $result = get_post_meta( $id, '_fraudlabspro' );
86 if ( !is_array( $result[0] ) && !is_object( $result[0] ) ) {
87 $row = json_decode( $result[0] );
88 } else {
89 $row = $result[0];
90 }
91
92 if ( is_array( $result[0] ) ) {
93 $row['fraudlabspro_status'] = 'APPROVE';
94 } else {
95 if (isset($row->fraudlabspro_status)) {
96 $row->fraudlabspro_status = 'APPROVE';
97 }
98 }
99 update_post_meta( $id, '_fraudlabspro', $row );
100 }
101 // Update for Reject case
102 elseif( $action == 'REJECT' ) {
103 if( $flp_reject_status ) {
104 // Add note and change status
105 $order->add_order_note( __( 'FraudLabs Pro status changed from Review to Rejected.', 'woocommerce-fraudlabs-pro' ) );
106 $order->update_status( $flp_reject_status );
107 }else{
108 // Add the note only
109 $order->add_order_note( __( 'FraudLabs Pro status changed from Review to Rejected.', 'woocommerce-fraudlabs-pro' ) );
110 }
111
112 $result = get_post_meta( $id, '_fraudlabspro' );
113 if ( !is_array( $result[0] ) && !is_object( $result[0] ) ) {
114 $row = json_decode( $result[0] );
115 } else {
116 $row = $result[0];
117 }
118
119 if ( is_array( $result[0] ) ) {
120 $row['fraudlabspro_status'] = 'REJECT';
121 } else {
122 if (isset($row->fraudlabspro_status)) {
123 $row->fraudlabspro_status = 'REJECT';
124 }
125 }
126 update_post_meta( $id, '_fraudlabspro', $row );
127 }
128 // Update for Blacklist case
129 elseif ( $action == 'REJECT_BLACKLIST' ) {
130 if( $flp_reject_status ) {
131 // Add note and change status
132 $order->add_order_note( __( 'Blacklisted order to FraudLabs Pro.', 'woocommerce-fraudlabs-pro' ) );
133 $order->update_status( $flp_reject_status );
134 }else{
135 // Add the note only
136 $order->add_order_note( __( 'Blacklisted order to FraudLabs Pro.', 'woocommerce-fraudlabs-pro' ) );
137 }
138
139 $result = get_post_meta( $id, '_fraudlabspro' );
140 if ( !is_array( $result[0] ) && !is_object( $result[0] ) ) {
141 $row = json_decode( $result[0] );
142 } else {
143 $row = $result[0];
144 }
145
146 if ( is_array( $result[0] ) ) {
147 $row['fraudlabspro_status'] = 'REJECT';
148 $row['is_blacklisted'] = '1';
149 } else {
150 if (isset($row->fraudlabspro_status)) {
151 $row->fraudlabspro_status = 'REJECT';
152 $row->is_blacklisted = '1';
153 }
154 }
155 update_post_meta( $id, '_fraudlabspro', $row );
156 }
157 }
158
159 ?>