Created
July 8, 2019 10:22
-
-
Save ftpyz/45d8639fb17e4a695541a62281dee9c7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function () { | |
}); | |
jQuery(document).on('keyup','#iyziposplus-card-number',function (e) { | |
if(jQuery(this).val().replace(/ /g,'').length > 6){ | |
binNumber=jQuery('#iyziposplus-card-number').val().replace(/ /g,'').substring(0,6); | |
queryBinNumber=binNumber; | |
} | |
}); | |
jQuery(document).on('keyup','#iyziposplus-card-number',function(e){ | |
/*kart no değişirse cvc ve tarihi sıfırla taksiti gizle*/ | |
e.preventDefault(); | |
if(jQuery(this).val().replace(/ /g,'').length >= 16){ | |
jQuery('#iyziposplus-card-expiry,#iyziposplus-card-cvc').val(''); | |
jQuery('#iyziposplus-card-installment').css('display','none'); | |
} | |
}); | |
jQuery(document).on('keyup','#iyziposplus-card-cvc',function(e){ | |
cvc=jQuery('#iyziposplus-card-cvc').val(); | |
if(binNumber.length==6 && cvc.length >= 3){ | |
jQuery.ajax({ | |
url:iyziposplus_object.ajax_url, | |
type:'POST', | |
dataType:'json', | |
data:{'action':'iyziposplusInstallment','binNumber':jQuery('#iyziposplus-card-number').val().replace(/ /g,'').substring(0,6)}, | |
beforeSend:function(){ | |
//jQuery('body').trigger('update_checkout'); | |
jQuery('#wc-iyziposplus-cc-form').find('input,select').prop('disabled',true); | |
jQuery('#iyziposplus-card-installment').css('display','none'); | |
jQuery('form.checkout button').prop('disabled',true); | |
}, | |
success:function (data) { | |
jQuery('#iyziposplus-card-installment > select').html(''); | |
var totalInstallment=0; | |
jQuery.each(data,function (e,x) { | |
jQuery('#iyziposplus-card-installment > select').append('<option value="'+x['number']+'">'+x['text']+'</option>'); | |
totalInstallment++; | |
}); | |
jQuery('#wc-iyziposplus-cc-form').find('input,select').prop('disabled',false); | |
jQuery('form.checkout button').prop('disabled',false); | |
if(totalInstallment > 1){ | |
jQuery('#iyziposplus-card-installment').css('display','block'); | |
} | |
//jQuery( document.body ).trigger( 'init_checkout' ); | |
} | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment