Changeset 2737166
- Timestamp:
- 06/03/2022 09:30:49 PM (4 years ago)
- Location:
- agecheckernet
- Files:
-
- 4 added
- 3 edited
-
tags/1.11.0 (added)
-
tags/1.11.0/agechecker.php (added)
-
tags/1.11.0/class-wc-integration-agechecker-integration.php (added)
-
tags/1.11.0/readme.txt (added)
-
trunk/agechecker.php (modified) (1 diff)
-
trunk/class-wc-integration-agechecker-integration.php (modified) (37 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
agecheckernet/trunk/agechecker.php
r2725650 r2737166 4 4 Plugin URI: https://agechecker.net 5 5 Description: AgeChecker.Net seamlessly and securely verifies the age of your customers directly on your website during the checkout process. Keep your site up to date on the latest age regulations for your industry while ensuring that purchasing is frustration-free for your site users. 6 Version: 1.1 0.06 Version: 1.11.0 7 7 Author: AgeChecker.Net 8 8 Author URI: https://agechecker.net -
agecheckernet/trunk/class-wc-integration-agechecker-integration.php
r2725650 r2737166 54 54 $this->element = $this->get_option('element'); 55 55 $this->workflow_type = $this->get_option('workflow_type'); 56 $this->set_status_pending = $this->get_option('set_status_pending'); 57 $this->set_status_accepted = $this->get_option('set_status_accepted'); 58 $this->set_status_denied = $this->get_option('set_status_denied'); 59 $this->set_status_disabled = $this->get_option('set_status_disabled'); 60 $this->set_status_blocked = $this->get_option('set_status_blocked'); 56 61 $this->excluded_categories = $this->get_option('excluded_categories'); 57 62 $this->categories_mode = $this->get_option('categories_mode'); … … 91 96 'desc_tip' => false, 92 97 ), 93 'workflow_type' => array(98 'workflow_type' => array( 94 99 'title' => 'Verification Workflow Type', 95 100 'type' => 'radio', … … 98 103 'desc_tip' => false, 99 104 ), 100 'key' => array(105 'key' => array( 101 106 'title' => 'API Key', 102 107 'type' => 'text', … … 112 117 'desc_tip' => false, 113 118 ), 114 'store_name' => array(119 'store_name' => array( 115 120 'title' => 'Store Name', 116 121 'type' => 'text', … … 119 124 'desc_tip' => false, 120 125 ), 121 'element' => array(126 'element' => array( 122 127 'title' => 'Element', 123 128 'type' => 'text', 124 129 'description' => 'Element selector to attach the popup event to when using the "Before Payment" workflow. You may need to change this if you use a custom theme/template. Please contact us if the popup is not showing when the element is clicked. The default element is the final checkout button.', 125 130 'default' => '#place_order', 131 'desc_tip' => false, 132 ), 133 'set_status_pending' => array( 134 'title' => 'Set Order Status when Verification is Pending', 135 'type' => 'selectbox', 136 'description' => 'Change the status of an order when a verification is <i>pending</i>. (Such as waiting for photo ID submission or e-signature, or no verification has been performed at all yet) AgeChecker will not set the order status if set to "None".', 137 'default' => 'do_not_set_status', 138 'list' => 'order_status_pending', 139 'desc_tip' => false, 140 ), 141 'set_status_accepted' => array( 142 'title' => 'Set Order Status when Verification is Accepted', 143 'type' => 'selectbox', 144 'description' => 'Change the status of an order when a verification is <i>accepted</i>. AgeChecker will not set the order status if set to "None".', 145 'default' => 'do_not_set_status', 146 'list' => 'order_status_accepted', 147 'desc_tip' => false, 148 ), 149 'set_status_denied' => array( 150 'title' => 'Set Order Status when Verification is Denied', 151 'type' => 'selectbox', 152 'description' => 'Change the status of an order when a verification is <i>denied</i>. AgeChecker will not set the order status if set to "None".', 153 'default' => 'do_not_set_status', 154 'list' => 'order_status_denied', 155 'desc_tip' => false, 156 ), 157 'set_status_disabled' => array( 158 'title' => 'Set Order Status when Verification is Disabled at Customer\'s Location', 159 'type' => 'selectbox', 160 'description' => 'Change the status of an order when a verification is disabled and not needed at customer\'s location. AgeChecker will not set the order status if set to "None".', 161 'default' => 'do_not_set_status', 162 'list' => 'order_status_disabled', 163 'desc_tip' => false, 164 ), 165 'set_status_blocked' => array( 166 'title' => 'Set Order Status when Verification is Blocked at Customer\'s Location', 167 'type' => 'selectbox', 168 'description' => 'Change the status of an order when a verification is blocked due to customer\'s location. AgeChecker will not set the order status if set to "None".', 169 'default' => 'do_not_set_status', 170 'list' => 'order_status_blocked', 126 171 'desc_tip' => false, 127 172 ), … … 134 179 'desc_tip' => false, 135 180 ), 136 'categories_mode' => array(181 'categories_mode' => array( 137 182 'type' => 'radio', 138 183 'default' => 'exclude', … … 140 185 'desc_tip' => false, 141 186 ), 142 'excluded_groups' => array(187 'excluded_groups' => array( 143 188 'title' => 'Exclude/Include Groups', 144 189 'type' => 'listbox', … … 147 192 'desc_tip' => false, 148 193 ), 149 'groups_mode' => array(194 'groups_mode' => array( 150 195 'type' => 'radio', 151 196 'default' => 'exclude', … … 153 198 'desc_tip' => false, 154 199 ), 155 'excluded_shipping' => array(200 'excluded_shipping' => array( 156 201 'title' => 'Exclude Shipping Methods', 157 202 'type' => 'listbox', … … 160 205 'desc_tip' => false, 161 206 ), 162 'excluded_payment' => array(207 'excluded_payment' => array( 163 208 'title' => 'Exclude Payment Methods', 164 209 'type' => 'listbox', … … 167 212 'desc_tip' => false, 168 213 ), 169 'min_total' => array(214 'min_total' => array( 170 215 'title' => 'Minimum Total', 171 216 'type' => 'text', … … 174 219 'desc_tip' => false, 175 220 ), 176 'page' => array(221 'page' => array( 177 222 'title' => 'Page', 178 223 'type' => 'text', … … 181 226 'desc_tip' => false, 182 227 ), 183 'enable_all' => array(228 'enable_all' => array( 184 229 'title' => 'Enable on All Pages', 185 230 'type' => 'radio', … … 188 233 'desc_tip' => false, 189 234 ), 190 'script_location' => array(235 'script_location' => array( 191 236 'title' => 'Script Location', 192 237 'type' => 'radio', … … 195 240 'desc_tip' => false, 196 241 ), 197 'category_apikeys' => array(242 'category_apikeys' => array( 198 243 'title' => 'Category Specific API Keys (Advanced)', 199 244 'type' => 'apikeys_listbox', … … 201 246 'desc_tip' => false, 202 247 ), 203 'apikeys_list' => array(248 'apikeys_list' => array( 204 249 'type' => 'ordered_listbox', 205 250 'default' => 'default_api_key', … … 208 253 'desc_tip' => false, 209 254 ), 210 'client_config' => array(255 'client_config' => array( 211 256 'title' => 'Additional Config (Advanced)', 212 257 'type' => 'textarea', … … 215 260 'css' => 'width: 400px' 216 261 ), 217 'before_script' => array(262 'before_script' => array( 218 263 'title' => 'Before Load Script (Advanced)', 219 264 'type' => 'textarea', … … 222 267 'css' => 'width: 400px' 223 268 ), 224 'tag_order' => array(269 'tag_order' => array( 225 270 'title' => 'Tag Orders', 226 271 'type' => 'radio', … … 229 274 'desc_tip' => false, 230 275 ), 231 'set_customer_role' => array(276 'set_customer_role' => array( 232 277 'title' => 'Set Customer Role', 233 278 'type' => 'selectbox', … … 237 282 'desc_tip' => false, 238 283 ), 239 'role_find_account' => array(284 'role_find_account' => array( 240 285 'type' => 'radio', 241 286 'description' => 'If first option is enabled, a user\'s account will be attempted to be found based on a guest order\'s email and billing details. If matching, the role will be applied to the found user account.', … … 243 288 'desc_tip' => false, 244 289 ), 245 'enable_noscript' => array(290 'enable_noscript' => array( 246 291 'title' => 'Redirect users if Javascript is disabled', 247 292 'type' => 'radio', … … 256 301 $field = $this->plugin_id . $this->id . '_' . $key; 257 302 258 $roles = array(); 259 foreach (get_editable_roles() as $role_name => $role_info) { 260 $roles[] = $role_name; 303 $array = array(); 304 $default = ""; 305 306 if($key == "set_customer_role") { 307 $default = "do_not_set_role"; 308 foreach (get_editable_roles() as $role_name => $role_info) { 309 $array[$role_name] = $role_name; 310 } 311 } else if(substr($key, 0, strlen("set_status_")) === "set_status_") { 312 $default = "do_not_set_status"; 313 $order_statuses = wc_get_order_statuses(); 314 315 foreach ($order_statuses as $status_tag => $status_name) { 316 $array[$status_tag] = $status_name; 317 } 261 318 } 262 319 … … 275 332 <p> 276 333 <select id="<?php echo $data['list']; ?>Input" name="<?php echo $data['list']; ?>Input"> 277 <option value=" do_not_set_role" <?php echo ($this->get_option($key) === "do_not_set_role"? "selected" : ""); ?>>None</option>334 <option value="<?php echo $default; ?>" <?php echo ($this->get_option($key) === $default ? "selected" : ""); ?>>None</option> 278 335 <?php 279 foreach ($ roles as$c) {280 echo '<option value="' . $ c . '" '. ($this->get_option($key) === $c? "selected" : "") .'>' . $c . '</option>';336 foreach ($array as $k => $c) { 337 echo '<option value="' . $k . '" '. ($this->get_option($key) === $k ? "selected" : "") .'>' . $c . '</option>'; 281 338 } 282 339 ?> … … 297 354 const beforePaymentFields = ["[name='woocommerce_integration-agechecker_element']", "#woocommerce_integration-agechecker_enable_all", 298 355 "#woocommerce_integration-agechecker_script_location", "#woocommerce_integration-agechecker_tag_order", "#woocommerce_integration-agechecker_page"]; 299 const afterPaymentFields = ["[for='woocommerce_integration-agechecker_secret']"]; 356 const afterPaymentFields = ["[for='woocommerce_integration-agechecker_secret']", "#order_status_pendingInput", "#order_status_acceptedInput", "#order_status_deniedInput", 357 "#order_status_disabledInput", "#order_status_blockedInput"]; 300 358 301 359 function changeWorkflow(sel) { … … 847 905 function add_order_status_column_style() { 848 906 $css = '.agechecker_status 849 { padding: 2px 6px; border-radius: 4px; text-align: center; width: 18ch; }907 { padding: 2px 6px; border-radius: 4px; text-align: center; max-width: 18ch; } 850 908 .agechecker_status--accepted { background-color: #c6e1c6; } 851 909 .agechecker_status--denied { background-color: #e9b7b7; } … … 970 1028 $order = new WC_Order( $order_id ); 971 1029 1030 // Set pending order status for after payment workflow is available 1031 if($this->workflow_type == "after_payment" && $this->set_status_pending != "do_not_set_status") { 1032 $order->update_status($this->set_status_pending); 1033 } 1034 972 1035 if(!isset($_POST['agechecker_uuid'])) return; 973 1036 … … 1000 1063 </div> 1001 1064 <?php 1065 return $this->get_option($key); 1002 1066 } 1003 1067 … … 1013 1077 </div> 1014 1078 <?php 1079 return $this->get_option($key); 1015 1080 } 1016 1081 … … 1026 1091 </div> 1027 1092 <?php 1093 return $this->get_option($key); 1028 1094 } 1029 1095 … … 1039 1105 </div> 1040 1106 <?php 1107 return $this->get_option($key); 1041 1108 } 1042 1109 … … 1066 1133 </div> 1067 1134 <?php 1135 return $this->get_option($key); 1068 1136 } 1069 1137 … … 1079 1147 </div> 1080 1148 <?php 1149 return $this->get_option($key); 1081 1150 } 1082 1151 … … 1094 1163 </div> 1095 1164 <?php 1165 return $this->get_option($key); 1096 1166 } 1097 1167 … … 1107 1177 </div> 1108 1178 <?php 1179 return $this->get_option($key); 1180 } 1181 1182 return $value; 1183 } 1184 1185 public function validate_set_status_pending_field($key) { 1186 $value = $_POST["order_status_pendingInput"]; 1187 if (!isset($value)) { 1188 ?> 1189 <div class="error notice"> 1190 <p><strong>Invalid order status for "Set Order Status When Verification is Pending".</strong></p> 1191 </div> 1192 <?php 1193 return $this->get_option($key); 1194 } 1195 1196 return $value; 1197 } 1198 1199 public function validate_set_status_accepted_field($key) { 1200 $value = $_POST["order_status_acceptedInput"]; 1201 if (!isset($value)) { 1202 ?> 1203 <div class="error notice"> 1204 <p><strong>Invalid order status for "Set Order Status When Verification is Accepted".</strong></p> 1205 </div> 1206 <?php 1207 return $this->get_option($key); 1208 } 1209 1210 return $value; 1211 } 1212 1213 public function validate_set_status_denied_field($key) { 1214 $value = $_POST["order_status_deniedInput"]; 1215 if (!isset($value)) { 1216 ?> 1217 <div class="error notice"> 1218 <p><strong>Invalid order status for "Set Order Status When Verification is Denied".</strong></p> 1219 </div> 1220 <?php 1221 return $this->get_option($key); 1222 } 1223 1224 return $value; 1225 } 1226 1227 public function validate_set_status_disabled_field($key) { 1228 $value = $_POST["order_status_disabledInput"]; 1229 if (!isset($value)) { 1230 ?> 1231 <div class="error notice"> 1232 <p><strong>Invalid order status for "Set Order Status when Verification is Disabled at Customer's Location".</strong></p> 1233 </div> 1234 <?php 1235 return $this->get_option($key); 1236 } 1237 1238 return $value; 1239 } 1240 1241 public function validate_set_status_blocked_field($key) { 1242 $value = $_POST["order_status_blockedInput"]; 1243 if (!isset($value)) { 1244 ?> 1245 <div class="error notice"> 1246 <p><strong>Invalid order status for "Set Order Status when Verification is Blocked at Customer's Location".</strong></p> 1247 </div> 1248 <?php 1249 return $this->get_option($key); 1109 1250 } 1110 1251 … … 1351 1492 $order = new WC_Order($order_id); 1352 1493 1494 $status = $order->get_meta('AgeChecker Status'); 1495 if(!empty($status)) { 1496 $status = strip_tags(trim(substr($status, 0, strpos($status, "-")))); 1497 if($status != "Denied" && $status != "Photo ID Required" && $status != "Signature Required") { 1498 return; 1499 } 1500 } 1501 1353 1502 if($this->enable_noscript == "enable_noscript") { 1354 1503 ?> … … 1655 1804 $order->save(); 1656 1805 1657 if(isset($status) && $status == "accepted") { 1658 $this->set_verified_role($order); 1806 if(isset($status)) { 1807 if($status == "accepted") { 1808 if($this->set_status_accepted != "do_not_set_status") { 1809 $order->update_status($this->set_status_accepted); 1810 } 1811 1812 $this->set_verified_role($order); 1813 } else if($status == "denied") { 1814 if($this->set_status_denied != "do_not_set_status") { 1815 $order->update_status($this->set_status_denied); 1816 } 1817 } else if($status == "photo_id" || $status == "signature") { 1818 if($this->set_status_pending != "do_not_set_status") { 1819 $order->update_status($this->set_status_pending); 1820 } 1821 } else if($status == "not_created") { 1822 $reason = $body['reason']; 1823 if($reason == 'location_blocked') { 1824 if($this->set_status_blocked != "do_not_set_status") { 1825 $order->update_status($this->set_status_blocked); 1826 } 1827 } else if($reason == 'verification_disabled') { 1828 if($this->set_status_disabled != "do_not_set_status") { 1829 $order->update_status($this->set_status_disabled); 1830 } 1831 } 1832 } 1659 1833 } 1660 1834 } -
agecheckernet/trunk/readme.txt
r2725650 r2737166 4 4 Requires at least: 4.4 5 5 Tested up to: 5.8 6 Stable tag: 1.1 0.06 Stable tag: 1.11.0 7 7 8 8 AgeChecker.Net seamlessly and securely verifies the age of your customers directly on your website during the checkout process. … … 62 62 63 63 == Changelog == 64 65 = 1.11.0 = 66 *Release Date - 3 June 2022* 67 68 * After-Payment workflow: Add ability to automatically set order status depending on verification result 69 * After-Payment workflow: CSS adjustments on order list for verification statuses 64 70 65 71 = 1.10.0 =
Note: See TracChangeset
for help on using the changeset viewer.