!function(){var t="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global,e=function(t,e,i){this.MC2PPublicKey=t,this.token=e,this.PAY_ORIGIN_URL="https://pay.mychoice2pay.com",this.API_URL="https://api.mychoice2pay.com/v1/pay/"+this.token+"/",this.API_HTML_URL=this.API_URL+"html/",this.API_CARD_URL=this.API_URL+"card/",this.API_ACCOUNT_URL=this.API_URL+"account/",this.API_SHARE_URL=this.API_URL+"share/",this.REDIRECT_URL="https://pay.mychoice2pay.com/#/"+this.token+"/redirect/",this.DIVVY_URL="https://pay.mychoice2pay.com/#/"+this.token+"/divvy",this.options={notRedirectHtml:i&&i.notRedirectHtml||!1,htmlDivId:i&&i.htmlDivId||"mc2p-html-div",cardDivId:i&&i.cardDivId||"mc2p-card-div",cardDataNameId:i&&i.cardDataNameId||"mc2p-card-name",cardDataNumberId:i&&i.cardDataNumberId||"mc2p-card-number",cardDataMonthId:i&&i.cardDataMonthId||"mc2p-card-month",cardDataYearId:i&&i.cardDataYearId||"mc2p-card-year",cardDataCVVId:i&&i.cardDataCVVId||"mc2p-card-cvv",iFrameId:i&&i.iFrameId||!1,iFrameGateways:i&&i.iFrameGateways||{},sendCardDetailsCallback:i&&i.sendCardDetailsCallback||void 0,sendAccountDetailsCallback:i&&i.sendAccountDetailsCallback||void 0,openInWindow:i&&i.openInWindow||!1,windowGateways:i&&i.windowGateways||{},windowsClosedCallback:i&&i.windowsClosedCallback||void 0,windowsFinishedCallback:i&&i.windowsFinishedCallback||void 0},this.gatewaysList=[],this.gatewaySelected=null},i=function(t,e){return function(i){t.innerHTML=i.html,e.showId(e.options.htmlDivId)}},a=function(t,e){return function(i){t.innerHTML=i.html,e.showId(e.options.htmlDivId),document.querySelector("#"+e.options.htmlDivId+" form").submit()}};e.prototype.__request=function(t,e,i,a){var o=new XMLHttpRequest;if(a&&(o.onreadystatechange=function(){4==o.readyState&&a(JSON.parse(o.responseText))}),o.open(t,e,!!a),o.setRequestHeader("Authorization","PublicKey "+this.MC2PPublicKey),o.setRequestHeader("Content-type","application/json"),o.send(i?JSON.stringify(i):null),!a)return JSON.parse(o.responseText)},e.prototype.getGateways=function(t){if(t){var e=this;return this.__request("GET",this.API_URL,null,function(i){e.gatewaysList=i.gateways,t(i)})}var i=this.__request("GET",this.API_URL,null,t);return this.gatewaysList=i.gateways,i},e.prototype.html=function(t,e){return this.__request("GET",this.API_HTML_URL+t+"/",null,e)},e.prototype.card=function(t,e,i){return this.__request("POST",this.API_CARD_URL+t+"/",e,i)},e.prototype.account=function(t,e,i){return this.__request("POST",this.API_ACCOUNT_URL+t+"/",e,i)},e.prototype.share=function(t,e){return this.__request("POST",this.API_SHARE_URL,t,e)},e.prototype.selectGateway=function(t){var e=document.getElementById(this.options.htmlDivId),o=void 0;this.options.iFrameId&&(o=document.getElementById(this.options.iFrameId)),this.hideId(this.options.htmlDivId),this.hideId(this.options.cardDivId),this.options.iFrameId&&this.hideId(this.options.iFrameId);for(var s=0;s0){i=i[0];for(var a=new FormData(i).entries(),o={};;){var s=a.next();if(s.done)break;var n=s.value;o[n[0]]=n[1]}this.account(this.gatewaySelected.code,o,t)}}return!1},e.prototype.hideClass=function(t){for(var e=document.getElementsByClassName(t),i=0;i