var REDSYS_DOMAIN = 'https://sis-t.redsys.es:25443'; var IFRAME_REDSYS = 'redsys-hosted-pay-button'; var result3DSMethod = ''; var id3DSMethod = ''; function getCardInput(id, style, textoPlaceholder, styleInput){ var div = document.getElementById(id); if(textoPlaceholder === undefined){ textoPlaceholder = ''; } if(styleInput === undefined){ styleInput = ''; } var frame = document.createElement('iframe'); frame.setAttribute('id', 'redsys-hosted-field-number'); frame.setAttribute('name','redsys-hosted-field-number'); frame.setAttribute('style','width: 100%; height: 100%;'); frame.setAttribute('frameborder', '0'); frame.setAttribute('type', 'number'); frame.setAttribute('scrolling', 'no'); frame.setAttribute('sandbox','allow-same-origin allow-scripts'); frame.setAttribute('src', REDSYS_DOMAIN +'/sis/getInputNC?style='+toHex(style)+'&styleInput='+toHex(styleInput)+'&frame=cardNumber&version=V3&textoPlaceholder='+toHex(textoPlaceholder)); div.appendChild(frame); } function getExpirationInput(id, style, textoPlaceholder){ var div = document.getElementById(id); if(textoPlaceholder === undefined){ textoPlaceholder = ''; } var frame = document.createElement('iframe'); frame.setAttribute('id', 'redsys-hosted-field-expiration'); frame.setAttribute('name','redsys-hosted-field-expiration'); frame.setAttribute('style','width: 100%; height: 100%;'); frame.setAttribute('frameborder', '0'); frame.setAttribute('src', REDSYS_DOMAIN +'/sis/getInputNC?style='+toHex(style)+'&frame=expiration&version=V3&textoPlaceholder='+toHex(textoPlaceholder)); frame.setAttribute('type', 'tel'); frame.setAttribute('scrolling', 'no'); frame.setAttribute('sandbox','allow-same-origin allow-scripts'); div.appendChild(frame); } function getExpirationYearInput(id, style, textoPlaceholder){ var div = document.getElementById(id); if(textoPlaceholder === undefined){ textoPlaceholder = ''; } var frame = document.createElement('iframe'); frame.setAttribute('id', 'redsys-hosted-field-expirationYear'); frame.setAttribute('name','redsys-hosted-field-expirationYear'); frame.setAttribute('style','width: 100%; height: 100%;'); frame.setAttribute('frameborder', '0'); frame.setAttribute('src', REDSYS_DOMAIN +'/sis/getInputNC?style='+toHex(style)+'&frame=expirationYear&version=V3&textoPlaceholder='+toHex(textoPlaceholder)); frame.setAttribute('type', 'tel'); frame.setAttribute('scrolling', 'no'); frame.setAttribute('sandbox','allow-same-origin allow-scripts'); div.appendChild(frame); } function getExpirationMonthInput(id, style, textoPlaceholder){ var div = document.getElementById(id); if(textoPlaceholder === undefined){ textoPlaceholder = ''; } var frame = document.createElement('iframe'); frame.setAttribute('id', 'redsys-hosted-field-expirationMonth'); frame.setAttribute('name','redsys-hosted-field-expirationMonth'); frame.setAttribute('style','width: 100%; height: 100%;'); frame.setAttribute('frameborder', '0'); frame.setAttribute('src', REDSYS_DOMAIN +'/sis/getInputNC?style='+toHex(style)+'&frame=expirationMonth&version=V3&textoPlaceholder='+toHex(textoPlaceholder)); frame.setAttribute('type', 'tel'); frame.setAttribute('scrolling', 'no'); frame.setAttribute('sandbox','allow-same-origin allow-scripts'); div.appendChild(frame); } function getCVVInput(id, style, textoPlaceholder){ var div = document.getElementById(id); if(textoPlaceholder === undefined){ textoPlaceholder = ''; } var frame = document.createElement('iframe'); frame.setAttribute('id', 'redsys-hosted-field-cvv'); frame.setAttribute('name','redsys-hosted-field-cvv'); frame.setAttribute('style','width: 100%; height: 100%;'); frame.setAttribute('frameborder', '0'); frame.setAttribute('type', 'number'); frame.setAttribute('scrolling', 'no'); frame.setAttribute('sandbox','allow-same-origin allow-scripts'); frame.setAttribute('src', REDSYS_DOMAIN +'/sis/getInputNC?style='+toHex(style)+'&frame=cvv&version=V3&textoPlaceholder='+toHex(textoPlaceholder)); div.appendChild(frame); } function getPayButton(id, style, buttonValue, fuc, terminal, order){ var div = document.getElementById(id); var frame = document.createElement('iframe'); frame.setAttribute('id', IFRAME_REDSYS); frame.setAttribute('name',IFRAME_REDSYS); frame.setAttribute('style','width: 100%; height: 100%;'); frame.setAttribute('frameborder', '0'); frame.setAttribute('type', 'number'); frame.setAttribute('scrolling', 'no'); frame.setAttribute('onload', 'setMerchantDomain(500);'); frame.setAttribute('sandbox','allow-same-origin allow-scripts allow-modals'); frame.setAttribute('src', REDSYS_DOMAIN +'/sis/getInputNC?buttonValue='+toHex(buttonValue)+'&style='+toHex(style)+'&frame=button&fuc='+toHex(fuc)+'&terminal='+toHex(terminal)+'&order='+toHex(order)+'&version=V3'); div.appendChild(frame); } function getInSiteForm(id, styleButton, styleBody, styleBox, styleBoxText, buttonValue, fuc, terminal, order, idioma){ getInSiteForm(id, styleButton, styleBody, styleBox, styleBoxText, buttonValue, fuc, terminal, order, idioma, true); } function getInSiteForm(id, styleButton, styleBody, styleBox, styleBoxText, buttonValue, fuc, terminal, order){ getInSiteForm(id, styleButton, styleBody, styleBox, styleBoxText, buttonValue, fuc, terminal, order, 'ES', true); } function getInSiteForm(id, styleButton, styleBody, styleBox, styleBoxText, buttonValue, fuc, terminal, order, idioma, mostrarLogo, estiloReducido, estiloInsiteForm, ocultarBoton){ var div = document.getElementById(id); var idiomaInsite = idioma || 'ES'; var mostrarLogoInsite = typeof mostrarLogo !== 'undefined' ? mostrarLogo : true; var estiloReducidoInsite = typeof estiloReducido !== 'undefined' ? estiloReducido : false; var estiloInsite = (estiloInsiteForm === 'inline' || estiloInsiteForm === 'twoRows') ? estiloInsiteForm : 'inline'; var ocultarBoton = typeof ocultarBoton !== 'undefined' ? ocultarBoton : false; var frame = document.createElement('iframe'); frame.setAttribute('id', IFRAME_REDSYS); frame.setAttribute('name',IFRAME_REDSYS); if(estiloReducidoInsite === true){ frame.setAttribute('style','width: 100%; height: 100%; max-width: 500px'); } else { frame.setAttribute('style','width: 100%; height: 100%;'); } frame.setAttribute('frameborder', '0'); frame.setAttribute('type', 'number'); frame.setAttribute('scrolling', 'no'); frame.setAttribute('onload', 'setMerchantDomain(500);'); frame.setAttribute('sandbox','allow-same-origin allow-scripts allow-modals allow-popups'); frame.setAttribute('src', REDSYS_DOMAIN +'/sis/getInputNC?buttonValue='+toHex(buttonValue)+'&styleButton='+toHex(styleButton)+'&styleBody='+toHex(styleBody) +'&styleBox='+toHex(styleBox)+'&styleBoxText='+toHex(styleBoxText)+'&frame=inSite&fuc='+toHex(fuc)+'&terminal='+toHex(terminal)+'&order='+toHex(order) +'&version=V3'+'&idioma='+ idiomaInsite+'&mostrarLogo='+ mostrarLogoInsite+'&estiloInsite='+ estiloInsite+'&ocultarBoton='+ ocultarBoton); div.appendChild(frame); } function getInSiteFormJSON(insiteJSON){ var id = insiteJSON.id || ''; var styleButton = insiteJSON.styleButton || ''; var styleBody = insiteJSON.styleBody || ''; var styleBox = insiteJSON.styleBox || ''; var styleBoxText = insiteJSON.styleBoxText || ''; var buttonValue = insiteJSON.buttonValue || 'Pagar'; var fuc = insiteJSON.fuc || ''; var terminal = insiteJSON.terminal || ''; var order = insiteJSON.order || ''; var idiomaInsite = insiteJSON.idioma || 'ES'; var mostrarLogoInsite = (insiteJSON.mostrarLogo === true || insiteJSON.mostrarLogo === false) ? insiteJSON.mostrarLogo : true; var estiloInsite = (insiteJSON.estiloInsite === 'inline' || insiteJSON.estiloInsite === 'twoRows') ? insiteJSON.estiloInsite : 'inline'; var estiloReducidoInsite = insiteJSON.estiloReducido || false; var ocultarBoton = typeof insiteJSON.ocultarBoton !== 'undefined' ? insiteJSON.ocultarBoton : false; var div = document.getElementById(id); var frame = document.createElement('iframe'); frame.setAttribute('id', IFRAME_REDSYS); frame.setAttribute('name',IFRAME_REDSYS); if(estiloReducidoInsite === true){ frame.setAttribute('style','width: 100%; height: 100%; max-width: 500px'); } else { frame.setAttribute('style','width: 100%; height: 100%;'); } frame.setAttribute('frameborder', '0'); frame.setAttribute('type', 'number'); frame.setAttribute('scrolling', 'no'); frame.setAttribute('onload', 'setMerchantDomain(0);'); frame.setAttribute('sandbox','allow-same-origin allow-scripts allow-modals allow-popups'); frame.setAttribute('src', REDSYS_DOMAIN +'/sis/getInputNC?buttonValue='+toHex(buttonValue)+'&styleButton='+toHex(styleButton)+'&styleBody='+toHex(styleBody) +'&styleBox='+toHex(styleBox)+'&styleBoxText='+toHex(styleBoxText)+'&frame=inSite&fuc='+toHex(fuc)+'&terminal='+toHex(terminal)+'&order='+toHex(order) +'&version=V3'+'&idioma='+ idiomaInsite+'&mostrarLogo='+ mostrarLogoInsite+'&estiloInsite='+ estiloInsite+'&ocultarBoton='+ ocultarBoton); div.appendChild(frame); } function init3DS(id,emv3ds) { document.getElementById(id).innerHTML ="
"; var frame = document.createElement('iframe'); frame.setAttribute('id', 'redsys-hosted-field-3ds'); frame.setAttribute('name','redsys-hosted-field-3ds'); frame.setAttribute('style','width: 100%; height: 100%;'); frame.setAttribute('frameborder', '0'); frame.setAttribute('scrolling', 'no'); frame.setAttribute('sandbox','allow-same-origin allow-scripts allow-forms'); frame.setAttribute('src', REDSYS_DOMAIN +'/sis/getInputNC?emv3ds='+toHex(emv3ds)+'&frame=3ds&version=V3'); document.getElementById('lightFrame').appendChild(frame); } function execute3DSMethod(id,threeDSMethodURL,threeDSServerTransID) { id3DSMethod = id; var frame = document.createElement('iframe'); frame.setAttribute('id', 'redsys-hosted-field-3dsmethod'); frame.setAttribute('name','redsys-hosted-field-3dsmethod'); frame.setAttribute('style','width:0;height:0;border:0;border:none;display:none;'); frame.setAttribute('src', REDSYS_DOMAIN +'/sis/getInputNC?threeDSMethodURL='+threeDSMethodURL+'&threeDSServerTransID='+threeDSServerTransID+'&frame=3dsmethod&version=V3'); document.getElementsByTagName("BODY")[0].appendChild(frame); setTimeout(function(){ if (result3DSMethod == '') { result3DSMethod = 'N'; document.getElementById(id3DSMethod).value = result3DSMethod; } },10000); } function toHex(str) { var hex = ''; for(var i=0;i