Changeset 2918841
- Timestamp:
- 05/30/2023 07:28:55 AM (3 years ago)
- Location:
- valorpos
- Files:
-
- 14 edited
- 5 copied
-
tags/7.3.0 (copied) (copied from valorpos/trunk)
-
tags/7.3.0/README.txt (copied) (copied from valorpos/trunk/README.txt) (2 diffs)
-
tags/7.3.0/admin/class-wc-valorpay-admin.php (modified) (1 diff)
-
tags/7.3.0/includes/class-wc-valorpay-api.php (modified) (3 diffs)
-
tags/7.3.0/includes/class-wc-valorpay-gateway.php (modified) (3 diffs)
-
tags/7.3.0/includes/class-wc-valorpay.php (modified) (2 diffs)
-
tags/7.3.0/languages/wc-valorpay.pot (copied) (copied from valorpos/trunk/languages/wc-valorpay.pot) (5 diffs)
-
tags/7.3.0/public/class-wc-valorpay-public.php (modified) (1 diff)
-
tags/7.3.0/public/js/wc-valorpay-checkout.js (copied) (copied from valorpos/trunk/public/js/wc-valorpay-checkout.js) (1 diff)
-
tags/7.3.0/wc-valorpay.php (copied) (copied from valorpos/trunk/wc-valorpay.php) (2 diffs)
-
trunk/README.txt (modified) (2 diffs)
-
trunk/admin/class-wc-valorpay-admin.php (modified) (1 diff)
-
trunk/includes/class-wc-valorpay-api.php (modified) (3 diffs)
-
trunk/includes/class-wc-valorpay-gateway.php (modified) (3 diffs)
-
trunk/includes/class-wc-valorpay.php (modified) (2 diffs)
-
trunk/languages/wc-valorpay.pot (modified) (5 diffs)
-
trunk/public/class-wc-valorpay-public.php (modified) (1 diff)
-
trunk/public/js/wc-valorpay-checkout.js (modified) (1 diff)
-
trunk/wc-valorpay.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
valorpos/tags/7.3.0/README.txt
r2897749 r2918841 3 3 Tags: payment, payment gateway, credit card, valor pay, valor paytech 4 4 Requires at least: 5.0 5 Tested up to: 6. 1.15 Tested up to: 6.2.2 6 6 Requires PHP: 7.0 7 Stable tag: 7. 2.17 Stable tag: 7.3.0 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 41 41 == Changelog == 42 42 43 = 7.3.0 = 44 * Added validation to card fields & Tax amount separated from sub total. 45 43 46 = 7.2.1 = 44 47 * Change event listener selector for payment method. -
valorpos/tags/7.3.0/admin/class-wc-valorpay-admin.php
r2883367 r2918841 308 308 } 309 309 310 310 311 } -
valorpos/tags/7.3.0/includes/class-wc-valorpay-api.php
r2887504 r2918841 170 170 } 171 171 } 172 173 172 $billing_first_name = wc_clean( $order->get_billing_first_name() ); 174 173 $billing_last_name = wc_clean( $order->get_billing_last_name() ); … … 186 185 $billing_email = wc_clean( $order->get_billing_email() ); 187 186 $tax_amount = wc_clean( $order->get_total_tax() ); 187 $amount = $amount - $tax_amount; 188 188 $ip_address = wc_clean( $order->get_customer_ip_address() ); 189 189 $valorpay_avs_zip = ( isset( $_POST['valorpay_avs_zip'] ) && $_POST['valorpay_avs_zip'] ) ? sanitize_text_field( wp_unslash( $_POST['valorpay_avs_zip'] ) ) : wc_clean( substr( $billing_postcode, 0, 10 ) ); // phpcs:ignore … … 201 201 'email' => $billing_email, 202 202 'uid' => $order_number, 203 'tax '=> number_format( $tax_amount, '2', '.', '' ),203 'tax_amount' => number_format( $tax_amount, '2', '.', '' ), 204 204 'ip' => $ip_address, 205 205 'surchargeIndicator' => $surcharge_indicator, -
valorpos/tags/7.3.0/includes/class-wc-valorpay-gateway.php
r2887504 r2918841 266 266 $this->valorpay_acknowledgement_form(); 267 267 } 268 /** 269 * Luhn check. 270 * 271 * @since 7.3.0 272 * @param string $account_number Account Number. 273 * @return object 274 */ 275 public function luhn_check( $account_number ) { 276 for ( $sum = 0, $i = 0, $ix = strlen( $account_number ); $i < $ix - 1; $i++ ) { 277 $weight = substr( $account_number, $ix - ( $i + 2 ), 1 ) * ( 2 - ( $i % 2 ) ); 278 $sum += $weight < 10 ? $weight : $weight - 9; 279 280 } 281 if ( 0 !== $sum ) { 282 return ( (int) substr( $account_number, $ix - 1 ) ) === ( ( 10 - $sum % 10 ) % 10 ); 283 } else { 284 return false; 285 } 286 } 287 /** 288 * Get card information. 289 * 290 * @since 7.3.0 291 * @return object 292 */ 293 private function get_posted_card() { 294 $card_number = isset( $_POST['wc_valorpay-card-number'] ) ? wc_clean( $_POST['wc_valorpay-card-number'] ) : ''; // phpcs:ignore 295 $card_cvc = isset( $_POST['wc_valorpay-card-cvc'] ) ? wc_clean( $_POST['wc_valorpay-card-cvc'] ) : ''; // phpcs:ignore 296 $card_expiry = isset( $_POST['wc_valorpay-card-expiry'] ) ? wc_clean( $_POST['wc_valorpay-card-expiry'] ) : ''; // phpcs:ignore 297 $card_number = str_replace( array( ' ', '-' ), '', $card_number ); 298 $card_expiry = array_map( 'trim', explode( '/', $card_expiry ) ); 299 $card_exp_month = str_pad( $card_expiry[0], 2, '0', STR_PAD_LEFT ); 300 $card_exp_year = isset( $card_expiry[1] ) ? $card_expiry[1] : ''; 301 if ( 2 === strlen( $card_exp_year ) ) { 302 $card_exp_year += 2000; 303 } 304 return (object) array( 305 'number' => $card_number, 306 'type' => '', 307 'cvc' => $card_cvc, 308 'exp_month' => $card_exp_month, 309 'exp_year' => $card_exp_year, 310 ); 311 } 312 313 /** 314 * Validate frontend fields. 315 * 316 * Validate payment fields on the frontend. 317 * 318 * @since 7.3.0 319 * @throws \Exception If the card information is invalid. 320 * @return bool 321 */ 322 public function validate_fields() { 323 try { 324 if ( isset( $_POST['wc-wc_valorpay-payment-token'] ) && 'new' !== wc_clean( $_POST['wc-wc_valorpay-payment-token'] ) ) { // phpcs:ignore 325 return true; 326 } 327 $card = $this->get_posted_card(); 328 $current_year = gmdate( 'Y' ); 329 $current_month = gmdate( 'n' ); 330 331 if ( empty( $card->number ) || ! ctype_digit( $card->number ) || strlen( $card->number ) < 12 || strlen( $card->number ) > 19 ) { 332 throw new Exception( __( 'Card number is invalid', 'wc-valorpay' ) ); 333 } 334 335 if ( ! ( $this->luhn_check( $card->number ) ) ) { 336 throw new Exception( __( 'Not a valid card', 'wc-valorpay' ) ); 337 } 338 if ( empty( $card->exp_month ) || empty( $card->exp_year ) || ! ctype_digit( $card->exp_month ) || ! ctype_digit( $card->exp_year ) || $card->exp_month > 12 || $card->exp_month < 1 || $card->exp_year < $current_year || ( $card->exp_year === $current_year && $card->exp_month < $current_month ) ) { 339 throw new Exception( __( 'Card number expired', 'wc-valorpay' ) ); 340 } 341 if ( ! ctype_digit( $card->cvc ) ) { 342 throw new Exception( __( 'Card security code is invalid (only digits are allowed)', 'wc-valorpay' ) ); 343 } 344 345 return true; 346 } catch ( Exception $e ) { 347 wc_add_notice( $e->getMessage(), 'error' ); 348 return false; 349 } 350 } 268 351 269 352 /** … … 519 602 * 520 603 * @since 1.0.0 604 */ 605 public function add_card_field_id() { 606 607 $fields['card-number-field']['label_class'] .= ' woocommerce-input-wrapper'; 608 $fields['card-number-field']['class'][] = 'form-row-wide'; 609 $fields['card-number-field']['id'] = 'wc-valorpay-card-field'; 610 return $fields; 611 } 612 613 /** 614 * Surcharge admin validation. 615 * 616 * @since 7.2.0 521 617 */ 522 618 public function process_admin_options() { … … 780 876 } 781 877 878 879 880 782 881 } 882 883 884 885 -
valorpos/tags/7.3.0/includes/class-wc-valorpay.php
r2883367 r2918841 202 202 $this->loader->add_action( 'woocommerce_after_checkout_form', $plugin_public, 'valorpay_checkout_script' ); 203 203 $this->loader->add_filter( 'woocommerce_available_payment_gateways', $plugin_public, 'valorpay_disable_payment_gateway_failed_orders' ); 204 204 205 } 205 206 … … 245 246 246 247 } 248 -
valorpos/tags/7.3.0/languages/wc-valorpay.pot
r2897749 r2918841 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Valor Pay 7. 2.1\n"5 "Project-Id-Version: Valor Pay 7.3.0\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wc-valorpay\n" 7 7 "Last-Translator: Valor Paytech LLC <sales@valorpaytech.com>\n" … … 9 9 "Content-Type: text/plain; charset=UTF-8\n" 10 10 "Content-Transfer-Encoding: 8bit\n" 11 "POT-Creation-Date: 2023-0 3-27T15:16:11+05:30\n"11 "POT-Creation-Date: 2023-05-19T15:31:04+05:30\n" 12 12 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 13 13 "X-Generator: WP-CLI 2.7.1\n" … … 15 15 16 16 #. Plugin Name of the plugin 17 #: includes/class-wc-valorpay-gateway.php: 37217 #: includes/class-wc-valorpay-gateway.php:455 18 18 msgid "Valor Pay" 19 19 msgstr "" … … 69 69 70 70 #: admin/partials/wc-valorpay-admin-failure-tracker.php:18 71 #: includes/class-wc-valorpay-gateway.php: 46071 #: includes/class-wc-valorpay-gateway.php:543 72 72 msgid "Payment Failed Tracker" 73 73 msgstr "" … … 169 169 msgstr "" 170 170 171 #: includes/class-wc-valorpay-gateway.php:332 172 msgid "Card number is invalid" 173 msgstr "" 174 175 #: includes/class-wc-valorpay-gateway.php:336 176 msgid "Not a valid card" 177 msgstr "" 178 179 #: includes/class-wc-valorpay-gateway.php:339 180 msgid "Card number expired" 181 msgstr "" 182 183 #: includes/class-wc-valorpay-gateway.php:342 184 msgid "Card security code is invalid (only digits are allowed)" 185 msgstr "" 186 171 187 #. translators: 1: Terms and Conditions URL. 172 #: includes/class-wc-valorpay-gateway.php: 295188 #: includes/class-wc-valorpay-gateway.php:378 173 189 msgid "I agree to the <a href=\"%s\" target=\"_blank\">Terms and Conditions</a>" 174 190 msgstr "" 175 191 176 #: includes/class-wc-valorpay-gateway.php: 326177 #: includes/class-wc-valorpay-gateway.php: 327192 #: includes/class-wc-valorpay-gateway.php:409 193 #: includes/class-wc-valorpay-gateway.php:410 178 194 msgid "Zip Code" 179 195 msgstr "" 180 196 181 #: includes/class-wc-valorpay-gateway.php: 340182 #: includes/class-wc-valorpay-gateway.php: 341197 #: includes/class-wc-valorpay-gateway.php:423 198 #: includes/class-wc-valorpay-gateway.php:424 183 199 msgid "Street No" 184 200 msgstr "" 185 201 186 #: includes/class-wc-valorpay-gateway.php: 362202 #: includes/class-wc-valorpay-gateway.php:445 187 203 msgid "Enable/Disable" 188 204 msgstr "" 189 205 190 #: includes/class-wc-valorpay-gateway.php: 363206 #: includes/class-wc-valorpay-gateway.php:446 191 207 msgid "Enable Valor Pay" 192 208 msgstr "" 193 209 194 #: includes/class-wc-valorpay-gateway.php: 369210 #: includes/class-wc-valorpay-gateway.php:452 195 211 msgid "Title" 196 212 msgstr "" 197 213 198 #: includes/class-wc-valorpay-gateway.php: 371214 #: includes/class-wc-valorpay-gateway.php:454 199 215 msgid "This controls the title which the user sees during checkout." 200 216 msgstr "" 201 217 202 #: includes/class-wc-valorpay-gateway.php: 376218 #: includes/class-wc-valorpay-gateway.php:459 203 219 msgid "Use Sandbox" 204 220 msgstr "" 205 221 206 #: includes/class-wc-valorpay-gateway.php: 377222 #: includes/class-wc-valorpay-gateway.php:460 207 223 msgid "Enable sandbox mode - live payments will not be taken if enabled." 208 224 msgstr "" 209 225 210 #: includes/class-wc-valorpay-gateway.php: 383226 #: includes/class-wc-valorpay-gateway.php:466 211 227 msgid "APP ID" 212 228 msgstr "" 213 229 214 #: includes/class-wc-valorpay-gateway.php: 385230 #: includes/class-wc-valorpay-gateway.php:468 215 231 msgid "Please email support@valorpaytech.com to get to know about your APP ID, ( In demo mode APP ID is not needed )" 216 232 msgstr "" 217 233 218 #: includes/class-wc-valorpay-gateway.php: 389234 #: includes/class-wc-valorpay-gateway.php:472 219 235 msgid "APP KEY" 220 236 msgstr "" 221 237 222 #: includes/class-wc-valorpay-gateway.php: 391238 #: includes/class-wc-valorpay-gateway.php:474 223 239 msgid "Please email support@valorpaytech.com to get to know about your APP KEY, ( In demo mode APP KEY is not needed )" 224 240 msgstr "" 225 241 226 #: includes/class-wc-valorpay-gateway.php: 395242 #: includes/class-wc-valorpay-gateway.php:478 227 243 msgid "EPI" 228 244 msgstr "" 229 245 230 #: includes/class-wc-valorpay-gateway.php: 397246 #: includes/class-wc-valorpay-gateway.php:480 231 247 msgid "Please email support@valorpaytech.com to get to know about your EPI ID, ( In demo mode EPI ID is not needed )" 232 248 msgstr "" 233 249 234 #: includes/class-wc-valorpay-gateway.php:4 01250 #: includes/class-wc-valorpay-gateway.php:484 235 251 msgid "Payment Method" 236 252 msgstr "" 237 253 238 #: includes/class-wc-valorpay-gateway.php:4 11254 #: includes/class-wc-valorpay-gateway.php:494 239 255 msgid "Surcharge Mode" 240 256 msgstr "" 241 257 242 #: includes/class-wc-valorpay-gateway.php:4 12243 #: includes/class-wc-valorpay-gateway.php: 419258 #: includes/class-wc-valorpay-gateway.php:495 259 #: includes/class-wc-valorpay-gateway.php:502 244 260 msgid "Enable Surcharge Mode" 245 261 msgstr "" 246 262 247 #: includes/class-wc-valorpay-gateway.php:4 14263 #: includes/class-wc-valorpay-gateway.php:497 248 264 msgid "Enable only if you want all transactions to be fall on surcharge mode, Merchant must have got an Surcharge MID inorder to work" 249 265 msgstr "" 250 266 251 #: includes/class-wc-valorpay-gateway.php: 418267 #: includes/class-wc-valorpay-gateway.php:501 252 268 msgid "Surcharge Type" 253 269 msgstr "" 254 270 255 #: includes/class-wc-valorpay-gateway.php: 428256 #: includes/class-wc-valorpay-gateway.php: 429271 #: includes/class-wc-valorpay-gateway.php:511 272 #: includes/class-wc-valorpay-gateway.php:512 257 273 msgid "Surcharge Label" 258 274 msgstr "" 259 275 260 #: includes/class-wc-valorpay-gateway.php: 434276 #: includes/class-wc-valorpay-gateway.php:517 261 277 msgid "Surcharge %" 262 278 msgstr "" 263 279 264 #: includes/class-wc-valorpay-gateway.php: 438280 #: includes/class-wc-valorpay-gateway.php:521 265 281 msgid "Percentage will apply only on enabling on surcharge Indicator to true and Surcharge type is set fo Surcharge %" 266 282 msgstr "" 267 283 268 #: includes/class-wc-valorpay-gateway.php: 441284 #: includes/class-wc-valorpay-gateway.php:524 269 285 msgid "Flat Rate $" 270 286 msgstr "" 271 287 272 #: includes/class-wc-valorpay-gateway.php: 444288 #: includes/class-wc-valorpay-gateway.php:527 273 289 msgid "Flat rate will apply only on if Enable surcharge mode is true and Surcharge type is set to Flat Rate $" 274 290 msgstr "" 275 291 276 #: includes/class-wc-valorpay-gateway.php: 447292 #: includes/class-wc-valorpay-gateway.php:530 277 293 msgid "AVS" 278 294 msgstr "" 279 295 280 #: includes/class-wc-valorpay-gateway.php: 457296 #: includes/class-wc-valorpay-gateway.php:540 281 297 msgid "The address verification service will add a text field to the checkout page based on the above option." 282 298 msgstr "" 283 299 284 #: includes/class-wc-valorpay-gateway.php: 461300 #: includes/class-wc-valorpay-gateway.php:544 285 301 msgid "Enable Protection" 286 302 msgstr "" 287 303 288 304 #. translators: 1: Tracker URL. 289 #: includes/class-wc-valorpay-gateway.php: 465305 #: includes/class-wc-valorpay-gateway.php:548 290 306 msgid "Disable the payment method in the checkout page for failed transactions. <a id=\"valorpay-goto-tracker\" href=\"%s\">Unblock IP</a>" 291 307 msgstr "" 292 308 293 #: includes/class-wc-valorpay-gateway.php: 471309 #: includes/class-wc-valorpay-gateway.php:554 294 310 msgid "Declined Transaction Count" 295 311 msgstr "" 296 312 297 #: includes/class-wc-valorpay-gateway.php: 472313 #: includes/class-wc-valorpay-gateway.php:555 298 314 msgid "Number of declined transaction count." 299 315 msgstr "" 300 316 301 #: includes/class-wc-valorpay-gateway.php: 476317 #: includes/class-wc-valorpay-gateway.php:559 302 318 msgid "3" 303 319 msgstr "" 304 320 305 #: includes/class-wc-valorpay-gateway.php: 477321 #: includes/class-wc-valorpay-gateway.php:560 306 322 msgid "5" 307 323 msgstr "" 308 324 309 #: includes/class-wc-valorpay-gateway.php: 478325 #: includes/class-wc-valorpay-gateway.php:561 310 326 msgid "6" 311 327 msgstr "" 312 328 313 #: includes/class-wc-valorpay-gateway.php: 482329 #: includes/class-wc-valorpay-gateway.php:565 314 330 msgid "Block Payment For" 315 331 msgstr "" 316 332 317 #: includes/class-wc-valorpay-gateway.php: 483333 #: includes/class-wc-valorpay-gateway.php:566 318 334 msgid "Minutes to block payment gateway in checkout." 319 335 msgstr "" 320 336 321 #: includes/class-wc-valorpay-gateway.php: 487337 #: includes/class-wc-valorpay-gateway.php:570 322 338 msgid "1 min" 323 339 msgstr "" 324 340 325 #: includes/class-wc-valorpay-gateway.php: 488341 #: includes/class-wc-valorpay-gateway.php:571 326 342 msgid "5 min" 327 343 msgstr "" 328 344 329 #: includes/class-wc-valorpay-gateway.php: 489345 #: includes/class-wc-valorpay-gateway.php:572 330 346 msgid "10 min" 331 347 msgstr "" 332 348 333 #: includes/class-wc-valorpay-gateway.php: 490349 #: includes/class-wc-valorpay-gateway.php:573 334 350 msgid "1 hour" 335 351 msgstr "" 336 352 337 #: includes/class-wc-valorpay-gateway.php: 491353 #: includes/class-wc-valorpay-gateway.php:574 338 354 msgid "3 hour" 339 355 msgstr "" 340 356 341 #: includes/class-wc-valorpay-gateway.php: 492357 #: includes/class-wc-valorpay-gateway.php:575 342 358 msgid "5 hour" 343 359 msgstr "" 344 360 345 #: includes/class-wc-valorpay-gateway.php: 493361 #: includes/class-wc-valorpay-gateway.php:576 346 362 msgid "10 hour" 347 363 msgstr "" 348 364 349 #: includes/class-wc-valorpay-gateway.php: 494365 #: includes/class-wc-valorpay-gateway.php:577 350 366 msgid "1 day" 351 367 msgstr "" 352 368 353 #: includes/class-wc-valorpay-gateway.php: 498369 #: includes/class-wc-valorpay-gateway.php:581 354 370 msgid "Accepted Cards" 355 371 msgstr "" 356 372 357 #: includes/class-wc-valorpay-gateway.php:5 02373 #: includes/class-wc-valorpay-gateway.php:585 358 374 msgid "Select the card types to accept." 359 375 msgstr "" 360 376 361 377 #. translators: 1: Maximum percentage. 362 #: includes/class-wc-valorpay-gateway.php: 528378 #: includes/class-wc-valorpay-gateway.php:624 363 379 msgid "Surcharge percentage cannot be more than %s" 364 380 msgstr "" 365 381 366 382 #. translators: 1: Maximum flat rate. 367 #: includes/class-wc-valorpay-gateway.php: 533383 #: includes/class-wc-valorpay-gateway.php:629 368 384 msgid "Surcharge flat rate cannot be more than %s" 369 385 msgstr "" 370 386 371 #: includes/class-wc-valorpay-gateway.php: 578387 #: includes/class-wc-valorpay-gateway.php:674 372 388 msgid "Invalid card information." 373 389 msgstr "" 374 390 375 391 #. translators: 1: Error Message, 2: Amount, 3: Line Break, 4: Approval Code, 5: Line Break, 6: RRN Number. 376 #: includes/class-wc-valorpay-gateway.php: 594392 #: includes/class-wc-valorpay-gateway.php:690 377 393 msgid "Valor Pay %1$s for %2$s.%3$s <strong>Approval Code:</strong> %4$s.%5$s <strong>RRN:</strong> %6$s" 378 394 msgstr "" 379 395 380 396 #. translators: %s: API Error Message. 381 #: includes/class-wc-valorpay-gateway.php: 630382 #: includes/class-wc-valorpay-gateway.php: 633397 #: includes/class-wc-valorpay-gateway.php:726 398 #: includes/class-wc-valorpay-gateway.php:729 383 399 msgid "Payment error: %s" 384 400 msgstr "" 385 401 386 #: includes/class-wc-valorpay-gateway.php: 635402 #: includes/class-wc-valorpay-gateway.php:731 387 403 msgid "Unable to process the transaction using Valor Pay, please try again." 388 404 msgstr "" 389 405 390 406 #. translators: 1: Disable Time, 2: Unblock IP URL, 3: Customer IP. 391 #: includes/class-wc-valorpay-gateway.php: 694407 #: includes/class-wc-valorpay-gateway.php:790 392 408 msgid "Valor Pay method is disabled for %1$s. <a target=\"_blank\" href=\"%2$s\">To Unblock IP</a> %3$s" 393 409 msgstr "" 394 410 395 #: includes/class-wc-valorpay-gateway.php: 757411 #: includes/class-wc-valorpay-gateway.php:853 396 412 msgid "Refund failed." 397 413 msgstr "" 398 414 399 415 #. translators: 1: Amount, 2: Line Break, 3: Approval code, 4: Line Break, 5: RRN Code 400 #: includes/class-wc-valorpay-gateway.php: 769416 #: includes/class-wc-valorpay-gateway.php:865 401 417 msgid "Valor Pay Refund for %1$s.%2$s <strong>Approval Code:</strong> %3$s.%4$s <strong>RRN:</strong> %5$s" 402 418 msgstr "" 403 419 404 #: public/class-wc-valorpay-public.php:93 420 #: public/class-wc-valorpay-public.php:80 421 msgid "Please enter a card number" 422 msgstr "" 423 424 #: public/class-wc-valorpay-public.php:81 425 msgid "Invalid card number" 426 msgstr "" 427 428 #: public/class-wc-valorpay-public.php:82 429 msgid "Card is expired" 430 msgstr "" 431 432 #: public/class-wc-valorpay-public.php:83 433 msgid "Please enter card expiry date" 434 msgstr "" 435 436 #: public/class-wc-valorpay-public.php:84 437 msgid "Please enter a CVC" 438 msgstr "" 439 440 #: public/class-wc-valorpay-public.php:85 441 msgid "Invalid CVC length" 442 msgstr "" 443 444 #: public/class-wc-valorpay-public.php:86 445 msgid "Please enter a zip code" 446 msgstr "" 447 448 #: public/class-wc-valorpay-public.php:87 449 msgid "Invalid zip code" 450 msgstr "" 451 452 #: public/class-wc-valorpay-public.php:88 453 msgid "Please enter a street address" 454 msgstr "" 455 456 #: public/class-wc-valorpay-public.php:108 405 457 msgid "Zip Code is required." 406 458 msgstr "" 407 459 408 #: public/class-wc-valorpay-public.php: 96460 #: public/class-wc-valorpay-public.php:111 409 461 msgid "Enter a valid Zip Code." 410 462 msgstr "" 411 463 412 #: public/class-wc-valorpay-public.php:1 01464 #: public/class-wc-valorpay-public.php:116 413 465 msgid "Street No is required." 414 466 msgstr "" 415 467 416 #: public/class-wc-valorpay-public.php:1 04468 #: public/class-wc-valorpay-public.php:119 417 469 msgid "Enter a valid Street No." 418 470 msgstr "" -
valorpos/tags/7.3.0/public/class-wc-valorpay-public.php
r2887504 r2918841 74 74 75 75 wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wc-valorpay-checkout.js', array( 'jquery' ), $this->version, false ); 76 wp_localize_script( 77 $this->plugin_name, 78 'valorpay_checkout_object', 79 array( 80 'error_card' => __( 'Please enter a card number', 'wc-valorpay' ), 81 'invalid_card' => __( 'Invalid card number', 'wc-valorpay' ), 82 'expiry_card' => __( 'Card is expired', 'wc-valorpay' ), 83 'invalid_expiry' => __( 'Please enter card expiry date', 'wc-valorpay' ), 84 'error_cvv' => __( 'Please enter a CVC', 'wc-valorpay' ), 85 'invalid_cvv' => __( 'Invalid CVC length', 'wc-valorpay' ), 86 'avs_zip_error' => __( 'Please enter a zip code', 'wc-valorpay' ), 87 'invalid_avs_zip_error' => __( 'Invalid zip code', 'wc-valorpay' ), 88 'avs_street_error' => __( 'Please enter a street address', 'wc-valorpay' ), 89 ) 90 ); 76 91 77 92 } -
valorpos/tags/7.3.0/public/js/wc-valorpay-checkout.js
r2897749 r2918841 6 6 */ 7 7 8 (function( $ ) { 9 'use strict'; 10 11 $( 'body' ).on( 12 'change', 13 'input[name="payment_method"]', 14 function(){ 15 $( 'body' ).trigger( 'update_checkout' ); 16 } 17 ); 18 19 })( jQuery ); 8 (function($) { 9 "use strict"; 10 11 var validcard = false; 12 var validcardexpiry = false; 13 var validcvc = false; 14 let luhnCheck = function(num) { 15 var digit, digits, odd, sum, _i, _len; 16 odd = true; 17 sum = 0; 18 digits = (num + "").split("").reverse(); 19 for (_i = 0, _len = digits.length; _i < _len; _i++) { 20 digit = digits[_i]; 21 digit = parseInt(digit, 10); 22 if ((odd = !odd)) { 23 digit *= 2; 24 } 25 if (digit > 9) { 26 digit -= 9; 27 } 28 sum += digit; 29 } 30 return sum % 10 === 0.0; 31 }; 32 33 $(document).ready(function() { 34 $("body").on("change", 'input[name="payment_method"]', function() { 35 $("body").trigger("update_checkout"); 36 }); 37 $("body").on("blur", 'input[name="wc_valorpay-card-number"]', function() { 38 if ($("#payment_method_wc_valorpay").is(":checked")) { 39 var cardNum = $(this).val().replace(/ /g, ""); 40 var isValid = luhnCheck(cardNum); 41 42 if (cardNum === "") { 43 $(this).addClass("error-class"); 44 if (!$(this).next().hasClass("error-message")) { 45 $( 46 '<span class="error-message" style="color:red;">' + 47 valorpay_checkout_object.error_card + 48 "</span>" 49 ).insertAfter($(this)); 50 } 51 $("#wc-wc_valorpay-card-number-error").remove(); 52 validcard = false; 53 $(this).parent().addClass("woocommerce-invalid"); 54 } else if (!isValid) { 55 $(this).addClass("error-class"); 56 if (!$(this).next().hasClass("error-message")) { 57 $( 58 '<span class="error-message" style="color:red;">' + 59 valorpay_checkout_object.invalid_card + 60 "</span>" 61 ).insertAfter($(this)); 62 } 63 $("#wc-wc_valorpay-card-number-error").remove(); 64 validcard = false; 65 $(this).parent().addClass("woocommerce-invalid"); 66 } else { 67 $(this).removeClass("error-class"); 68 $(this).next(".error-message").remove(); 69 validcard = true; 70 $(this).parent().removeClass("woocommerce-invalid"); 71 } 72 } 73 }); 74 $("body").on("focus", 'input[name="wc_valorpay-card-number"]', function() { 75 if (!$(this).val()) { 76 $(this).removeClass("error-class"); 77 $(this).next(".error-message").remove(); 78 } 79 }); 80 $("body").on("blur", 'input[name="wc_valorpay-card-expiry"]', function() { 81 if ($("#payment_method_wc_valorpay").is(":checked")) { 82 var expiry = $(this).val().replace(/ /g, ""); 83 if (expiry === "") { 84 $(this).addClass("error-class"); 85 if (!$(this).next().hasClass("error-message")) { 86 $( 87 '<span class="error-message" style="color:red;">' + 88 valorpay_checkout_object.invalid_expiry + 89 "</span>" 90 ).insertAfter($(this)); 91 } 92 validcardexpiry = false; 93 $(this).parent().addClass("woocommerce-invalid"); 94 } else { 95 var parts = expiry.split("/"); 96 var month = parseInt(parts[0], 10); 97 var year = parseInt(parts[1], 10); 98 if (year < 100) { 99 year += 2000; 100 } 101 if (!validateCardExpiry(month, year)) { 102 $(this).addClass("error-class"); 103 if (!$(this).next().hasClass("error-message")) { 104 $( 105 '<span class="error-message" style="color:red;">' + 106 valorpay_checkout_object.expiry_card + 107 "</span>" 108 ).insertAfter($(this)); 109 } 110 validcardexpiry = false; 111 $(this).parent().addClass("woocommerce-invalid"); 112 } else { 113 $(this).removeClass("error-class"); 114 $(this).next(".error-message").remove(); 115 validcardexpiry = true; 116 $(this).parent().removeClass("woocommerce-invalid"); 117 } 118 } 119 } 120 }); 121 122 $("body").on("focus", 'input[name="wc_valorpay-card-expiry"]', function() { 123 $(this).removeClass("error-class"); 124 $(this).next(".error-message").remove(); 125 }); 126 $("body").on("blur", "#wc_valorpay-card-cvc", function() { 127 if ($("#payment_method_wc_valorpay").is(":checked")) { 128 var cvcNum = $(this).val().trim(); 129 if (cvcNum === "") { 130 $(this).addClass("error-class"); 131 if (!$(this).next().hasClass("error-message")) { 132 $( 133 '<span class="error-message" style="color:red;">' + 134 valorpay_checkout_object.error_cvv + 135 "</span>" 136 ).insertAfter($(this)); 137 } 138 validcvc = false; 139 $(this).parent().addClass("woocommerce-invalid"); 140 } else if (cvcNum.length != 3 && cvcNum.length != 4) { 141 $(this).addClass("error-class"); 142 if (!$(this).next().hasClass("error-message")) { 143 $( 144 '<span class="error-message" style="color:red;">' + 145 valorpay_checkout_object.invalid_cvv + 146 "</span>" 147 ).insertAfter($(this)); 148 } 149 validcvc = false; 150 $(this).parent().addClass("woocommerce-invalid"); 151 } else { 152 $(this).removeClass("error-class"); 153 $(this).next(".error-message").remove(); 154 validcvc = true; 155 $(this).parent().removeClass("woocommerce-invalid"); 156 } 157 } 158 }); 159 $("body").on("focus", 'input[name="wc_valorpay-card-cvc"]', function() { 160 $(this).removeClass("error-class"); 161 $(this).next(".error-message").remove(); 162 }); 163 $("form.woocommerce-checkout").on( 164 "checkout_place_order_wc_valorpay", 165 function() { 166 167 168 var cardNumb = $('input[name="wc_valorpay-card-number"]').val(); 169 const isToken = $('#wc-wc_valorpay-payment-token-new'); 170 if ( 171 isToken.length && !isToken.is(":checked") 172 ) { 173 var avserrorIsValidsave = addAVSErrors(); 174 // Do something if the radio button is checked 175 176 if (avserrorIsValidsave) { 177 178 return true; 179 } else { 180 return false; 181 } 182 } 183 184 if (cardNumb === "") { 185 $('input[name="wc_valorpay-card-number"]').trigger("blur"); 186 } else { 187 $('input[name="wc_valorpay-card-number"]').trigger("blur"); 188 $('input[name="wc_valorpay-card-expiry"]').trigger("blur"); 189 $('input[name="wc_valorpay-card-cvc"]').trigger("blur"); 190 } 191 if (validcard === false) { 192 $("html, body").animate({ 193 scrollTop: $("#wc-wc_valorpay-cc-form").offset().top, 194 }, 195 1000 196 ); 197 return false; 198 } 199 if (validcardexpiry === false) { 200 $("html, body").animate({ 201 scrollTop: $("#wc-wc_valorpay-cc-form").offset().top, 202 }, 203 1000 204 ); 205 return false; 206 } 207 if (validcvc === false) { 208 $("html, body").animate({ 209 scrollTop: $("#wc-wc_valorpay-cc-form").offset().top, 210 }, 211 1000 212 ); 213 return false; 214 } 215 if (cardNumb !== "") { 216 var avserrorIsValid = addAVSErrors(); 217 218 if (avserrorIsValid) { 219 220 return true; 221 } else { 222 return false; 223 } 224 } 225 } 226 ); 227 228 229 230 function validateCardExpiry(month, year) { 231 var currentTime = new Date(); 232 var expiry = new Date(year, month, 1); 233 if (expiry < currentTime) { 234 return false; 235 } 236 return true; 237 } 238 239 function addAVSErrors() { 240 var hasError = false; 241 242 $('input[name="valorpay_avs_zip"] + span.error').remove(); 243 $('input[name="valorpay_avs_street"] + span.error').remove(); 244 245 if ($('input[name="valorpay_avs_zip"]').val() === "") { 246 $('input[name="valorpay_avs_zip"]').after( 247 '<span class="error" style="color:red;">' + 248 valorpay_checkout_object.avs_zip_error + 249 "</span>" 250 ); 251 hasError = true; 252 } else if ($('input[name="valorpay_avs_zip"]').val().length < 4) { 253 $('input[name="valorpay_avs_zip"]').after( 254 '<span class="error" style="color:red;">' + 255 valorpay_checkout_object.invalid_avs_zip_error + "</span>" 256 ); 257 hasError = true; 258 } 259 260 if ($('input[name="valorpay_avs_street"]').val() === "") { 261 $('input[name="valorpay_avs_street"]').after( 262 '<span class="error" style="color:red;">' + 263 valorpay_checkout_object.avs_street_error + 264 "</span>" 265 ); 266 hasError = true; 267 } 268 269 $('input[name="valorpay_avs_zip"]').focus(function() { 270 $('input[name="valorpay_avs_zip"] + span.error').remove(); 271 }); 272 273 $('input[name="valorpay_avs_street"]').focus(function() { 274 $('input[name="valorpay_avs_street"] + span.error').remove(); 275 }); 276 277 return !hasError; 278 } 279 }); 280 281 282 })(jQuery); -
valorpos/tags/7.3.0/wc-valorpay.php
r2897749 r2918841 16 16 * Plugin URI: https://valorpaytech.com 17 17 * Description: Adds the Valor Payment Gateway to WooCommerce. 18 * Version: 7. 2.118 * Version: 7.3.0 19 19 * Author: Valor Paytech LLC 20 20 * Author URI: https://valorpaytech.com … … 37 37 * Rename this for your plugin and update it as you release new versions. 38 38 */ 39 define( 'WC_VALORPAY_VERSION', '7. 2.1' );39 define( 'WC_VALORPAY_VERSION', '7.3.0' ); 40 40 // Directory i.e. /home/user/public_html... 41 41 define( 'WC_VALORPAY_DIR', plugin_dir_path( __FILE__ ) ); -
valorpos/trunk/README.txt
r2897749 r2918841 3 3 Tags: payment, payment gateway, credit card, valor pay, valor paytech 4 4 Requires at least: 5.0 5 Tested up to: 6. 1.15 Tested up to: 6.2.2 6 6 Requires PHP: 7.0 7 Stable tag: 7. 2.17 Stable tag: 7.3.0 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 41 41 == Changelog == 42 42 43 = 7.3.0 = 44 * Added validation to card fields & Tax amount separated from sub total. 45 43 46 = 7.2.1 = 44 47 * Change event listener selector for payment method. -
valorpos/trunk/admin/class-wc-valorpay-admin.php
r2883367 r2918841 308 308 } 309 309 310 310 311 } -
valorpos/trunk/includes/class-wc-valorpay-api.php
r2887504 r2918841 170 170 } 171 171 } 172 173 172 $billing_first_name = wc_clean( $order->get_billing_first_name() ); 174 173 $billing_last_name = wc_clean( $order->get_billing_last_name() ); … … 186 185 $billing_email = wc_clean( $order->get_billing_email() ); 187 186 $tax_amount = wc_clean( $order->get_total_tax() ); 187 $amount = $amount - $tax_amount; 188 188 $ip_address = wc_clean( $order->get_customer_ip_address() ); 189 189 $valorpay_avs_zip = ( isset( $_POST['valorpay_avs_zip'] ) && $_POST['valorpay_avs_zip'] ) ? sanitize_text_field( wp_unslash( $_POST['valorpay_avs_zip'] ) ) : wc_clean( substr( $billing_postcode, 0, 10 ) ); // phpcs:ignore … … 201 201 'email' => $billing_email, 202 202 'uid' => $order_number, 203 'tax '=> number_format( $tax_amount, '2', '.', '' ),203 'tax_amount' => number_format( $tax_amount, '2', '.', '' ), 204 204 'ip' => $ip_address, 205 205 'surchargeIndicator' => $surcharge_indicator, -
valorpos/trunk/includes/class-wc-valorpay-gateway.php
r2887504 r2918841 266 266 $this->valorpay_acknowledgement_form(); 267 267 } 268 /** 269 * Luhn check. 270 * 271 * @since 7.3.0 272 * @param string $account_number Account Number. 273 * @return object 274 */ 275 public function luhn_check( $account_number ) { 276 for ( $sum = 0, $i = 0, $ix = strlen( $account_number ); $i < $ix - 1; $i++ ) { 277 $weight = substr( $account_number, $ix - ( $i + 2 ), 1 ) * ( 2 - ( $i % 2 ) ); 278 $sum += $weight < 10 ? $weight : $weight - 9; 279 280 } 281 if ( 0 !== $sum ) { 282 return ( (int) substr( $account_number, $ix - 1 ) ) === ( ( 10 - $sum % 10 ) % 10 ); 283 } else { 284 return false; 285 } 286 } 287 /** 288 * Get card information. 289 * 290 * @since 7.3.0 291 * @return object 292 */ 293 private function get_posted_card() { 294 $card_number = isset( $_POST['wc_valorpay-card-number'] ) ? wc_clean( $_POST['wc_valorpay-card-number'] ) : ''; // phpcs:ignore 295 $card_cvc = isset( $_POST['wc_valorpay-card-cvc'] ) ? wc_clean( $_POST['wc_valorpay-card-cvc'] ) : ''; // phpcs:ignore 296 $card_expiry = isset( $_POST['wc_valorpay-card-expiry'] ) ? wc_clean( $_POST['wc_valorpay-card-expiry'] ) : ''; // phpcs:ignore 297 $card_number = str_replace( array( ' ', '-' ), '', $card_number ); 298 $card_expiry = array_map( 'trim', explode( '/', $card_expiry ) ); 299 $card_exp_month = str_pad( $card_expiry[0], 2, '0', STR_PAD_LEFT ); 300 $card_exp_year = isset( $card_expiry[1] ) ? $card_expiry[1] : ''; 301 if ( 2 === strlen( $card_exp_year ) ) { 302 $card_exp_year += 2000; 303 } 304 return (object) array( 305 'number' => $card_number, 306 'type' => '', 307 'cvc' => $card_cvc, 308 'exp_month' => $card_exp_month, 309 'exp_year' => $card_exp_year, 310 ); 311 } 312 313 /** 314 * Validate frontend fields. 315 * 316 * Validate payment fields on the frontend. 317 * 318 * @since 7.3.0 319 * @throws \Exception If the card information is invalid. 320 * @return bool 321 */ 322 public function validate_fields() { 323 try { 324 if ( isset( $_POST['wc-wc_valorpay-payment-token'] ) && 'new' !== wc_clean( $_POST['wc-wc_valorpay-payment-token'] ) ) { // phpcs:ignore 325 return true; 326 } 327 $card = $this->get_posted_card(); 328 $current_year = gmdate( 'Y' ); 329 $current_month = gmdate( 'n' ); 330 331 if ( empty( $card->number ) || ! ctype_digit( $card->number ) || strlen( $card->number ) < 12 || strlen( $card->number ) > 19 ) { 332 throw new Exception( __( 'Card number is invalid', 'wc-valorpay' ) ); 333 } 334 335 if ( ! ( $this->luhn_check( $card->number ) ) ) { 336 throw new Exception( __( 'Not a valid card', 'wc-valorpay' ) ); 337 } 338 if ( empty( $card->exp_month ) || empty( $card->exp_year ) || ! ctype_digit( $card->exp_month ) || ! ctype_digit( $card->exp_year ) || $card->exp_month > 12 || $card->exp_month < 1 || $card->exp_year < $current_year || ( $card->exp_year === $current_year && $card->exp_month < $current_month ) ) { 339 throw new Exception( __( 'Card number expired', 'wc-valorpay' ) ); 340 } 341 if ( ! ctype_digit( $card->cvc ) ) { 342 throw new Exception( __( 'Card security code is invalid (only digits are allowed)', 'wc-valorpay' ) ); 343 } 344 345 return true; 346 } catch ( Exception $e ) { 347 wc_add_notice( $e->getMessage(), 'error' ); 348 return false; 349 } 350 } 268 351 269 352 /** … … 519 602 * 520 603 * @since 1.0.0 604 */ 605 public function add_card_field_id() { 606 607 $fields['card-number-field']['label_class'] .= ' woocommerce-input-wrapper'; 608 $fields['card-number-field']['class'][] = 'form-row-wide'; 609 $fields['card-number-field']['id'] = 'wc-valorpay-card-field'; 610 return $fields; 611 } 612 613 /** 614 * Surcharge admin validation. 615 * 616 * @since 7.2.0 521 617 */ 522 618 public function process_admin_options() { … … 780 876 } 781 877 878 879 880 782 881 } 882 883 884 885 -
valorpos/trunk/includes/class-wc-valorpay.php
r2883367 r2918841 202 202 $this->loader->add_action( 'woocommerce_after_checkout_form', $plugin_public, 'valorpay_checkout_script' ); 203 203 $this->loader->add_filter( 'woocommerce_available_payment_gateways', $plugin_public, 'valorpay_disable_payment_gateway_failed_orders' ); 204 204 205 } 205 206 … … 245 246 246 247 } 248 -
valorpos/trunk/languages/wc-valorpay.pot
r2897749 r2918841 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Valor Pay 7. 2.1\n"5 "Project-Id-Version: Valor Pay 7.3.0\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wc-valorpay\n" 7 7 "Last-Translator: Valor Paytech LLC <sales@valorpaytech.com>\n" … … 9 9 "Content-Type: text/plain; charset=UTF-8\n" 10 10 "Content-Transfer-Encoding: 8bit\n" 11 "POT-Creation-Date: 2023-0 3-27T15:16:11+05:30\n"11 "POT-Creation-Date: 2023-05-19T15:31:04+05:30\n" 12 12 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 13 13 "X-Generator: WP-CLI 2.7.1\n" … … 15 15 16 16 #. Plugin Name of the plugin 17 #: includes/class-wc-valorpay-gateway.php: 37217 #: includes/class-wc-valorpay-gateway.php:455 18 18 msgid "Valor Pay" 19 19 msgstr "" … … 69 69 70 70 #: admin/partials/wc-valorpay-admin-failure-tracker.php:18 71 #: includes/class-wc-valorpay-gateway.php: 46071 #: includes/class-wc-valorpay-gateway.php:543 72 72 msgid "Payment Failed Tracker" 73 73 msgstr "" … … 169 169 msgstr "" 170 170 171 #: includes/class-wc-valorpay-gateway.php:332 172 msgid "Card number is invalid" 173 msgstr "" 174 175 #: includes/class-wc-valorpay-gateway.php:336 176 msgid "Not a valid card" 177 msgstr "" 178 179 #: includes/class-wc-valorpay-gateway.php:339 180 msgid "Card number expired" 181 msgstr "" 182 183 #: includes/class-wc-valorpay-gateway.php:342 184 msgid "Card security code is invalid (only digits are allowed)" 185 msgstr "" 186 171 187 #. translators: 1: Terms and Conditions URL. 172 #: includes/class-wc-valorpay-gateway.php: 295188 #: includes/class-wc-valorpay-gateway.php:378 173 189 msgid "I agree to the <a href=\"%s\" target=\"_blank\">Terms and Conditions</a>" 174 190 msgstr "" 175 191 176 #: includes/class-wc-valorpay-gateway.php: 326177 #: includes/class-wc-valorpay-gateway.php: 327192 #: includes/class-wc-valorpay-gateway.php:409 193 #: includes/class-wc-valorpay-gateway.php:410 178 194 msgid "Zip Code" 179 195 msgstr "" 180 196 181 #: includes/class-wc-valorpay-gateway.php: 340182 #: includes/class-wc-valorpay-gateway.php: 341197 #: includes/class-wc-valorpay-gateway.php:423 198 #: includes/class-wc-valorpay-gateway.php:424 183 199 msgid "Street No" 184 200 msgstr "" 185 201 186 #: includes/class-wc-valorpay-gateway.php: 362202 #: includes/class-wc-valorpay-gateway.php:445 187 203 msgid "Enable/Disable" 188 204 msgstr "" 189 205 190 #: includes/class-wc-valorpay-gateway.php: 363206 #: includes/class-wc-valorpay-gateway.php:446 191 207 msgid "Enable Valor Pay" 192 208 msgstr "" 193 209 194 #: includes/class-wc-valorpay-gateway.php: 369210 #: includes/class-wc-valorpay-gateway.php:452 195 211 msgid "Title" 196 212 msgstr "" 197 213 198 #: includes/class-wc-valorpay-gateway.php: 371214 #: includes/class-wc-valorpay-gateway.php:454 199 215 msgid "This controls the title which the user sees during checkout." 200 216 msgstr "" 201 217 202 #: includes/class-wc-valorpay-gateway.php: 376218 #: includes/class-wc-valorpay-gateway.php:459 203 219 msgid "Use Sandbox" 204 220 msgstr "" 205 221 206 #: includes/class-wc-valorpay-gateway.php: 377222 #: includes/class-wc-valorpay-gateway.php:460 207 223 msgid "Enable sandbox mode - live payments will not be taken if enabled." 208 224 msgstr "" 209 225 210 #: includes/class-wc-valorpay-gateway.php: 383226 #: includes/class-wc-valorpay-gateway.php:466 211 227 msgid "APP ID" 212 228 msgstr "" 213 229 214 #: includes/class-wc-valorpay-gateway.php: 385230 #: includes/class-wc-valorpay-gateway.php:468 215 231 msgid "Please email support@valorpaytech.com to get to know about your APP ID, ( In demo mode APP ID is not needed )" 216 232 msgstr "" 217 233 218 #: includes/class-wc-valorpay-gateway.php: 389234 #: includes/class-wc-valorpay-gateway.php:472 219 235 msgid "APP KEY" 220 236 msgstr "" 221 237 222 #: includes/class-wc-valorpay-gateway.php: 391238 #: includes/class-wc-valorpay-gateway.php:474 223 239 msgid "Please email support@valorpaytech.com to get to know about your APP KEY, ( In demo mode APP KEY is not needed )" 224 240 msgstr "" 225 241 226 #: includes/class-wc-valorpay-gateway.php: 395242 #: includes/class-wc-valorpay-gateway.php:478 227 243 msgid "EPI" 228 244 msgstr "" 229 245 230 #: includes/class-wc-valorpay-gateway.php: 397246 #: includes/class-wc-valorpay-gateway.php:480 231 247 msgid "Please email support@valorpaytech.com to get to know about your EPI ID, ( In demo mode EPI ID is not needed )" 232 248 msgstr "" 233 249 234 #: includes/class-wc-valorpay-gateway.php:4 01250 #: includes/class-wc-valorpay-gateway.php:484 235 251 msgid "Payment Method" 236 252 msgstr "" 237 253 238 #: includes/class-wc-valorpay-gateway.php:4 11254 #: includes/class-wc-valorpay-gateway.php:494 239 255 msgid "Surcharge Mode" 240 256 msgstr "" 241 257 242 #: includes/class-wc-valorpay-gateway.php:4 12243 #: includes/class-wc-valorpay-gateway.php: 419258 #: includes/class-wc-valorpay-gateway.php:495 259 #: includes/class-wc-valorpay-gateway.php:502 244 260 msgid "Enable Surcharge Mode" 245 261 msgstr "" 246 262 247 #: includes/class-wc-valorpay-gateway.php:4 14263 #: includes/class-wc-valorpay-gateway.php:497 248 264 msgid "Enable only if you want all transactions to be fall on surcharge mode, Merchant must have got an Surcharge MID inorder to work" 249 265 msgstr "" 250 266 251 #: includes/class-wc-valorpay-gateway.php: 418267 #: includes/class-wc-valorpay-gateway.php:501 252 268 msgid "Surcharge Type" 253 269 msgstr "" 254 270 255 #: includes/class-wc-valorpay-gateway.php: 428256 #: includes/class-wc-valorpay-gateway.php: 429271 #: includes/class-wc-valorpay-gateway.php:511 272 #: includes/class-wc-valorpay-gateway.php:512 257 273 msgid "Surcharge Label" 258 274 msgstr "" 259 275 260 #: includes/class-wc-valorpay-gateway.php: 434276 #: includes/class-wc-valorpay-gateway.php:517 261 277 msgid "Surcharge %" 262 278 msgstr "" 263 279 264 #: includes/class-wc-valorpay-gateway.php: 438280 #: includes/class-wc-valorpay-gateway.php:521 265 281 msgid "Percentage will apply only on enabling on surcharge Indicator to true and Surcharge type is set fo Surcharge %" 266 282 msgstr "" 267 283 268 #: includes/class-wc-valorpay-gateway.php: 441284 #: includes/class-wc-valorpay-gateway.php:524 269 285 msgid "Flat Rate $" 270 286 msgstr "" 271 287 272 #: includes/class-wc-valorpay-gateway.php: 444288 #: includes/class-wc-valorpay-gateway.php:527 273 289 msgid "Flat rate will apply only on if Enable surcharge mode is true and Surcharge type is set to Flat Rate $" 274 290 msgstr "" 275 291 276 #: includes/class-wc-valorpay-gateway.php: 447292 #: includes/class-wc-valorpay-gateway.php:530 277 293 msgid "AVS" 278 294 msgstr "" 279 295 280 #: includes/class-wc-valorpay-gateway.php: 457296 #: includes/class-wc-valorpay-gateway.php:540 281 297 msgid "The address verification service will add a text field to the checkout page based on the above option." 282 298 msgstr "" 283 299 284 #: includes/class-wc-valorpay-gateway.php: 461300 #: includes/class-wc-valorpay-gateway.php:544 285 301 msgid "Enable Protection" 286 302 msgstr "" 287 303 288 304 #. translators: 1: Tracker URL. 289 #: includes/class-wc-valorpay-gateway.php: 465305 #: includes/class-wc-valorpay-gateway.php:548 290 306 msgid "Disable the payment method in the checkout page for failed transactions. <a id=\"valorpay-goto-tracker\" href=\"%s\">Unblock IP</a>" 291 307 msgstr "" 292 308 293 #: includes/class-wc-valorpay-gateway.php: 471309 #: includes/class-wc-valorpay-gateway.php:554 294 310 msgid "Declined Transaction Count" 295 311 msgstr "" 296 312 297 #: includes/class-wc-valorpay-gateway.php: 472313 #: includes/class-wc-valorpay-gateway.php:555 298 314 msgid "Number of declined transaction count." 299 315 msgstr "" 300 316 301 #: includes/class-wc-valorpay-gateway.php: 476317 #: includes/class-wc-valorpay-gateway.php:559 302 318 msgid "3" 303 319 msgstr "" 304 320 305 #: includes/class-wc-valorpay-gateway.php: 477321 #: includes/class-wc-valorpay-gateway.php:560 306 322 msgid "5" 307 323 msgstr "" 308 324 309 #: includes/class-wc-valorpay-gateway.php: 478325 #: includes/class-wc-valorpay-gateway.php:561 310 326 msgid "6" 311 327 msgstr "" 312 328 313 #: includes/class-wc-valorpay-gateway.php: 482329 #: includes/class-wc-valorpay-gateway.php:565 314 330 msgid "Block Payment For" 315 331 msgstr "" 316 332 317 #: includes/class-wc-valorpay-gateway.php: 483333 #: includes/class-wc-valorpay-gateway.php:566 318 334 msgid "Minutes to block payment gateway in checkout." 319 335 msgstr "" 320 336 321 #: includes/class-wc-valorpay-gateway.php: 487337 #: includes/class-wc-valorpay-gateway.php:570 322 338 msgid "1 min" 323 339 msgstr "" 324 340 325 #: includes/class-wc-valorpay-gateway.php: 488341 #: includes/class-wc-valorpay-gateway.php:571 326 342 msgid "5 min" 327 343 msgstr "" 328 344 329 #: includes/class-wc-valorpay-gateway.php: 489345 #: includes/class-wc-valorpay-gateway.php:572 330 346 msgid "10 min" 331 347 msgstr "" 332 348 333 #: includes/class-wc-valorpay-gateway.php: 490349 #: includes/class-wc-valorpay-gateway.php:573 334 350 msgid "1 hour" 335 351 msgstr "" 336 352 337 #: includes/class-wc-valorpay-gateway.php: 491353 #: includes/class-wc-valorpay-gateway.php:574 338 354 msgid "3 hour" 339 355 msgstr "" 340 356 341 #: includes/class-wc-valorpay-gateway.php: 492357 #: includes/class-wc-valorpay-gateway.php:575 342 358 msgid "5 hour" 343 359 msgstr "" 344 360 345 #: includes/class-wc-valorpay-gateway.php: 493361 #: includes/class-wc-valorpay-gateway.php:576 346 362 msgid "10 hour" 347 363 msgstr "" 348 364 349 #: includes/class-wc-valorpay-gateway.php: 494365 #: includes/class-wc-valorpay-gateway.php:577 350 366 msgid "1 day" 351 367 msgstr "" 352 368 353 #: includes/class-wc-valorpay-gateway.php: 498369 #: includes/class-wc-valorpay-gateway.php:581 354 370 msgid "Accepted Cards" 355 371 msgstr "" 356 372 357 #: includes/class-wc-valorpay-gateway.php:5 02373 #: includes/class-wc-valorpay-gateway.php:585 358 374 msgid "Select the card types to accept." 359 375 msgstr "" 360 376 361 377 #. translators: 1: Maximum percentage. 362 #: includes/class-wc-valorpay-gateway.php: 528378 #: includes/class-wc-valorpay-gateway.php:624 363 379 msgid "Surcharge percentage cannot be more than %s" 364 380 msgstr "" 365 381 366 382 #. translators: 1: Maximum flat rate. 367 #: includes/class-wc-valorpay-gateway.php: 533383 #: includes/class-wc-valorpay-gateway.php:629 368 384 msgid "Surcharge flat rate cannot be more than %s" 369 385 msgstr "" 370 386 371 #: includes/class-wc-valorpay-gateway.php: 578387 #: includes/class-wc-valorpay-gateway.php:674 372 388 msgid "Invalid card information." 373 389 msgstr "" 374 390 375 391 #. translators: 1: Error Message, 2: Amount, 3: Line Break, 4: Approval Code, 5: Line Break, 6: RRN Number. 376 #: includes/class-wc-valorpay-gateway.php: 594392 #: includes/class-wc-valorpay-gateway.php:690 377 393 msgid "Valor Pay %1$s for %2$s.%3$s <strong>Approval Code:</strong> %4$s.%5$s <strong>RRN:</strong> %6$s" 378 394 msgstr "" 379 395 380 396 #. translators: %s: API Error Message. 381 #: includes/class-wc-valorpay-gateway.php: 630382 #: includes/class-wc-valorpay-gateway.php: 633397 #: includes/class-wc-valorpay-gateway.php:726 398 #: includes/class-wc-valorpay-gateway.php:729 383 399 msgid "Payment error: %s" 384 400 msgstr "" 385 401 386 #: includes/class-wc-valorpay-gateway.php: 635402 #: includes/class-wc-valorpay-gateway.php:731 387 403 msgid "Unable to process the transaction using Valor Pay, please try again." 388 404 msgstr "" 389 405 390 406 #. translators: 1: Disable Time, 2: Unblock IP URL, 3: Customer IP. 391 #: includes/class-wc-valorpay-gateway.php: 694407 #: includes/class-wc-valorpay-gateway.php:790 392 408 msgid "Valor Pay method is disabled for %1$s. <a target=\"_blank\" href=\"%2$s\">To Unblock IP</a> %3$s" 393 409 msgstr "" 394 410 395 #: includes/class-wc-valorpay-gateway.php: 757411 #: includes/class-wc-valorpay-gateway.php:853 396 412 msgid "Refund failed." 397 413 msgstr "" 398 414 399 415 #. translators: 1: Amount, 2: Line Break, 3: Approval code, 4: Line Break, 5: RRN Code 400 #: includes/class-wc-valorpay-gateway.php: 769416 #: includes/class-wc-valorpay-gateway.php:865 401 417 msgid "Valor Pay Refund for %1$s.%2$s <strong>Approval Code:</strong> %3$s.%4$s <strong>RRN:</strong> %5$s" 402 418 msgstr "" 403 419 404 #: public/class-wc-valorpay-public.php:93 420 #: public/class-wc-valorpay-public.php:80 421 msgid "Please enter a card number" 422 msgstr "" 423 424 #: public/class-wc-valorpay-public.php:81 425 msgid "Invalid card number" 426 msgstr "" 427 428 #: public/class-wc-valorpay-public.php:82 429 msgid "Card is expired" 430 msgstr "" 431 432 #: public/class-wc-valorpay-public.php:83 433 msgid "Please enter card expiry date" 434 msgstr "" 435 436 #: public/class-wc-valorpay-public.php:84 437 msgid "Please enter a CVC" 438 msgstr "" 439 440 #: public/class-wc-valorpay-public.php:85 441 msgid "Invalid CVC length" 442 msgstr "" 443 444 #: public/class-wc-valorpay-public.php:86 445 msgid "Please enter a zip code" 446 msgstr "" 447 448 #: public/class-wc-valorpay-public.php:87 449 msgid "Invalid zip code" 450 msgstr "" 451 452 #: public/class-wc-valorpay-public.php:88 453 msgid "Please enter a street address" 454 msgstr "" 455 456 #: public/class-wc-valorpay-public.php:108 405 457 msgid "Zip Code is required." 406 458 msgstr "" 407 459 408 #: public/class-wc-valorpay-public.php: 96460 #: public/class-wc-valorpay-public.php:111 409 461 msgid "Enter a valid Zip Code." 410 462 msgstr "" 411 463 412 #: public/class-wc-valorpay-public.php:1 01464 #: public/class-wc-valorpay-public.php:116 413 465 msgid "Street No is required." 414 466 msgstr "" 415 467 416 #: public/class-wc-valorpay-public.php:1 04468 #: public/class-wc-valorpay-public.php:119 417 469 msgid "Enter a valid Street No." 418 470 msgstr "" -
valorpos/trunk/public/class-wc-valorpay-public.php
r2887504 r2918841 74 74 75 75 wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wc-valorpay-checkout.js', array( 'jquery' ), $this->version, false ); 76 wp_localize_script( 77 $this->plugin_name, 78 'valorpay_checkout_object', 79 array( 80 'error_card' => __( 'Please enter a card number', 'wc-valorpay' ), 81 'invalid_card' => __( 'Invalid card number', 'wc-valorpay' ), 82 'expiry_card' => __( 'Card is expired', 'wc-valorpay' ), 83 'invalid_expiry' => __( 'Please enter card expiry date', 'wc-valorpay' ), 84 'error_cvv' => __( 'Please enter a CVC', 'wc-valorpay' ), 85 'invalid_cvv' => __( 'Invalid CVC length', 'wc-valorpay' ), 86 'avs_zip_error' => __( 'Please enter a zip code', 'wc-valorpay' ), 87 'invalid_avs_zip_error' => __( 'Invalid zip code', 'wc-valorpay' ), 88 'avs_street_error' => __( 'Please enter a street address', 'wc-valorpay' ), 89 ) 90 ); 76 91 77 92 } -
valorpos/trunk/public/js/wc-valorpay-checkout.js
r2897749 r2918841 6 6 */ 7 7 8 (function( $ ) { 9 'use strict'; 10 11 $( 'body' ).on( 12 'change', 13 'input[name="payment_method"]', 14 function(){ 15 $( 'body' ).trigger( 'update_checkout' ); 16 } 17 ); 18 19 })( jQuery ); 8 (function($) { 9 "use strict"; 10 11 var validcard = false; 12 var validcardexpiry = false; 13 var validcvc = false; 14 let luhnCheck = function(num) { 15 var digit, digits, odd, sum, _i, _len; 16 odd = true; 17 sum = 0; 18 digits = (num + "").split("").reverse(); 19 for (_i = 0, _len = digits.length; _i < _len; _i++) { 20 digit = digits[_i]; 21 digit = parseInt(digit, 10); 22 if ((odd = !odd)) { 23 digit *= 2; 24 } 25 if (digit > 9) { 26 digit -= 9; 27 } 28 sum += digit; 29 } 30 return sum % 10 === 0.0; 31 }; 32 33 $(document).ready(function() { 34 $("body").on("change", 'input[name="payment_method"]', function() { 35 $("body").trigger("update_checkout"); 36 }); 37 $("body").on("blur", 'input[name="wc_valorpay-card-number"]', function() { 38 if ($("#payment_method_wc_valorpay").is(":checked")) { 39 var cardNum = $(this).val().replace(/ /g, ""); 40 var isValid = luhnCheck(cardNum); 41 42 if (cardNum === "") { 43 $(this).addClass("error-class"); 44 if (!$(this).next().hasClass("error-message")) { 45 $( 46 '<span class="error-message" style="color:red;">' + 47 valorpay_checkout_object.error_card + 48 "</span>" 49 ).insertAfter($(this)); 50 } 51 $("#wc-wc_valorpay-card-number-error").remove(); 52 validcard = false; 53 $(this).parent().addClass("woocommerce-invalid"); 54 } else if (!isValid) { 55 $(this).addClass("error-class"); 56 if (!$(this).next().hasClass("error-message")) { 57 $( 58 '<span class="error-message" style="color:red;">' + 59 valorpay_checkout_object.invalid_card + 60 "</span>" 61 ).insertAfter($(this)); 62 } 63 $("#wc-wc_valorpay-card-number-error").remove(); 64 validcard = false; 65 $(this).parent().addClass("woocommerce-invalid"); 66 } else { 67 $(this).removeClass("error-class"); 68 $(this).next(".error-message").remove(); 69 validcard = true; 70 $(this).parent().removeClass("woocommerce-invalid"); 71 } 72 } 73 }); 74 $("body").on("focus", 'input[name="wc_valorpay-card-number"]', function() { 75 if (!$(this).val()) { 76 $(this).removeClass("error-class"); 77 $(this).next(".error-message").remove(); 78 } 79 }); 80 $("body").on("blur", 'input[name="wc_valorpay-card-expiry"]', function() { 81 if ($("#payment_method_wc_valorpay").is(":checked")) { 82 var expiry = $(this).val().replace(/ /g, ""); 83 if (expiry === "") { 84 $(this).addClass("error-class"); 85 if (!$(this).next().hasClass("error-message")) { 86 $( 87 '<span class="error-message" style="color:red;">' + 88 valorpay_checkout_object.invalid_expiry + 89 "</span>" 90 ).insertAfter($(this)); 91 } 92 validcardexpiry = false; 93 $(this).parent().addClass("woocommerce-invalid"); 94 } else { 95 var parts = expiry.split("/"); 96 var month = parseInt(parts[0], 10); 97 var year = parseInt(parts[1], 10); 98 if (year < 100) { 99 year += 2000; 100 } 101 if (!validateCardExpiry(month, year)) { 102 $(this).addClass("error-class"); 103 if (!$(this).next().hasClass("error-message")) { 104 $( 105 '<span class="error-message" style="color:red;">' + 106 valorpay_checkout_object.expiry_card + 107 "</span>" 108 ).insertAfter($(this)); 109 } 110 validcardexpiry = false; 111 $(this).parent().addClass("woocommerce-invalid"); 112 } else { 113 $(this).removeClass("error-class"); 114 $(this).next(".error-message").remove(); 115 validcardexpiry = true; 116 $(this).parent().removeClass("woocommerce-invalid"); 117 } 118 } 119 } 120 }); 121 122 $("body").on("focus", 'input[name="wc_valorpay-card-expiry"]', function() { 123 $(this).removeClass("error-class"); 124 $(this).next(".error-message").remove(); 125 }); 126 $("body").on("blur", "#wc_valorpay-card-cvc", function() { 127 if ($("#payment_method_wc_valorpay").is(":checked")) { 128 var cvcNum = $(this).val().trim(); 129 if (cvcNum === "") { 130 $(this).addClass("error-class"); 131 if (!$(this).next().hasClass("error-message")) { 132 $( 133 '<span class="error-message" style="color:red;">' + 134 valorpay_checkout_object.error_cvv + 135 "</span>" 136 ).insertAfter($(this)); 137 } 138 validcvc = false; 139 $(this).parent().addClass("woocommerce-invalid"); 140 } else if (cvcNum.length != 3 && cvcNum.length != 4) { 141 $(this).addClass("error-class"); 142 if (!$(this).next().hasClass("error-message")) { 143 $( 144 '<span class="error-message" style="color:red;">' + 145 valorpay_checkout_object.invalid_cvv + 146 "</span>" 147 ).insertAfter($(this)); 148 } 149 validcvc = false; 150 $(this).parent().addClass("woocommerce-invalid"); 151 } else { 152 $(this).removeClass("error-class"); 153 $(this).next(".error-message").remove(); 154 validcvc = true; 155 $(this).parent().removeClass("woocommerce-invalid"); 156 } 157 } 158 }); 159 $("body").on("focus", 'input[name="wc_valorpay-card-cvc"]', function() { 160 $(this).removeClass("error-class"); 161 $(this).next(".error-message").remove(); 162 }); 163 $("form.woocommerce-checkout").on( 164 "checkout_place_order_wc_valorpay", 165 function() { 166 167 168 var cardNumb = $('input[name="wc_valorpay-card-number"]').val(); 169 const isToken = $('#wc-wc_valorpay-payment-token-new'); 170 if ( 171 isToken.length && !isToken.is(":checked") 172 ) { 173 var avserrorIsValidsave = addAVSErrors(); 174 // Do something if the radio button is checked 175 176 if (avserrorIsValidsave) { 177 178 return true; 179 } else { 180 return false; 181 } 182 } 183 184 if (cardNumb === "") { 185 $('input[name="wc_valorpay-card-number"]').trigger("blur"); 186 } else { 187 $('input[name="wc_valorpay-card-number"]').trigger("blur"); 188 $('input[name="wc_valorpay-card-expiry"]').trigger("blur"); 189 $('input[name="wc_valorpay-card-cvc"]').trigger("blur"); 190 } 191 if (validcard === false) { 192 $("html, body").animate({ 193 scrollTop: $("#wc-wc_valorpay-cc-form").offset().top, 194 }, 195 1000 196 ); 197 return false; 198 } 199 if (validcardexpiry === false) { 200 $("html, body").animate({ 201 scrollTop: $("#wc-wc_valorpay-cc-form").offset().top, 202 }, 203 1000 204 ); 205 return false; 206 } 207 if (validcvc === false) { 208 $("html, body").animate({ 209 scrollTop: $("#wc-wc_valorpay-cc-form").offset().top, 210 }, 211 1000 212 ); 213 return false; 214 } 215 if (cardNumb !== "") { 216 var avserrorIsValid = addAVSErrors(); 217 218 if (avserrorIsValid) { 219 220 return true; 221 } else { 222 return false; 223 } 224 } 225 } 226 ); 227 228 229 230 function validateCardExpiry(month, year) { 231 var currentTime = new Date(); 232 var expiry = new Date(year, month, 1); 233 if (expiry < currentTime) { 234 return false; 235 } 236 return true; 237 } 238 239 function addAVSErrors() { 240 var hasError = false; 241 242 $('input[name="valorpay_avs_zip"] + span.error').remove(); 243 $('input[name="valorpay_avs_street"] + span.error').remove(); 244 245 if ($('input[name="valorpay_avs_zip"]').val() === "") { 246 $('input[name="valorpay_avs_zip"]').after( 247 '<span class="error" style="color:red;">' + 248 valorpay_checkout_object.avs_zip_error + 249 "</span>" 250 ); 251 hasError = true; 252 } else if ($('input[name="valorpay_avs_zip"]').val().length < 4) { 253 $('input[name="valorpay_avs_zip"]').after( 254 '<span class="error" style="color:red;">' + 255 valorpay_checkout_object.invalid_avs_zip_error + "</span>" 256 ); 257 hasError = true; 258 } 259 260 if ($('input[name="valorpay_avs_street"]').val() === "") { 261 $('input[name="valorpay_avs_street"]').after( 262 '<span class="error" style="color:red;">' + 263 valorpay_checkout_object.avs_street_error + 264 "</span>" 265 ); 266 hasError = true; 267 } 268 269 $('input[name="valorpay_avs_zip"]').focus(function() { 270 $('input[name="valorpay_avs_zip"] + span.error').remove(); 271 }); 272 273 $('input[name="valorpay_avs_street"]').focus(function() { 274 $('input[name="valorpay_avs_street"] + span.error').remove(); 275 }); 276 277 return !hasError; 278 } 279 }); 280 281 282 })(jQuery); -
valorpos/trunk/wc-valorpay.php
r2897749 r2918841 16 16 * Plugin URI: https://valorpaytech.com 17 17 * Description: Adds the Valor Payment Gateway to WooCommerce. 18 * Version: 7. 2.118 * Version: 7.3.0 19 19 * Author: Valor Paytech LLC 20 20 * Author URI: https://valorpaytech.com … … 37 37 * Rename this for your plugin and update it as you release new versions. 38 38 */ 39 define( 'WC_VALORPAY_VERSION', '7. 2.1' );39 define( 'WC_VALORPAY_VERSION', '7.3.0' ); 40 40 // Directory i.e. /home/user/public_html... 41 41 define( 'WC_VALORPAY_DIR', plugin_dir_path( __FILE__ ) );
Note: See TracChangeset
for help on using the changeset viewer.