Changeset 2903685
- Timestamp:
- 04/25/2023 07:39:32 AM (3 years ago)
- Location:
- 9pay-gateway/trunk
- Files:
-
- 3 edited
-
includes/gateways/core/config.php (modified) (1 diff)
-
includes/gateways/ninepay-gateway.php (modified) (1 diff)
-
mc-quetma.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
9pay-gateway/trunk/includes/gateways/core/config.php
r2903653 r2903685 22 22 'min_amount_collection_vnd' => 10000, 23 23 'max_amount_collection_vnd' => 200000000, 24 'min_amount_bnpl_vnd' => 10000, 25 'max_amount_bnpl_vnd' => 25000000, 24 26 'max_amount' => 200000000, 25 27 'status' => [ -
9pay-gateway/trunk/includes/gateways/ninepay-gateway.php
r2724280 r2903685 241 241 ) 242 242 ), 243 244 /*Buy Now Pay Later*/ 245 'ninepay_payment_method_bnpl' => array( 246 'desc_tip' => true, 247 'class' => 'pb-0', 248 'type' => 'checkbox', 249 'label' => __( 'Mua trước trả sau', 'woocommerce' ), 250 'default' => 'no' 251 ), 252 'ninepay_payment_method_bnpl_fee_percent' => array( 253 'class' => 'ninepay-element-bnpl ninepay-percent pt-0', 254 'text' => 'text', 255 'description' => __( '% +', 'woocommerce' ), 256 'placeholder' => 'Phí % giá bán (Ví dụ: 1.8)', 257 'default' => 0, 258 'custom_attributes' => array( 259 'onkeypress' => 'return nineMethodPercent(event, this)', 260 ) 261 ), 262 'ninepay_payment_method_bnpl_fee_fixed' => array( 263 'class' => 'ninepay-element-bnpl ninepay-fixed pt-0', 264 'text' => 'text', 265 'placeholder' => 'Phí cố định (Ví dụ: 2000)', 266 'default' => 0, 267 'custom_attributes' => array( 268 'onkeypress' => 'return nineMethodPercent(event, this)', 269 ) 270 ), 271 243 272 ); 244 273 } -
9pay-gateway/trunk/mc-quetma.php
r2902123 r2903685 17 17 * Plugin URI: 18 18 * Description: Tích hợp cổng thanh toán 9PAY vào phương thức thanh toán của woocomerce 19 * Version: 1.919 * Version: 2.0 20 20 * Author: 9Pay 21 21 * Author URI: … … 36 36 * Rename this for your plugin and update it as you release new versions. 37 37 */ 38 define( 'NINEPAY_MC_9PAY_VERSION', ' 1.0.0' );38 define( 'NINEPAY_MC_9PAY_VERSION', '2.0' ); 39 39 define( 'NINEPAY_MC_9PAY_PLUGIN_URL', esc_url( plugins_url( '', __FILE__ ) ) ); 40 40 … … 220 220 $result[NinePayConstance::METHOD_COLLECTION] = __($configLang[$lang][NinePayConstance::METHOD_COLLECTION], "woocommerce"); 221 221 } 222 223 /*Buy Now Pay Later*/ 224 if($settings['ninepay_payment_method_bnpl'] === 'yes') { 225 $result[NinePayConstance::METHOD_BNPL] = __($configLang[$lang][NinePayConstance::METHOD_BNPL], "woocommerce"); 226 } 227 222 228 223 229 return $result; … … 291 297 $minAmountCollectionVnd = $configFile['min_amount_collection_vnd']; 292 298 $maxAmountCollectionVnd = $configFile['max_amount_collection_vnd']; 299 300 $minAmountBnplVnd = $configFile['min_amount_bnpl_vnd']; 301 $maxAmountBnplVnd = $configFile['max_amount_bnpl_vnd']; 293 302 ?> 294 303 <script type="text/javascript"> … … 310 319 let maxAmountCollectionVnd = parseFloat("<?php echo esc_html($maxAmountCollectionVnd); ?>"); 311 320 321 let minAmountBnplVnd = parseFloat("<?php echo esc_html($minAmountBnplVnd); ?>"); 322 let maxAmountBnplVnd = parseFloat("<?php echo esc_html($maxAmountBnplVnd); ?>"); 323 324 312 325 jQuery(document).on("updated_checkout", function(){ 313 326 jQuery('#place_order').click(function (e) { … … 447 460 } 448 461 462 if (paymentMethod === "BUY_NOW_PAY_LATER" && currency === "VND") { 463 if (totalCart < minAmountBnplVnd) { 464 let errorMessage = ''; 465 if (language === 'vi') { 466 errorMessage = `Số tiền tối thiểu mua trước trả sau là ${minAmountBnplVnd.toLocaleString()} đ. Vui lòng chọn phương thức thanh toán khác.`; 467 } else { 468 errorMessage = `The minimum amount to buy now pay later is ${minAmountBnplVnd.toLocaleString()} VND. Please choose another payment method.`; 469 } 470 let error = `<div class="woocommerce-NoticeGroup woocommerce-NoticeGroup-checkout"> 471 <ul class="woocommerce-error" role="alert"> 472 <li>${errorMessage}</li> 473 </ul> 474 </div>`; 475 ninePayShowError(error); 476 e.preventDefault(); 477 } 478 if (totalCart > maxAmountBnplVnd) { 479 let errorMessage = ''; 480 if (language === 'vi') { 481 errorMessage = `Số tiền tối thiểu mua trước trả sau là ${maxAmountBnplVnd.toLocaleString()} đ. Vui lòng chọn phương thức thanh toán khác.`; 482 } else { 483 errorMessage = `The maximum amount to buy now pay later is ${maxAmountBnplVnd.toLocaleString()} VND. Please choose another payment method.`; 484 } 485 let errorElement = `<div class="woocommerce-NoticeGroup woocommerce-NoticeGroup-checkout"> 486 <ul class="woocommerce-error" role="alert"> 487 <li>${errorMessage}</li> 488 </ul> 489 </div>`; 490 ninePayShowError(errorElement); 491 e.preventDefault(); 492 } 493 } 494 449 495 if (currency !== "VND") { 450 496 let minAmountWalletForeign = Number((minAmountWalletVnd / excRate).toFixed(2)); … … 459 505 let minAmountCollectionForeign = Number((minAmountCollectionVnd / excRate).toFixed(2)); 460 506 507 let minAmountBnplForeign = Number((minAmountBnplVnd / excRate).toFixed(2)); 508 let maxAmountBnplForeign = Number((maxAmountBnplVnd / excRate).toFixed(2)); 509 461 510 if (paymentMethod === "WALLET") { 462 511 if (totalCart < minAmountWalletForeign) { … … 575 624 } 576 625 } 626 627 if (paymentMethod === "BUY_NOW_PAY_LATER") { 628 if (totalCart < minAmountBnplForeign) { 629 let errorMessage = ''; 630 if (language === 'vi') { 631 errorMessage = `Số tiền tối thiểu chấp nhận thanh toán là ${minAmountBnplForeign.toLocaleString()} ${currency}. Vui lòng chọn phương thức thanh toán khác.`; 632 } else { 633 errorMessage = `The minimum amount accepted for payment is ${minAmountBnplForeign.toLocaleString()} ${currency}. Please choose another payment method.`; 634 } 635 let error = `<div class="woocommerce-NoticeGroup woocommerce-NoticeGroup-checkout"> 636 <ul class="woocommerce-error" role="alert"> 637 <li>${errorMessage}</li> 638 </ul> 639 </div>`; 640 ninePayShowError(error); 641 e.preventDefault(); 642 } 643 if (totalCart > maxAmountBnplForeign) { 644 let errorMessage = ''; 645 if (language === 'vi') { 646 errorMessage = `Số tiền tối đa chấp nhận thanh toán là ${maxAmountBnplForeign.toLocaleString()} ${currency}. Vui lòng chọn phương thức thanh toán khác.`; 647 } else { 648 errorMessage = `The maximum amount accepted for payment is ${maxAmountBnplForeign.toLocaleString()} ${currency}. Please choose another payment method.`; 649 } 650 let error = `<div class="woocommerce-NoticeGroup woocommerce-NoticeGroup-checkout"> 651 <ul class="woocommerce-error" role="alert"> 652 <li>${errorMessage}</li> 653 </ul> 654 </div>`; 655 ninePayShowError(error); 656 e.preventDefault(); 657 } 658 } 659 577 660 } 578 661 }); … … 652 735 case NinePayConstance::METHOD_COLLECTION: 653 736 return ninepay_handle_charge($amount, $config['ninepay_payment_method_collection_fee_percent'], $config['ninepay_payment_method_collection_fee_fixed']); 737 break; 738 739 case NinePayConstance::METHOD_BNPL: 740 return ninepay_handle_charge($amount, $config['ninepay_payment_method_bnpl_fee_percent'], $config['ninepay_payment_method_bnpl_fee_fixed']); 654 741 break; 655 742
Note: See TracChangeset
for help on using the changeset viewer.