Changeset 3187287
- Timestamp:
- 11/13/2024 09:37:54 AM (16 months ago)
- Location:
- 9pay-gateway/trunk
- Files:
-
- 6 edited
-
admin/js/mc-ninepay-admin.js (modified) (1 diff)
-
includes/gateways/class-ninepaygateway.php (modified) (1 diff)
-
includes/gateways/core/class-ninepaypayment.php (modified) (1 diff)
-
includes/gateways/core/lang.php (modified) (2 diffs)
-
includes/gateways/core/lib/class-ninepayconstance.php (modified) (1 diff)
-
mc-ninepay.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
9pay-gateway/trunk/admin/js/mc-ninepay-admin.js
r2919019 r3187287 19 19 20 20 jQuery( '.ninepay-percent' ).parents( 'fieldset' ).find( 'legend' ).replaceWith( '<div><p style="margin-right: 30px;">Tính phí người mua</p></div>' ); 21 jQuery( '.ninepay-percent-installment' ).parents( 'fieldset' ).find( 'legend' ).replaceWith( '<div><p style="margin-right: 30px;">Số tiền thanh toán trả góp tối thiểu</p></div>' ); 22 jQuery( '.ninepay-percent-installment' ).attr( "min" , "3000000" ) 23 jQuery( '.ninepay-percent-installment' ).attr("required",true) 21 24 } 22 25 ); -
9pay-gateway/trunk/includes/gateways/class-ninepaygateway.php
r2919019 r3187287 245 245 'placeholder' => 'Phí cố định (Ví dụ: 2000)', 246 246 'default' => 0, 247 'custom_attributes' => array( 248 'onkeypress' => 'return nineMethodPercent(event, this)', 249 ), 250 ), 251 252 'ninepay_payment_method_installment' => array( 253 'desc_tip' => true, 254 'class' => 'pb-0', 255 'type' => 'checkbox', 256 'label' => __( 'Trả góp với thẻ quốc tế', 'woocommerce' ), 257 'default' => 'no', 258 ), 259 'ninepay_payment_method_installment_fee_percent' => array( 260 'class' => 'ninepay-element-collection ninepay-percent pt-0', 261 'text' => 'text', 262 'description' => __( '% +', 'woocommerce' ), 263 'placeholder' => 'Phí % giá bán (Ví dụ: 1.8)', 264 'default' => 0, 265 'custom_attributes' => array( 266 'onkeypress' => 'return nineMethodPercent(event, this)', 267 ), 268 ), 269 'ninepay_payment_method_installment_fee_fixed' => array( 270 'class' => 'ninepay-element-collection ninepay-fixed pt-0', 271 'text' => 'text', 272 'placeholder' => 'Phí cố định (Ví dụ: 2000)', 273 'default' => 0, 274 'custom_attributes' => array( 275 'onkeypress' => 'return nineMethodPercent(event, this)', 276 ), 277 ), 278 'ninepay_payment_method_installment_min_amount' => array( 279 'class' => 'ninepay-percent-installment pb-0', 280 'text' => 'text', 281 'placeholder' => 'Số tiền thanh toán trả góp tối thiểu', 282 'default' => 3000000, 283 'type' => 'number', 247 284 'custom_attributes' => array( 248 285 'onkeypress' => 'return nineMethodPercent(event, this)', -
9pay-gateway/trunk/includes/gateways/core/class-ninepaypayment.php
r2919019 r3187287 55 55 56 56 if ( ! empty( $payment_method ) ) { 57 $data['method'] = $payment_method; 57 if ($payment_method === NinePayConstance::METHOD_INSTALLMENT) { 58 $data['method'] = NinePayConstance::METHOD_CREDIT; 59 $data['transaction_type'] = "INSTALLMENT"; 60 } else { 61 $data['method'] = $payment_method; 62 } 58 63 } 59 64 -
9pay-gateway/trunk/includes/gateways/core/lang.php
r2919019 r3187287 19 19 NinePayConstance::METHOD_COLLECTION => 'Chuyển khoản ngân hàng', 20 20 NinePayConstance::METHOD_BNPL => 'Mua trước trả sau', 21 NinePayConstance::METHOD_INSTALLMENT => 'Trả góp với thẻ quốc tế', 21 22 22 23 'description_payment_method' => 'Hãy chọn phương thức thanh toán', … … 31 32 NinePayConstance::METHOD_COLLECTION => 'Bank transfer', 32 33 NinePayConstance::METHOD_BNPL => 'Buy now Pay later', 34 NinePayConstance::METHOD_INSTALLMENT => 'Installment payment via credit card', 33 35 34 36 'description_payment_method' => 'Please choose payment method', -
9pay-gateway/trunk/includes/gateways/core/lib/class-ninepayconstance.php
r2919019 r3187287 28 28 const METHOD_COLLECTION = 'COLLECTION'; 29 29 const METHOD_BNPL = 'BUY_NOW_PAY_LATER'; 30 const METHOD_INSTALLMENT = 'INSTALLMENT'; 30 31 } -
9pay-gateway/trunk/mc-ninepay.php
r3160196 r3187287 277 277 } 278 278 279 /*collection*/ 280 if ( $settings['ninepay_payment_method_collection'] === 'yes' ) { 281 $result[ NinePayConstance::METHOD_COLLECTION ] = $config_lang[ $lang ][ NinePayConstance::METHOD_COLLECTION ]; 282 } 283 284 /*collection*/ 285 if ( $settings['ninepay_payment_method_installment'] === 'yes' ) { 286 $result[ NinePayConstance::METHOD_INSTALLMENT ] = $config_lang[ $lang ][ NinePayConstance::METHOD_INSTALLMENT ]; 287 } 288 279 289 return $result; 280 290 } … … 340 350 function ninepay_add_checkout_script() { 341 351 global $woocommerce; 352 $ninepay = new NinePayGateway(); 353 $payment_config = $ninepay->settings; 342 354 $language = get_locale(); 343 355 $config_file = include 'includes/gateways/core/config.php'; … … 359 371 $min_amount_bnpl_vnd = $config_file['min_amount_bnpl_vnd']; 360 372 $max_amount_bnpl_vnd = $config_file['max_amount_bnpl_vnd']; 373 374 $min_amount_intallment_vnd = $payment_config['ninepay_payment_method_installment_min_amount']; 361 375 ?> 362 376 <script type="text/javascript"> … … 381 395 let maxAmountBnplVnd = parseFloat("<?php echo esc_html( $max_amount_bnpl_vnd ); ?>"); 382 396 397 let minAmountIntallmentVnd = parseFloat("<?php echo esc_html( $min_amount_intallment_vnd ); ?>"); 383 398 384 399 jQuery(document).on("updated_checkout", function(){ … … 552 567 } 553 568 569 if (paymentMethod === "INSTALLMENT" && currency === "VND") { 570 if (totalCart < minAmountIntallmentVnd) { 571 let errorMessage = ''; 572 if (language === 'vi') { 573 errorMessage = `Số tiền tối thiểu thanh toán trả góp là ${minAmountIntallmentVnd.toLocaleString()} đ. Vui lòng chọn phương thức thanh toán khác.`; 574 } else { 575 errorMessage = `The minimum amount accepted for installment payment via credit card is ${minAmountIntallmentVnd.toLocaleString()} VND. Please choose another payment method.`; 576 } 577 let error = `<div class="woocommerce-NoticeGroup woocommerce-NoticeGroup-checkout"> 578 <ul class="woocommerce-error" role="alert"> 579 <li>${errorMessage}</li> 580 </ul> 581 </div>`; 582 ninePayShowError(error); 583 e.preventDefault(); 584 } 585 } 586 554 587 if (currency !== "VND") { 555 588 let minAmountWalletForeign = Number((minAmountWalletVnd / excRate).toFixed(2)); … … 566 599 let minAmountBnplForeign = Number((minAmountBnplVnd / excRate).toFixed(2)); 567 600 let maxAmountBnplForeign = Number((maxAmountBnplVnd / excRate).toFixed(2)); 601 602 let minAmountIntallmentForeign = Number((minAmountIntallmentVnd / excRate).toFixed(2)); 568 603 569 604 if (paymentMethod === "WALLET") { … … 712 747 </ul> 713 748 </div>`; 749 ninePayShowError(error); 750 e.preventDefault(); 751 } 752 } 753 754 if (paymentMethod === "INSTALLMENT") { 755 if (totalCart < minAmountIntallmentForeign) { 756 let errorMessage = ''; 757 if (language === 'vi') { 758 errorMessage = `Số tiền tối thiểu thanh toán trả góp là ${minAmountIntallmentForeign.toLocaleString()} ${currency}. Vui lòng chọn phương thức thanh toán khác.`; 759 } else { 760 errorMessage = `The minimum amount accepted for installment payment via credit card is ${minAmountIntallmentForeign.toLocaleString()} ${currency}. Please choose another payment method.`; 761 } 762 let error = `<div class="woocommerce-NoticeGroup woocommerce-NoticeGroup-checkout"> 763 <ul class="woocommerce-error" role="alert"> 764 <li>${errorMessage}</li> 765 </ul> 766 </div>`; 714 767 ninePayShowError(error); 715 768 e.preventDefault(); … … 808 861 return ninepay_handle_charge( $amount, $config['ninepay_payment_method_bnpl_fee_percent'], $config['ninepay_payment_method_bnpl_fee_fixed'] ); 809 862 863 case NinePayConstance::METHOD_INSTALLMENT: 864 return ninepay_handle_charge( $amount, $config['ninepay_payment_method_installment_fee_percent'], $config['ninepay_payment_method_installment_fee_fixed'] ); 865 810 866 default: 811 867 return 0;
Note: See TracChangeset
for help on using the changeset viewer.