0
Good morning!
I installed the Transparent Checkout module of Pagseguro in my store Magento, version 1.8.0.0, available in this link.
I can’t finalize the purchase! Transparent checkout has already been authorized by Pagseguro, but when I get to the step-by-step request, an error is generated. The order goes to the back-end, but no customer payment options appear.
The error is as follows:
According to what I read on Google, it seems to be a CPF validation error. Unfortunately I found very little documentation about and I have little experience in javascript.
The file in question, checkout.js, has the following code:
var IdeasaValidator=Class.create({initialize:function(a){this.paymentMethod="payment_form_"+a.paymentMethod},cpf:function(a){a.value=this._mcpf(a.value)},numeric:function(a){a.value=this._mnum(a.value)},upper:function(a){a.value=this._upper(a.value)},_mcpf:function(a){a=a.replace(/\D/g,"");a=a.replace(/(\d{3})(\d)/,"$1.$2");a=a.replace(/(\d{3})(\d)/,"$1.$2");a=a.replace(/(\d{3})(\d{1,2})$/,"$1-$2");return a},_mnum:function(a){a=a.replace(/\D/g,"");return a},_upper:function(a){a=a.replace(/\d/g,"");a=a.replace(/[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi,"");return a.replace(/[a-z]/g,function b(c){return c.toUpperCase()})}});String.prototype.isCPF=function(){var e=this;if(e==""){return true}if((e=e.replace(/[^\d]/g,"").split("")).length!=11){return false}if(new RegExp("^"+e[0]+"{11}$").test(e.join(""))){return false}for(var b=10,d=0,a=0;b>=2;d+=e[a++]*b--){}if(e[9]!=(((d%=11)<2)?0:11-d)){return false}for(var b=11,d=0,a=0;b>=2;d+=e[a++]*b--){}if(e[10]!=(((d%=11)<2)?0:11-d)){return false}return true};String.prototype.isCNPJ=function(){var f=this;if(f==""){return true}var a=[6,5,4,3,2,9,8,7,6,5,4,3,2];if((f=f.replace(/[^\d]/g,"").split("")).length!=14){return false}for(var d=0,e=0;d<12;e+=f[d]*a[++d]){}if(f[12]!=(((e%=11)<2)?0:11-e)){return false}for(var d=0,e=0;d<=12;e+=f[d]*a[d++]){}if(f[13]!=(((e%=11)<2)?0:11-e)){return false}return true};Validation.add("cpf",Translator.translate('CPF Inválido.'),function(a){return a.isCPF()});Validation.add("ideasa-validate-alpha","Somente letras",function(a){return Validation.get("IsEmpty").test(a)||/^[a-zA-Z ]+$/.test(a)});Validation.add("validate-one-payment-brand",Translator.translate('Por favor, selecione uma opção de pagamento: Cartão de Crédito, Débito ou Boleto.'),function(b,d){var a=$(d).readAttribute("data-method");var c=$$("#payment_form_"+a+" span.select").length;return(c>0)});var IdeasaToggleToolTip=Class.create({initialize:function(a){this.tip=$("ideasa-payment-"+a+"-tool-tip")},insert:function(a){if(this.tip){this.tip.setStyle({left:(Event.pointerX(a)-100)+"px",top:(Event.pointerY(a)-300)+"px"});this.tip.toggle()}Event.stop(a)}});$$('[name="payment[method]"]').invoke("observe","click",function(){$$(".ideasa input[type=radio]").each(function(a){a.setAttribute("name","")});$$(".ideasa .ideasa-parcelas select").each(function(a){a.setAttribute("name","")});$$(".select").each(function(a){a.removeClassName("select")});$$(".divPagForm").invoke("hide");if(element.checked){$$("input[name=payment[selected]]").each(function(a){$(a).removeClassName("validate-one-payment-brand");if($(a).readAttribute("data-method")==element.id){$(a).addClassName("validate-one-payment-brand")}})}if(isUrlTelevendas){ideasa.review()}});ideasa.review=function(){var a=Form.serialize("co-payment-form");ideasa.updateReview(a)};ideasa.updateReview=function(a){$("loadingmask").show();$("form-items").innerHTML="";new Ajax.Request(urlTelev,{method:"post",parameters:a,onComplete:function(b){$("loadingmask").hide();$("form-items").innerHTML=b.responseText}})};
The error part of: Validation.add("cpf",Translator.translate("CPF Inválido.")
.
I am not sure what to do. I would like to count on your help!
Give me the idea that you forgot to merge the script that defines that variable
Translator
that the error claims not to have been loaded (ie: not closed).– Sergio
I got the module ready, it’s weird, I don’t see anyone complaining about this mistake on Google. What I noticed in the theme I’m using is that the default folder gives a changed, according to others I installed.
– Hebert Richard
Place here a pasteit/gist of the page’s html to see which scripts you are loading. Not including the code/script is not a code error, it is an error in the configuration, hence probably not discussed.
– Sergio
I have been analyzing, the file was not being set. Even after fixing this, the problems continue. The site is here: http://donachicosa.com.br. Just choose a product and click on "Finish Order", the error appears. You can proceed to the last screen, but the means of payment do not appear!
– Hebert Richard