{"size": 2675, "ext": "js", "max_stars_repo_path": "www/html/bitrix/modules/sale/handlers/paysystem/qiwi/template/script.min.js", "max_stars_repo_name": "Evil1991/bitrixdock", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "www/html/bitrix/modules/sale/handlers/paysystem/qiwi/template/script.min.js", "max_issues_repo_name": "Evil1991/bitrixdock", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "www/html/bitrix/modules/sale/handlers/paysystem/qiwi/template/script.min.js", "max_forks_repo_name": "Evil1991/bitrixdock", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 1337.5, "max_line_length": 2640, "alphanum_fraction": 0.7846728972}
(function(){"use strict";if(!BX.Sale)BX.Sale={};if(BX.Sale.Qiwi)return;BX.Sale.Qiwi={init:function(t){this.formNode=BX(t.formId);this.paysystemBlockNode=BX(t.paysystemBlockId);this.ajaxUrl=t.ajaxUrl;this.paymentId=t.paymentId;this.paySystemId=t.paySystemId;this.isAllowedSubmitting=true;this.returnUrl=t.returnUrl;this.bindEvents()},bindEvents:function(){BX.bind(this.formNode,"submit",BX.proxy(this.sendRequest,this))},sendRequest:function(t){t.preventDefault();if(!this.isAllowedSubmitting){return}var e,i=this.getAllFormData(),n=this.formNode.querySelector('input[type="submit"]'),s;if(n){n.disabled=true}this.isAllowedSubmitting=false;e={sessid:BX.bitrix_sessid(),PAYMENT_ID:this.paymentId,PAYSYSTEM_ID:this.paySystemId,RETURN_URL:this.returnUrl};for(s in i){if(i.hasOwnProperty(s)){e[s]=i[s]}}BX.ajax({method:"POST",dataType:"json",url:this.ajaxUrl,data:e,onsuccess:BX.proxy(function(t){if(t.status==="success"){this.isAllowedSubmitting=true;this.updateTemplateHtml(t.template)}else if(t.status==="error"){this.isAllowedSubmitting=true;this.showErrorTemplate(t.buyerErrors);BX.onCustomEvent("onPaySystemAjaxError",[t.buyerErrors])}},this)})},getAllFormData:function(){var t=BX.ajax.prepareForm(this.formNode),e;for(e in t.data){if(t.data.hasOwnProperty(e)&&e===""){delete t.data[e]}}return!!t&&t.data?t.data:{}},updateTemplateHtml:function(t){BX.html(this.paysystemBlockNode,t).then(function(){BX.onCustomEvent("onPaySystemUpdateTemplate")}.bind(this))},showErrorTemplate:function(t){var e=[BX.message("SALE_HPS_QIWI_ERROR_MESSAGE_HEADER")];if(t){for(var i in t){if(t.hasOwnProperty(i)){e.push(t[i])}}}e.push(BX.message("SALE_HPS_QIWI_ERROR_MESSAGE_FOOTER"));var n=BX.create("div",{props:{className:"alert alert-danger"},html:e.join("<br />")});this.paysystemBlockNode.innerHTML="";this.paysystemBlockNode.appendChild(n)},PaymentPhoneForm:function(t){this.init=function(t){this.phoneFormatDataUrl=t.phoneFormatDataUrl||null;this.phoneCountryCode=t.phoneCountryCode||null;this.form=BX(t.form);if(this.form){this.initPhoneControls()}};this.initPhoneControls=function(){var t=BX.convert.nodeListToArray(this.form.querySelectorAll(".js-paysystem-qiwi-input-phone"));t.forEach(function(t){this.initPhoneControl(t,false)},this)};this.initPhoneControl=function(t){if(!t){return}var e=t.nextElementSibling;new BXMaskedPhone({url:this.phoneFormatDataUrl,country:this.phoneCountryCode,maskedInput:{input:t,dataInput:e}});this.initDisplayedToDataControlEvents(t,e)};this.initDisplayedToDataControlEvents=function(t,e){BX.bind(t,"blur",function(){BX.fireEvent(e,"blur")});BX.bind(t,"focus",function(){BX.fireEvent(e,"focus")})};this.init(t)}}})();
//# sourceMappingURL=script.map.js