Changeset 2476032
- Timestamp:
- 02/17/2021 04:37:00 AM (5 years ago)
- Location:
- subscribility
- Files:
-
- 6 deleted
- 8 edited
- 52 copied
-
tags/2.9.22.5 (copied) (copied from subscribility/trunk)
-
tags/2.9.22.5/includes (copied) (copied from subscribility/trunk/includes)
-
tags/2.9.22.5/includes/Bootstrap (deleted)
-
tags/2.9.22.5/includes/admin/assets/css/wp99234-admin.css (copied) (copied from subscribility/trunk/includes/admin/assets/css/wp99234-admin.css)
-
tags/2.9.22.5/includes/admin/assets/js/wp99234-admin.js (copied) (copied from subscribility/trunk/includes/admin/assets/js/wp99234-admin.js)
-
tags/2.9.22.5/includes/admin/controllers/class-wp99234-admin-settings-age-restriction.php (copied) (copied from subscribility/trunk/includes/admin/controllers/class-wp99234-admin-settings-age-restriction.php)
-
tags/2.9.22.5/includes/admin/controllers/class-wp99234-admin-settings-connection.php (copied) (copied from subscribility/trunk/includes/admin/controllers/class-wp99234-admin-settings-connection.php)
-
tags/2.9.22.5/includes/admin/controllers/class-wp99234-admin-settings-data-collection.php (copied) (copied from subscribility/trunk/includes/admin/controllers/class-wp99234-admin-settings-data-collection.php) (1 diff)
-
tags/2.9.22.5/includes/admin/controllers/class-wp99234-admin-settings-products.php (copied) (copied from subscribility/trunk/includes/admin/controllers/class-wp99234-admin-settings-products.php)
-
tags/2.9.22.5/includes/admin/controllers/class-wp99234-admin-settings-signup-checkout.php (copied) (copied from subscribility/trunk/includes/admin/controllers/class-wp99234-admin-settings-signup-checkout.php) (1 diff)
-
tags/2.9.22.5/includes/admin/controllers/class-wp99234-admin-settings.php (copied) (copied from subscribility/trunk/includes/admin/controllers/class-wp99234-admin-settings.php)
-
tags/2.9.22.5/includes/admin/controllers/class-wp99234-admin.php (copied) (copied from subscribility/trunk/includes/admin/controllers/class-wp99234-admin.php)
-
tags/2.9.22.5/includes/admin/controllers/class-wp99234-logs.php (copied) (copied from subscribility/trunk/includes/admin/controllers/class-wp99234-logs.php)
-
tags/2.9.22.5/includes/admin/controllers/class-wp99234-streams.php (deleted)
-
tags/2.9.22.5/includes/admin/views/html-admin-operations-activity.php (copied) (copied from subscribility/trunk/includes/admin/views/html-admin-operations-activity.php)
-
tags/2.9.22.5/includes/bootstrap (copied) (copied from subscribility/trunk/includes/bootstrap)
-
tags/2.9.22.5/includes/bootstrap/class-wp99234-bootstrap-controller.php (copied) (copied from subscribility/trunk/includes/bootstrap/class-wp99234-bootstrap-controller.php)
-
tags/2.9.22.5/includes/common/InfoDump.php (deleted)
-
tags/2.9.22.5/includes/common/functions/class-wp99234-functions.php (copied) (copied from subscribility/trunk/includes/common/functions/class-wp99234-functions.php)
-
tags/2.9.22.5/includes/frontend/assets/css/wp99234_frontend.css (copied) (copied from subscribility/trunk/includes/frontend/assets/css/wp99234_frontend.css)
-
tags/2.9.22.5/includes/frontend/assets/js/wp99234_frontend.js (copied) (copied from subscribility/trunk/includes/frontend/assets/js/wp99234_frontend.js)
-
tags/2.9.22.5/includes/frontend/controllers/CustomerController.php (deleted)
-
tags/2.9.22.5/includes/frontend/controllers/OrderController.php (deleted)
-
tags/2.9.22.5/includes/frontend/controllers/UserFiltersController.php (copied) (copied from subscribility/trunk/includes/frontend/controllers/UserFiltersController.php)
-
tags/2.9.22.5/includes/frontend/controllers/api/class-wp99234-api-orders.php (copied) (copied from subscribility/trunk/includes/frontend/controllers/api/class-wp99234-api-orders.php)
-
tags/2.9.22.5/includes/frontend/controllers/class-wp99234-api.php (copied) (copied from subscribility/trunk/includes/frontend/controllers/class-wp99234-api.php)
-
tags/2.9.22.5/includes/frontend/controllers/class-wp99234-customer-controller.php (copied) (copied from subscribility/trunk/includes/frontend/controllers/class-wp99234-customer-controller.php)
-
tags/2.9.22.5/includes/frontend/controllers/class-wp99234-forms.php (copied) (copied from subscribility/trunk/includes/frontend/controllers/class-wp99234-forms.php)
-
tags/2.9.22.5/includes/frontend/controllers/class-wp99234-gift-orders.php (copied) (copied from subscribility/trunk/includes/frontend/controllers/class-wp99234-gift-orders.php)
-
tags/2.9.22.5/includes/frontend/controllers/class-wp99234-logger.php (copied) (copied from subscribility/trunk/includes/frontend/controllers/class-wp99234-logger.php)
-
tags/2.9.22.5/includes/frontend/controllers/class-wp99234-order-controller.php (copied) (copied from subscribility/trunk/includes/frontend/controllers/class-wp99234-order-controller.php)
-
tags/2.9.22.5/includes/frontend/controllers/class-wp99234-orders.php (copied) (copied from subscribility/trunk/includes/frontend/controllers/class-wp99234-orders.php)
-
tags/2.9.22.5/includes/frontend/controllers/class-wp99234-prices.php (copied) (copied from subscribility/trunk/includes/frontend/controllers/class-wp99234-prices.php)
-
tags/2.9.22.5/includes/frontend/controllers/class-wp99234-products.php (copied) (copied from subscribility/trunk/includes/frontend/controllers/class-wp99234-products.php)
-
tags/2.9.22.5/includes/frontend/controllers/class-wp99234-registration-forms.php (copied) (copied from subscribility/trunk/includes/frontend/controllers/class-wp99234-registration-forms.php) (4 diffs)
-
tags/2.9.22.5/includes/frontend/controllers/class-wp99234-template.php (copied) (copied from subscribility/trunk/includes/frontend/controllers/class-wp99234-template.php)
-
tags/2.9.22.5/includes/frontend/controllers/class-wp99234-users.php (copied) (copied from subscribility/trunk/includes/frontend/controllers/class-wp99234-users.php) (2 diffs)
-
tags/2.9.22.5/includes/frontend/controllers/class-wp99234-users_tracking.php (deleted)
-
tags/2.9.22.5/includes/frontend/controllers/class-wp99234-wc-filter.php (copied) (copied from subscribility/trunk/includes/frontend/controllers/class-wp99234-wc-filter.php) (5 diffs)
-
tags/2.9.22.5/includes/frontend/controllers/class-wp99234-wc-payment-gateway.php (copied) (copied from subscribility/trunk/includes/frontend/controllers/class-wp99234-wc-payment-gateway.php)
-
tags/2.9.22.5/includes/frontend/controllers/class-wp99234-wc-shipping-method.php (copied) (copied from subscribility/trunk/includes/frontend/controllers/class-wp99234-wc-shipping-method.php)
-
tags/2.9.22.5/includes/frontend/views/gift-order-view.php (copied) (copied from subscribility/trunk/includes/frontend/views/gift-order-view.php)
-
tags/2.9.22.5/includes/frontend/views/newsletter_form.php (copied) (copied from subscribility/trunk/includes/frontend/views/newsletter_form.php)
-
tags/2.9.22.5/includes/frontend/views/registration_form.php (copied) (copied from subscribility/trunk/includes/frontend/views/registration_form.php) (5 diffs)
-
tags/2.9.22.5/includes/frontend/views/woocommerce/single-product/tabs/troly/awards.php (copied) (copied from subscribility/trunk/includes/frontend/views/woocommerce/single-product/tabs/troly/awards.php)
-
tags/2.9.22.5/includes/frontend/views/woocommerce/single-product/tabs/troly/categories.php (copied) (copied from subscribility/trunk/includes/frontend/views/woocommerce/single-product/tabs/troly/categories.php)
-
tags/2.9.22.5/includes/frontend/views/woocommerce/single-product/tabs/troly/cellar_until.php (copied) (copied from subscribility/trunk/includes/frontend/views/woocommerce/single-product/tabs/troly/cellar_until.php)
-
tags/2.9.22.5/includes/frontend/views/woocommerce/single-product/tabs/troly/description.php (copied) (copied from subscribility/trunk/includes/frontend/views/woocommerce/single-product/tabs/troly/description.php)
-
tags/2.9.22.5/includes/frontend/views/woocommerce/single-product/tabs/troly/matching_foods.php (copied) (copied from subscribility/trunk/includes/frontend/views/woocommerce/single-product/tabs/troly/matching_foods.php)
-
tags/2.9.22.5/includes/frontend/views/woocommerce/single-product/tabs/troly/price.php (copied) (copied from subscribility/trunk/includes/frontend/views/woocommerce/single-product/tabs/troly/price.php)
-
tags/2.9.22.5/includes/frontend/views/woocommerce/single-product/tabs/troly/tags.php (copied) (copied from subscribility/trunk/includes/frontend/views/woocommerce/single-product/tabs/troly/tags.php)
-
tags/2.9.22.5/includes/frontend/views/woocommerce/single-product/tabs/troly/tasting.php (copied) (copied from subscribility/trunk/includes/frontend/views/woocommerce/single-product/tabs/troly/tasting.php)
-
tags/2.9.22.5/includes/frontend/views/woocommerce/single-product/tabs/troly/vintage.php (copied) (copied from subscribility/trunk/includes/frontend/views/woocommerce/single-product/tabs/troly/vintage.php)
-
tags/2.9.22.5/includes/services (copied) (copied from subscribility/trunk/includes/services)
-
tags/2.9.22.5/readme.txt (copied) (copied from subscribility/trunk/readme.txt) (2 diffs)
-
tags/2.9.22.5/vendor/cloudinary/cloudinary_php/src/Cloudinary.php (copied) (copied from subscribility/trunk/vendor/cloudinary/cloudinary_php/src/Cloudinary.php)
-
tags/2.9.22.5/vendor/inacho/php-credit-card-validator/src/CreditCard.php (copied) (copied from subscribility/trunk/vendor/inacho/php-credit-card-validator/src/CreditCard.php)
-
tags/2.9.22.5/wp99234.php (copied) (copied from subscribility/trunk/wp99234.php) (2 diffs)
-
trunk/includes/admin/controllers/class-wp99234-admin-settings-data-collection.php (modified) (1 diff)
-
trunk/includes/admin/controllers/class-wp99234-admin-settings-signup-checkout.php (modified) (1 diff)
-
trunk/includes/frontend/controllers/class-wp99234-registration-forms.php (modified) (4 diffs)
-
trunk/includes/frontend/controllers/class-wp99234-users.php (modified) (2 diffs)
-
trunk/includes/frontend/controllers/class-wp99234-wc-filter.php (modified) (5 diffs)
-
trunk/includes/frontend/views/registration_form.php (modified) (5 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/wp99234.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
subscribility/tags/2.9.22.5/includes/admin/controllers/class-wp99234-admin-settings-data-collection.php
r2415557 r2476032 144 144 ), 145 145 146 [147 'title' => __( 'Select customer referral coupon', 'troly' ),148 'type' => 'select',149 'desc' => __( 'Select customer referral coupon to assign it with your referral code.', 'troly' ),150 'desc_tip' => true,151 'id' => 'troly_member_referral_coupon',152 'css' => 'min-width:550px;',153 'options' => $this->getAllCoupons(),154 ],155 156 146 array( 'type' => 'sectionend', 'id' => 'sync_options' ), 157 147 ) ); -
subscribility/tags/2.9.22.5/includes/admin/controllers/class-wp99234-admin-settings-signup-checkout.php
r2415557 r2476032 123 123 } 124 124 125 /** 126 * Get all the coupons found in the DB 127 */ 125 128 public function getAllCoupons() 126 129 { -
subscribility/tags/2.9.22.5/includes/frontend/controllers/class-wp99234-registration-forms.php
r2382505 r2476032 103 103 'required' => __( 'Please enter your credit card number.', 'wp99234' ), 104 104 ); 105 $fields['cc_exp '] = array(105 $fields['cc_expiry'] = array( 106 106 'required' => __( 'Please enter your card expiry date.', 'wp99234' ), 107 107 'contains' => array( … … 204 204 if ( !isset( $_POST['wp99234_use_existing_card'] ) || $_POST['wp99234_use_existing_card'] !== 'yes' ) { 205 205 206 $exp_array = explode( '/', str_replace( ' ', '', wp_kses( $data['cc_exp '], array() ) ) );206 $exp_array = explode( '/', str_replace( ' ', '', wp_kses( $data['cc_expiry'], array() ) ) ); 207 207 208 208 $exp_month = $exp_array[0]; … … 280 280 $this->setNewClubSignupSession(); 281 281 } 282 283 wc_add_notice( 'Thank you for joining our club. Your membership benefits have been applied to this order.', 'success' );284 282 285 283 if ( isset($_POST) && isset($data[ 'user_pass' ]) ) { … … 300 298 if ( isset( $_GET['troly_redirect'] ) ) { 301 299 if ( $_GET['troly_redirect'] === 'cart' ) { 300 wc_add_notice( 'Thank you for joining our club. Your membership benefits have been applied to this cart.', 'success' ); 302 301 wp_redirect( wc_get_cart_url() ); 303 302 exit; 304 303 } 305 304 elseif ( $_GET['troly_redirect'] === 'checkout' ) { 305 wc_add_notice( 'Thank you for joining our club. Your membership benefits have been applied to this order.', 'success' ); 306 306 wp_redirect( wc_get_checkout_url() ); 307 307 exit; 308 308 } 309 309 elseif ( $_GET['troly_redirect'] === 'product' && ! empty( $_GET['pid'] ) ) { 310 wc_add_notice( 'Thank you for joining our club!', 'success' ); 310 311 wp_redirect( get_permalink( $_GET['pid'] ) ); 311 312 exit; 312 313 } 313 } 314 } else { 315 /* They are signing up on the page directly. */ 316 wc_add_notice( 'Thank you for joining our club!', 'success' ); 317 } 314 318 } else { 315 wc_add_notice( 'An unknown error has occurred. Please try again.', 'error' ); 319 /* Troly may have reported errors. Lets attempt to break these down and let the 320 user know that they need to amend their details */ 321 $field_mappings = [ 322 "cc_exp_month" => "Card expiry month", 323 "cc_exp_year" => "Card expiry year", 324 "cc_number" => "Card number", 325 "cc_name" => "Card name", 326 "cc_exp_date" => "Card expiry date" 327 ]; 328 if(isset($results->errors)){ 329 wc_add_notice( 'Some details could not be accepted. Please review them and try again', 'error' ); 330 foreach($results->errors as $field => $elist){ 331 if(strpos($field, '.') > -1) continue; 332 foreach($elist as $erroritem){ 333 wc_add_notice( $field_mappings[$field] . " $erroritem", 'error'); 334 } 335 } 336 } else { 337 wc_add_notice( 'An unknown error has occurred. Please try again.', 'error' ); 338 } 316 339 } 317 340 } -
subscribility/tags/2.9.22.5/includes/frontend/controllers/class-wp99234-users.php
r2457995 r2476032 474 474 */ 475 475 if ( ! defined( 'WOOCOMMERCE_CHECKOUT' ) && ! isset( $_POST[ 'wp99234_use_existing_card' ] ) ) { 476 $cc_exp = explode('/', str_replace(' ', '', wp_kses($_POST['cc_exp '], array())));476 $cc_exp = explode('/', str_replace(' ', '', wp_kses($_POST['cc_expiry'], array()))); 477 477 478 478 if (count($cc_exp) > 1) { … … 606 606 if( ! empty( $errors ) ){ 607 607 608 if ($subs_id) { 609 $message .= "\nFailed to update user on Troly because of: {${WP99234()->get_var_dump($errors)}}"; 610 } else { 611 $message .= "\nFailed to export user to Troly because of: {${WP99234()->get_var_dump($errors)}}"; 612 } 608 $details = ''; 609 if(is_array($errors)){ 610 foreach($errors as $field => $ferrors){ 611 $details .= "{$field} "; 612 if(is_array($ferrors)){ 613 foreach($ferrors as $ferror){ 614 $details .= "{$ferror} "; 615 } 616 } else { 617 $details .= "{$ferror} "; 618 } 619 } 620 } 621 622 $message .= " failed."; 613 623 614 624 if ($reporting_options == 'verbose' || $reporting_options == 'medium') { 615 wp99234_log_troly( 0, 1, 0, $message );625 wp99234_log_troly( 0, 1, 0, $message, $details ); 616 626 } 617 627 -
subscribility/tags/2.9.22.5/includes/frontend/controllers/class-wp99234-wc-filter.php
r2415557 r2476032 77 77 78 78 // Action to validate credit card 79 add_action( 'woocommerce_after_checkout_validation', array($this, 'wp99234_validate_credit_card'), 10, 2 ); 79 add_action( 'woocommerce_after_checkout_validation', array($this, 'wp99234_validate_credit_card_checkout'), 10, 2 ); 80 81 // Account details error handling 82 add_action('woocommerce_save_account_details_errors', array($this, 'wp99234_validate_credit_card_account_details'), 10, 1); 80 83 81 84 if ( 'checkout' === get_option( 'troly_require_dob' ) || … … 728 731 729 732 $cc_exp = '<p class="woocommerce-FormRow woocommerce-FormRow--wide form-row form-row-first">'; 730 $cc_exp .= '<label for="cc_exp ">Expiry (MM/YY)</label>';731 $cc_exp .= '<input type="tel" inputmode="numeric" class="woocommerce-Input input-text" name="cc_exp " id="cc_exp" placeholder="MM / YY"></p>';733 $cc_exp .= '<label for="cc_expiry">Expiry (MM/YY)</label>'; 734 $cc_exp .= '<input type="tel" inputmode="numeric" class="woocommerce-Input input-text" name="cc_expiry" id="cc_expiry" placeholder="MM / YY"></p>'; 732 735 733 736 $cc_cvv = '<p class="woocommerce-FormRow woocommerce-FormRow--wide form-row form-row-last">'; … … 738 741 if (is_checkout()) { 739 742 echo "<label for='wp99234_use_existing_card'>" . $use_existing_checkbox . "Use your existing card ($existing_card)</label>"; 740 } else {743 } elseif(!empty($existing_card)){ 741 744 echo "<label class='wp99234_use_existing_card' for='wp99234_use_existing_card'>" . $use_existing_checkbox . "Click here to change you current credit card ($existing_card)</label>"; 742 745 } … … 2285 2288 2286 2289 /** 2287 * Credit card validation 2290 * Credit card validation on checkout 2288 2291 * 2289 2292 * This will check if using Credit Card as payment option … … 2295 2298 * @since 2.9 2296 2299 */ 2297 function wp99234_validate_credit_card ( $fields, $errors )2300 function wp99234_validate_credit_card_checkout( $fields, $errors ) 2298 2301 { 2299 2302 if ($_POST['payment_method'] === 'wp99234_payment_gateway' && !isset($_POST['wp99234_use_existing_card'])) { 2300 2303 2301 $cc_name = wp_kses($_POST['wp99234_payment_gateway-card-name'], array()); 2302 $cc_number = wp_kses($_POST['wp99234_payment_gateway-card-number'], array()); 2303 $cc_expiry = wp_kses($_POST['wp99234_payment_gateway-card-expiry'], array()); 2304 $cc_cvc = wp_kses($_POST['wp99234_payment_gateway-card-cvc'], array()); 2305 2306 $validate_cc_number = \Inacho\CreditCard::validCreditCard($cc_number); 2307 $validCvc = \Inacho\CreditCard::validCvc($cc_cvc, $validate_cc_number['type']); 2308 2309 if ( empty($cc_name) ) { 2310 $errors->add( 'validation', '<strong>Name on Credit Card</strong> is a required field.' ); 2311 } 2312 2313 if ( empty($cc_number) ) { 2314 $errors->add( 'validation', '<strong>Credit Card Number</strong> is a required field.' ); 2315 } elseif ( empty($validate_cc_number['valid']) ) { 2316 $errors->add( 'validation', '<strong>Credit Card Number</strong> is invalid.' ); 2317 } 2318 2319 if ( empty($cc_expiry) ) { 2320 $errors->add( 'validation', '<strong>Credit Card Expiry</strong> is a required field.' ); 2321 } 2322 2323 if ( empty($cc_cvc) ) { 2324 $errors->add( 'validation', '<strong>Credit Card Code</strong> is a required field.' ); 2325 } elseif ( $validCvc === false ) { 2326 $errors->add( 'validation', '<strong>Credit Card Code</strong> is invalid.' ); 2327 } 2328 } 2329 2304 $data = array( 2305 "cc_name" => wp_kses($_POST['wp99234_payment_gateway-card-name'], array()), 2306 "cc_number" => wp_kses($_POST['wp99234_payment_gateway-card-number'], array()), 2307 "cc_expiry" => wp_kses($_POST['wp99234_payment_gateway-card-expiry'], array()), 2308 "cc_cvc" => wp_kses($_POST['wp99234_payment_gateway-card-cvc'], array()) 2309 ); 2310 2311 $this->wp99234_validate_credit_card($data, $errors); 2312 } 2313 } 2314 2315 /** 2316 * Credit card validation on checkout 2317 * 2318 * This will check if using Credit Card as payment option 2319 * 2320 * @param $fields 2321 * @param $errors 2322 * 2323 * @package Troly 2324 * @since 2.9 2325 */ 2326 function wp99234_validate_credit_card_account_details( $args ) 2327 { 2328 if (!isset($_POST['wp99234_use_existing_card'])) { 2329 $data = []; 2330 foreach([ 2331 'cc_name', 2332 'cc_number', 2333 'cc_expiry', 2334 'cc_cvc', 2335 'cc_cvv' 2336 ] as $field){ 2337 if(!isset($_POST[$field])) continue; 2338 $data[$field] = wp_kses($_POST[$field], array()); 2339 } 2340 return $this->wp99234_validate_credit_card($data, $args, true); 2341 } 2342 } 2343 2344 /** 2345 * Credit card validation 2346 * 2347 * Checks if the card number and other details are valid 2348 * 2349 * @param $fields 2350 * @param $errors 2351 * 2352 * @package Troly 2353 * @since 2.9 2354 */ 2355 function wp99234_validate_credit_card( $fields, $errors, $return = false ) 2356 { 2357 2358 $validCard = true; 2359 2360 $validate_cc_number = \Inacho\CreditCard::validCreditCard($fields["cc_number"]); 2361 $code = (isset($fields["cc_cvc"]) ? $fields["cc_cvc"] : $fields["cc_cvv"]); 2362 $validCvc = \Inacho\CreditCard::validCvc($code, $validate_cc_number['type']); 2363 2364 if ( empty($fields["cc_name"]) ) { 2365 $errors->add( 'validation', '<strong>Name on Credit Card</strong> is a required field.' ); 2366 $validCard = false; 2367 } 2368 2369 if ( empty($fields["cc_number"]) ) { 2370 $errors->add( 'validation', '<strong>Credit Card Number</strong> is a required field.' ); 2371 $validCard = false; 2372 } elseif ( empty($validate_cc_number['valid']) ) { 2373 $errors->add( 'validation', '<strong>Credit Card Number</strong> is invalid.' ); 2374 $validCard = false; 2375 } 2376 2377 if ( empty($fields["cc_expiry"]) ) { 2378 $errors->add( 'validation', '<strong>Credit Card Expiry</strong> is a required field.' ); 2379 $validCard = false; 2380 } 2381 2382 if ( empty($fields["cc_cvc"]) && empty($fields["cc_cvv"]) ) { 2383 $errors->add( 'validation', '<strong>Credit Card Code</strong> is a required field.' ); 2384 $validCard = false; 2385 } elseif ( $validCvc === false || $fields["validCvc"] === false ) { 2386 $errors->add( 'validation', '<strong>Credit Card Code</strong> is invalid.' ); 2387 $validCard = false; 2388 } 2389 2390 if($return) 2391 return $validCard; 2330 2392 } 2331 2393 -
subscribility/tags/2.9.22.5/includes/frontend/views/registration_form.php
r2382505 r2476032 402 402 $formStyle => __( 'Cardholder Name', 'wp99234' ), 403 403 'default' => '', 404 'attributes' => array('required' => true, 'autocomplete' => 'cc-name') 404 'attributes' => array( 405 'required' => true, 406 'autocomplete' => 'cc-name', 407 'id' => 'troly-field-cc-name', 408 ) 405 409 ), 406 410 'cc_number' => array( … … 408 412 'default' =>'', 409 413 'attributes' => array( 410 'required' => true, 411 'class' => 'woocommerce-Input input-text', 412 'placeholder' => "•••• •••• •••• ••••", 413 'maxlength' => 19, 414 'type'=> 'tel', 415 'inputmode'=> 'numeric', 416 'autocomplete' => 'cc-number' 417 ) 418 ), 419 'cc_exp' => array( 414 'required' => true, 415 'class' => 'woocommerce-Input input-text', 416 'placeholder' => "•••• •••• •••• ••••", 417 'maxlength' => 19, 418 'type'=> 'tel', 419 'inputmode'=> 'numeric', 420 'autocomplete' => 'cc-number', 421 'id' => 'troly-field-cc-number' 422 ), 423 ), 424 'cc_expiry' => array( 420 425 $formStyle => __( 'Card Expiry Date', 'wp99234' ), 421 426 'default' => '' , … … 423 428 'placeholder' => 'MM / YYYY', 424 429 'required' => true, 425 'autocomplete' => 'cc-exp' 430 'autocomplete' => 'cc-exp', 431 'id' => 'troly-field-cc-exp' 426 432 ), 427 433 ), … … 432 438 'placeholder' => 'CVC', 433 439 'required' => true, 434 'autocomplete' => 'cc-cvv' 440 'autocomplete' => 'cc-cvv', 441 'id' => 'troly-field-cc-cvv' 435 442 ), 436 443 ) … … 453 460 foreach( $cc_fields as $key => $cc_field ){ 454 461 $css_class = null; 455 if ($key === 'cc_exp ') $css_class = 'form-row-first woocommerce-validated';462 if ($key === 'cc_expiry') $css_class = 'form-row-first woocommerce-validated'; 456 463 if ($key === 'cc_cvv') $css_class = 'form-row-last woocommerce-validated'; 457 464 -
subscribility/tags/2.9.22.5/readme.txt
r2457995 r2476032 4 4 Requires at least: 4.9.0 5 5 Tested up to: 5.4.2 6 Stable Tag: 2.9.22. 46 Stable Tag: 2.9.22.5 7 7 PHP version: 7.0 and above 8 8 License: GPLv2 or later … … 70 70 71 71 ## Changelog 72 ###Version 2.9.22.5 73 - Payment card validation fixes 74 - Bug fixes 72 75 73 76 ###Version 2.9.22 -
subscribility/tags/2.9.22.5/wp99234.php
r2457995 r2476032 4 4 * Plugin URI: https://wordpress.org/plugins/subscribility/ 5 5 * Description: Manage and fulfil your sales of wine, beers and other crafted beverages, through clubs and other direct-to-consumer sales channels. 6 * Version: 2.9.22. 46 * Version: 2.9.22.5 7 7 * Author: Troly 8 8 * Author URI: https://troly.io … … 236 236 $this->define( 'TROLY_PLUGIN_PATH', plugin_dir_path( TROLY_PLUGIN_FILE ) ); 237 237 $this->define( 'TROLY_VIEWS_PATH', TROLY_PLUGIN_PATH . 'includes' . DIRECTORY_SEPARATOR . 'frontend' . DIRECTORY_SEPARATOR . 'views' ); 238 $this->define( 'WP99234_HOST_IP', '1 03.18.108.127');238 $this->define( 'WP99234_HOST_IP', '172.105.161.151'); 239 239 $this->define( 'WP99234_DOMAIN', isset( $_ENV['TROLY_API_URL'] ) ? $_ENV['TROLY_API_URL'] : 'https://app.troly.io'); 240 240 $this->define( 'WP99234_ABSPATH', trailingslashit( WP_PLUGIN_DIR . '/' . str_replace(basename( __FILE__ ) , "" , plugin_basename( __FILE__ ) ) ) ); -
subscribility/trunk/includes/admin/controllers/class-wp99234-admin-settings-data-collection.php
r2415557 r2476032 144 144 ), 145 145 146 [147 'title' => __( 'Select customer referral coupon', 'troly' ),148 'type' => 'select',149 'desc' => __( 'Select customer referral coupon to assign it with your referral code.', 'troly' ),150 'desc_tip' => true,151 'id' => 'troly_member_referral_coupon',152 'css' => 'min-width:550px;',153 'options' => $this->getAllCoupons(),154 ],155 156 146 array( 'type' => 'sectionend', 'id' => 'sync_options' ), 157 147 ) ); -
subscribility/trunk/includes/admin/controllers/class-wp99234-admin-settings-signup-checkout.php
r2415557 r2476032 123 123 } 124 124 125 /** 126 * Get all the coupons found in the DB 127 */ 125 128 public function getAllCoupons() 126 129 { -
subscribility/trunk/includes/frontend/controllers/class-wp99234-registration-forms.php
r2382505 r2476032 103 103 'required' => __( 'Please enter your credit card number.', 'wp99234' ), 104 104 ); 105 $fields['cc_exp '] = array(105 $fields['cc_expiry'] = array( 106 106 'required' => __( 'Please enter your card expiry date.', 'wp99234' ), 107 107 'contains' => array( … … 204 204 if ( !isset( $_POST['wp99234_use_existing_card'] ) || $_POST['wp99234_use_existing_card'] !== 'yes' ) { 205 205 206 $exp_array = explode( '/', str_replace( ' ', '', wp_kses( $data['cc_exp '], array() ) ) );206 $exp_array = explode( '/', str_replace( ' ', '', wp_kses( $data['cc_expiry'], array() ) ) ); 207 207 208 208 $exp_month = $exp_array[0]; … … 280 280 $this->setNewClubSignupSession(); 281 281 } 282 283 wc_add_notice( 'Thank you for joining our club. Your membership benefits have been applied to this order.', 'success' );284 282 285 283 if ( isset($_POST) && isset($data[ 'user_pass' ]) ) { … … 300 298 if ( isset( $_GET['troly_redirect'] ) ) { 301 299 if ( $_GET['troly_redirect'] === 'cart' ) { 300 wc_add_notice( 'Thank you for joining our club. Your membership benefits have been applied to this cart.', 'success' ); 302 301 wp_redirect( wc_get_cart_url() ); 303 302 exit; 304 303 } 305 304 elseif ( $_GET['troly_redirect'] === 'checkout' ) { 305 wc_add_notice( 'Thank you for joining our club. Your membership benefits have been applied to this order.', 'success' ); 306 306 wp_redirect( wc_get_checkout_url() ); 307 307 exit; 308 308 } 309 309 elseif ( $_GET['troly_redirect'] === 'product' && ! empty( $_GET['pid'] ) ) { 310 wc_add_notice( 'Thank you for joining our club!', 'success' ); 310 311 wp_redirect( get_permalink( $_GET['pid'] ) ); 311 312 exit; 312 313 } 313 } 314 } else { 315 /* They are signing up on the page directly. */ 316 wc_add_notice( 'Thank you for joining our club!', 'success' ); 317 } 314 318 } else { 315 wc_add_notice( 'An unknown error has occurred. Please try again.', 'error' ); 319 /* Troly may have reported errors. Lets attempt to break these down and let the 320 user know that they need to amend their details */ 321 $field_mappings = [ 322 "cc_exp_month" => "Card expiry month", 323 "cc_exp_year" => "Card expiry year", 324 "cc_number" => "Card number", 325 "cc_name" => "Card name", 326 "cc_exp_date" => "Card expiry date" 327 ]; 328 if(isset($results->errors)){ 329 wc_add_notice( 'Some details could not be accepted. Please review them and try again', 'error' ); 330 foreach($results->errors as $field => $elist){ 331 if(strpos($field, '.') > -1) continue; 332 foreach($elist as $erroritem){ 333 wc_add_notice( $field_mappings[$field] . " $erroritem", 'error'); 334 } 335 } 336 } else { 337 wc_add_notice( 'An unknown error has occurred. Please try again.', 'error' ); 338 } 316 339 } 317 340 } -
subscribility/trunk/includes/frontend/controllers/class-wp99234-users.php
r2457995 r2476032 474 474 */ 475 475 if ( ! defined( 'WOOCOMMERCE_CHECKOUT' ) && ! isset( $_POST[ 'wp99234_use_existing_card' ] ) ) { 476 $cc_exp = explode('/', str_replace(' ', '', wp_kses($_POST['cc_exp '], array())));476 $cc_exp = explode('/', str_replace(' ', '', wp_kses($_POST['cc_expiry'], array()))); 477 477 478 478 if (count($cc_exp) > 1) { … … 606 606 if( ! empty( $errors ) ){ 607 607 608 if ($subs_id) { 609 $message .= "\nFailed to update user on Troly because of: {${WP99234()->get_var_dump($errors)}}"; 610 } else { 611 $message .= "\nFailed to export user to Troly because of: {${WP99234()->get_var_dump($errors)}}"; 612 } 608 $details = ''; 609 if(is_array($errors)){ 610 foreach($errors as $field => $ferrors){ 611 $details .= "{$field} "; 612 if(is_array($ferrors)){ 613 foreach($ferrors as $ferror){ 614 $details .= "{$ferror} "; 615 } 616 } else { 617 $details .= "{$ferror} "; 618 } 619 } 620 } 621 622 $message .= " failed."; 613 623 614 624 if ($reporting_options == 'verbose' || $reporting_options == 'medium') { 615 wp99234_log_troly( 0, 1, 0, $message );625 wp99234_log_troly( 0, 1, 0, $message, $details ); 616 626 } 617 627 -
subscribility/trunk/includes/frontend/controllers/class-wp99234-wc-filter.php
r2415557 r2476032 77 77 78 78 // Action to validate credit card 79 add_action( 'woocommerce_after_checkout_validation', array($this, 'wp99234_validate_credit_card'), 10, 2 ); 79 add_action( 'woocommerce_after_checkout_validation', array($this, 'wp99234_validate_credit_card_checkout'), 10, 2 ); 80 81 // Account details error handling 82 add_action('woocommerce_save_account_details_errors', array($this, 'wp99234_validate_credit_card_account_details'), 10, 1); 80 83 81 84 if ( 'checkout' === get_option( 'troly_require_dob' ) || … … 728 731 729 732 $cc_exp = '<p class="woocommerce-FormRow woocommerce-FormRow--wide form-row form-row-first">'; 730 $cc_exp .= '<label for="cc_exp ">Expiry (MM/YY)</label>';731 $cc_exp .= '<input type="tel" inputmode="numeric" class="woocommerce-Input input-text" name="cc_exp " id="cc_exp" placeholder="MM / YY"></p>';733 $cc_exp .= '<label for="cc_expiry">Expiry (MM/YY)</label>'; 734 $cc_exp .= '<input type="tel" inputmode="numeric" class="woocommerce-Input input-text" name="cc_expiry" id="cc_expiry" placeholder="MM / YY"></p>'; 732 735 733 736 $cc_cvv = '<p class="woocommerce-FormRow woocommerce-FormRow--wide form-row form-row-last">'; … … 738 741 if (is_checkout()) { 739 742 echo "<label for='wp99234_use_existing_card'>" . $use_existing_checkbox . "Use your existing card ($existing_card)</label>"; 740 } else {743 } elseif(!empty($existing_card)){ 741 744 echo "<label class='wp99234_use_existing_card' for='wp99234_use_existing_card'>" . $use_existing_checkbox . "Click here to change you current credit card ($existing_card)</label>"; 742 745 } … … 2285 2288 2286 2289 /** 2287 * Credit card validation 2290 * Credit card validation on checkout 2288 2291 * 2289 2292 * This will check if using Credit Card as payment option … … 2295 2298 * @since 2.9 2296 2299 */ 2297 function wp99234_validate_credit_card ( $fields, $errors )2300 function wp99234_validate_credit_card_checkout( $fields, $errors ) 2298 2301 { 2299 2302 if ($_POST['payment_method'] === 'wp99234_payment_gateway' && !isset($_POST['wp99234_use_existing_card'])) { 2300 2303 2301 $cc_name = wp_kses($_POST['wp99234_payment_gateway-card-name'], array()); 2302 $cc_number = wp_kses($_POST['wp99234_payment_gateway-card-number'], array()); 2303 $cc_expiry = wp_kses($_POST['wp99234_payment_gateway-card-expiry'], array()); 2304 $cc_cvc = wp_kses($_POST['wp99234_payment_gateway-card-cvc'], array()); 2305 2306 $validate_cc_number = \Inacho\CreditCard::validCreditCard($cc_number); 2307 $validCvc = \Inacho\CreditCard::validCvc($cc_cvc, $validate_cc_number['type']); 2308 2309 if ( empty($cc_name) ) { 2310 $errors->add( 'validation', '<strong>Name on Credit Card</strong> is a required field.' ); 2311 } 2312 2313 if ( empty($cc_number) ) { 2314 $errors->add( 'validation', '<strong>Credit Card Number</strong> is a required field.' ); 2315 } elseif ( empty($validate_cc_number['valid']) ) { 2316 $errors->add( 'validation', '<strong>Credit Card Number</strong> is invalid.' ); 2317 } 2318 2319 if ( empty($cc_expiry) ) { 2320 $errors->add( 'validation', '<strong>Credit Card Expiry</strong> is a required field.' ); 2321 } 2322 2323 if ( empty($cc_cvc) ) { 2324 $errors->add( 'validation', '<strong>Credit Card Code</strong> is a required field.' ); 2325 } elseif ( $validCvc === false ) { 2326 $errors->add( 'validation', '<strong>Credit Card Code</strong> is invalid.' ); 2327 } 2328 } 2329 2304 $data = array( 2305 "cc_name" => wp_kses($_POST['wp99234_payment_gateway-card-name'], array()), 2306 "cc_number" => wp_kses($_POST['wp99234_payment_gateway-card-number'], array()), 2307 "cc_expiry" => wp_kses($_POST['wp99234_payment_gateway-card-expiry'], array()), 2308 "cc_cvc" => wp_kses($_POST['wp99234_payment_gateway-card-cvc'], array()) 2309 ); 2310 2311 $this->wp99234_validate_credit_card($data, $errors); 2312 } 2313 } 2314 2315 /** 2316 * Credit card validation on checkout 2317 * 2318 * This will check if using Credit Card as payment option 2319 * 2320 * @param $fields 2321 * @param $errors 2322 * 2323 * @package Troly 2324 * @since 2.9 2325 */ 2326 function wp99234_validate_credit_card_account_details( $args ) 2327 { 2328 if (!isset($_POST['wp99234_use_existing_card'])) { 2329 $data = []; 2330 foreach([ 2331 'cc_name', 2332 'cc_number', 2333 'cc_expiry', 2334 'cc_cvc', 2335 'cc_cvv' 2336 ] as $field){ 2337 if(!isset($_POST[$field])) continue; 2338 $data[$field] = wp_kses($_POST[$field], array()); 2339 } 2340 return $this->wp99234_validate_credit_card($data, $args, true); 2341 } 2342 } 2343 2344 /** 2345 * Credit card validation 2346 * 2347 * Checks if the card number and other details are valid 2348 * 2349 * @param $fields 2350 * @param $errors 2351 * 2352 * @package Troly 2353 * @since 2.9 2354 */ 2355 function wp99234_validate_credit_card( $fields, $errors, $return = false ) 2356 { 2357 2358 $validCard = true; 2359 2360 $validate_cc_number = \Inacho\CreditCard::validCreditCard($fields["cc_number"]); 2361 $code = (isset($fields["cc_cvc"]) ? $fields["cc_cvc"] : $fields["cc_cvv"]); 2362 $validCvc = \Inacho\CreditCard::validCvc($code, $validate_cc_number['type']); 2363 2364 if ( empty($fields["cc_name"]) ) { 2365 $errors->add( 'validation', '<strong>Name on Credit Card</strong> is a required field.' ); 2366 $validCard = false; 2367 } 2368 2369 if ( empty($fields["cc_number"]) ) { 2370 $errors->add( 'validation', '<strong>Credit Card Number</strong> is a required field.' ); 2371 $validCard = false; 2372 } elseif ( empty($validate_cc_number['valid']) ) { 2373 $errors->add( 'validation', '<strong>Credit Card Number</strong> is invalid.' ); 2374 $validCard = false; 2375 } 2376 2377 if ( empty($fields["cc_expiry"]) ) { 2378 $errors->add( 'validation', '<strong>Credit Card Expiry</strong> is a required field.' ); 2379 $validCard = false; 2380 } 2381 2382 if ( empty($fields["cc_cvc"]) && empty($fields["cc_cvv"]) ) { 2383 $errors->add( 'validation', '<strong>Credit Card Code</strong> is a required field.' ); 2384 $validCard = false; 2385 } elseif ( $validCvc === false || $fields["validCvc"] === false ) { 2386 $errors->add( 'validation', '<strong>Credit Card Code</strong> is invalid.' ); 2387 $validCard = false; 2388 } 2389 2390 if($return) 2391 return $validCard; 2330 2392 } 2331 2393 -
subscribility/trunk/includes/frontend/views/registration_form.php
r2382505 r2476032 402 402 $formStyle => __( 'Cardholder Name', 'wp99234' ), 403 403 'default' => '', 404 'attributes' => array('required' => true, 'autocomplete' => 'cc-name') 404 'attributes' => array( 405 'required' => true, 406 'autocomplete' => 'cc-name', 407 'id' => 'troly-field-cc-name', 408 ) 405 409 ), 406 410 'cc_number' => array( … … 408 412 'default' =>'', 409 413 'attributes' => array( 410 'required' => true, 411 'class' => 'woocommerce-Input input-text', 412 'placeholder' => "•••• •••• •••• ••••", 413 'maxlength' => 19, 414 'type'=> 'tel', 415 'inputmode'=> 'numeric', 416 'autocomplete' => 'cc-number' 417 ) 418 ), 419 'cc_exp' => array( 414 'required' => true, 415 'class' => 'woocommerce-Input input-text', 416 'placeholder' => "•••• •••• •••• ••••", 417 'maxlength' => 19, 418 'type'=> 'tel', 419 'inputmode'=> 'numeric', 420 'autocomplete' => 'cc-number', 421 'id' => 'troly-field-cc-number' 422 ), 423 ), 424 'cc_expiry' => array( 420 425 $formStyle => __( 'Card Expiry Date', 'wp99234' ), 421 426 'default' => '' , … … 423 428 'placeholder' => 'MM / YYYY', 424 429 'required' => true, 425 'autocomplete' => 'cc-exp' 430 'autocomplete' => 'cc-exp', 431 'id' => 'troly-field-cc-exp' 426 432 ), 427 433 ), … … 432 438 'placeholder' => 'CVC', 433 439 'required' => true, 434 'autocomplete' => 'cc-cvv' 440 'autocomplete' => 'cc-cvv', 441 'id' => 'troly-field-cc-cvv' 435 442 ), 436 443 ) … … 453 460 foreach( $cc_fields as $key => $cc_field ){ 454 461 $css_class = null; 455 if ($key === 'cc_exp ') $css_class = 'form-row-first woocommerce-validated';462 if ($key === 'cc_expiry') $css_class = 'form-row-first woocommerce-validated'; 456 463 if ($key === 'cc_cvv') $css_class = 'form-row-last woocommerce-validated'; 457 464 -
subscribility/trunk/readme.txt
r2457995 r2476032 4 4 Requires at least: 4.9.0 5 5 Tested up to: 5.4.2 6 Stable Tag: 2.9.22. 46 Stable Tag: 2.9.22.5 7 7 PHP version: 7.0 and above 8 8 License: GPLv2 or later … … 70 70 71 71 ## Changelog 72 ###Version 2.9.22.5 73 - Payment card validation fixes 74 - Bug fixes 72 75 73 76 ###Version 2.9.22 -
subscribility/trunk/wp99234.php
r2457995 r2476032 4 4 * Plugin URI: https://wordpress.org/plugins/subscribility/ 5 5 * Description: Manage and fulfil your sales of wine, beers and other crafted beverages, through clubs and other direct-to-consumer sales channels. 6 * Version: 2.9.22. 46 * Version: 2.9.22.5 7 7 * Author: Troly 8 8 * Author URI: https://troly.io … … 236 236 $this->define( 'TROLY_PLUGIN_PATH', plugin_dir_path( TROLY_PLUGIN_FILE ) ); 237 237 $this->define( 'TROLY_VIEWS_PATH', TROLY_PLUGIN_PATH . 'includes' . DIRECTORY_SEPARATOR . 'frontend' . DIRECTORY_SEPARATOR . 'views' ); 238 $this->define( 'WP99234_HOST_IP', '1 03.18.108.127');238 $this->define( 'WP99234_HOST_IP', '172.105.161.151'); 239 239 $this->define( 'WP99234_DOMAIN', isset( $_ENV['TROLY_API_URL'] ) ? $_ENV['TROLY_API_URL'] : 'https://app.troly.io'); 240 240 $this->define( 'WP99234_ABSPATH', trailingslashit( WP_PLUGIN_DIR . '/' . str_replace(basename( __FILE__ ) , "" , plugin_basename( __FILE__ ) ) ) );
Note: See TracChangeset
for help on using the changeset viewer.