+ * @copyright Author
+ */
+
+var SqueezeBox = {
+
+ presets: {
+ onOpen: $empty,
+ onClose: $empty,
+ onUpdate: $empty,
+ onResize: $empty,
+ onMove: $empty,
+ onShow: $empty,
+ onHide: $empty,
+ size: {x: 600, y: 450},
+ sizeLoading: {x: 200, y: 150},
+ marginInner: {x: 20, y: 20},
+ marginImage: {x: 50, y: 75},
+ handler: false,
+ target: null,
+ closable: true,
+ closeBtn: true,
+ zIndex: 65555,
+ overlayOpacity: 0.7,
+ classWindow: '',
+ classOverlay: '',
+ overlayFx: {},
+ resizeFx: {},
+ contentFx: {},
+ parse: false, // 'rel'
+ parseSecure: false,
+ shadow: true,
+ document: null,
+ ajaxOptions: {}
+ },
+
+ initialize: function(presets) {
+ if (this.options) return this;
+
+ this.presets = $merge(this.presets, presets);
+ this.doc = this.presets.document || document;
+ this.options = {};
+ this.setOptions(this.presets).build();
+ this.bound = {
+ window: this.reposition.bind(this, [null]),
+ scroll: this.checkTarget.bind(this),
+ close: this.close.bind(this),
+ key: this.onKey.bind(this)
+ };
+ this.isOpen = this.isLoading = false;
+ return this;
+ },
+
+ build: function() {
+ this.overlay = new Element('div', {
+ id: 'sbox-overlay',
+ styles: {display: 'none', zIndex: this.options.zIndex}
+ });
+ this.win = new Element('div', {
+ id: 'sbox-window',
+ styles: {display: 'none', zIndex: this.options.zIndex + 2}
+ });
+ if (this.options.shadow) {
+ if (Browser.Engine.webkit420) {
+ this.win.setStyle('-webkit-box-shadow', '0 0 10px rgba(0, 0, 0, 0.7)');
+ } else if (!Browser.Engine.trident4) {
+ var shadow = new Element('div', {'class': 'sbox-bg-wrap'}).inject(this.win);
+ var relay = function(e) {
+ this.overlay.fireEvent('click', [e]);
+ }.bind(this);
+ ['n', 'ne', 'e', 'se', 's', 'sw', 'w', 'nw'].each(function(dir) {
+ new Element('div', {'class': 'sbox-bg sbox-bg-' + dir}).inject(shadow).addEvent('click', relay);
+ });
+ }
+ }
+ this.content = new Element('div', {id: 'sbox-content'}).inject(this.win);
+ this.closeBtn = new Element('a', {id: 'sbox-btn-close', href: '#'}).inject(this.win);
+ this.fx = {
+ overlay: new Fx.Tween(this.overlay, $merge({
+ property: 'opacity',
+ onStart: Events.prototype.clearChain,
+ duration: 250,
+ link: 'cancel'
+ }, this.options.overlayFx)).set(0),
+ win: new Fx.Morph(this.win, $merge({
+ onStart: Events.prototype.clearChain,
+ unit: 'px',
+ duration: 750,
+ transition: Fx.Transitions.Quint.easeOut,
+ link: 'cancel',
+ unit: 'px'
+ }, this.options.resizeFx)),
+ content: new Fx.Tween(this.content, $merge({
+ property: 'opacity',
+ duration: 250,
+ link: 'cancel'
+ }, this.options.contentFx)).set(0)
+ };
+ $(this.doc.body).adopt(this.overlay, this.win);
+ },
+
+ assign: function(to, options) {
+ return ($(to) || $$(to)).addEvent('click', function() {
+ return !SqueezeBox.fromElement(this, options);
+ });
+ },
+
+ open: function(subject, options) {
+ this.initialize();
+
+ if (this.element != null) this.trash();
+ this.element = $(subject) || false;
+
+ this.setOptions($merge(this.presets, options || {}));
+
+ if (this.element && this.options.parse) {
+ var obj = this.element.getProperty(this.options.parse);
+ if (obj && (obj = JSON.decode(obj, this.options.parseSecure))) this.setOptions(obj);
+ }
+ this.url = ((this.element) ? (this.element.get('href')) : subject) || this.options.url || '';
+
+ this.assignOptions();
+
+ var handler = handler || this.options.handler;
+ if (handler) return this.setContent(handler, this.parsers[handler].call(this, true));
+ var ret = false;
+ return this.parsers.some(function(parser, key) {
+ var content = parser.call(this);
+ if (content) {
+ ret = this.setContent(key, content);
+ return true;
+ }
+ return false;
+ }, this);
+ },
+
+ fromElement: function(from, options) {
+ return this.open(from, options);
+ },
+
+ assignOptions: function() {
+ this.overlay.set('class', this.options.classOverlay);
+ this.win.set('class', this.options.classWindow);
+ if (Browser.Engine.trident4) this.win.addClass('sbox-window-ie6');
+ },
+
+ close: function(e) {
+ var stoppable = ($type(e) == 'event');
+ if (stoppable) e.stop();
+ if (!this.isOpen || (stoppable && !$lambda(this.options.closable).call(this, e))) return this;
+ this.fx.overlay.start(0).chain(this.toggleOverlay.bind(this));
+ this.win.setStyle('display', 'none');
+ this.fireEvent('onClose', [this.content]);
+ this.trash();
+ this.toggleListeners();
+ this.isOpen = false;
+ return this;
+ },
+
+ trash: function() {
+ this.element = this.asset = null;
+ this.content.empty();
+ this.options = {};
+ this.removeEvents().setOptions(this.presets).callChain();
+ },
+
+ onError: function() {
+ this.asset = null;
+ this.setContent('string', this.options.errorMsg || 'An error occurred');
+ },
+
+ setContent: function(handler, content) {
+ if (!this.handlers[handler]) return false;
+ this.content.className = 'sbox-content-' + handler;
+ this.applyTimer = this.applyContent.delay(this.fx.overlay.options.duration, this, this.handlers[handler].call(this, content));
+ if (this.overlay.retrieve('opacity')) return this;
+ this.toggleOverlay(true);
+ this.fx.overlay.start(this.options.overlayOpacity);
+ return this.reposition();
+ },
+
+ applyContent: function(content, size) {
+ if (!this.isOpen && !this.applyTimer) return;
+ this.applyTimer = $clear(this.applyTimer);
+ this.hideContent();
+ if (!content) {
+ this.toggleLoading(true);
+ } else {
+ if (this.isLoading) this.toggleLoading(false);
+ this.fireEvent('onUpdate', [this.content], 20);
+ }
+ if (content) {
+ if (['string', 'array'].contains($type(content))) this.content.set('html', content);
+ else if (!this.content.hasChild(content)) this.content.adopt(content);
+ }
+ this.callChain();
+ if (!this.isOpen) {
+ this.toggleListeners(true);
+ this.resize(size, true);
+ this.isOpen = true;
+ this.fireEvent('onOpen', [this.content]);
+ } else {
+ this.resize(size);
+ }
+ },
+
+ resize: function(size, instantly) {
+ this.showTimer = $clear(this.showTimer || null);
+ var box = this.doc.getSize(), scroll = this.doc.getScroll();
+ this.size = $merge((this.isLoading) ? this.options.sizeLoading : this.options.size, size);
+ var to = {
+ width: this.size.x,
+ height: this.size.y,
+ left: (scroll.x + (box.x - this.size.x - this.options.marginInner.x) / 2).toInt(),
+ top: (scroll.y + (box.y - this.size.y - this.options.marginInner.y) / 2).toInt()
+ };
+ this.hideContent();
+ if (!instantly) {
+ this.fx.win.start(to).chain(this.showContent.bind(this));
+ } else {
+ this.win.setStyles(to).setStyle('display', '');
+ this.showTimer = this.showContent.delay(50, this);
+ }
+ return this.reposition();
+ },
+
+ toggleListeners: function(state) {
+ var fn = (state) ? 'addEvent' : 'removeEvent';
+ this.closeBtn[fn]('click', this.bound.close);
+ this.overlay[fn]('click', this.bound.close);
+ this.doc[fn]('keydown', this.bound.key)[fn]('mousewheel', this.bound.scroll);
+ this.doc.getWindow()[fn]('resize', this.bound.window)[fn]('scroll', this.bound.window);
+ },
+
+ toggleLoading: function(state) {
+ this.isLoading = state;
+ this.win[(state) ? 'addClass' : 'removeClass']('sbox-loading');
+ if (state) this.fireEvent('onLoading', [this.win]);
+ },
+
+ toggleOverlay: function(state) {
+ var full = this.doc.getSize().x;
+ this.overlay.setStyle('display', (state) ? '' : 'none');
+ this.doc.body[(state) ? 'addClass' : 'removeClass']('body-overlayed');
+ if (state) {
+ this.scrollOffset = this.doc.getWindow().getSize().x - full;
+ this.doc.body.setStyle('margin-right', this.scrollOffset);
+ } else {
+ this.doc.body.setStyle('margin-right', '');
+ }
+ },
+
+ showContent: function() {
+ if (this.content.get('opacity')) this.fireEvent('onShow', [this.win]);
+ this.fx.content.start(1);
+ },
+
+ hideContent: function() {
+ if (!this.content.get('opacity')) this.fireEvent('onHide', [this.win]);
+ this.fx.content.cancel().set(0);
+ },
+
+ onKey: function(e) {
+ switch (e.key) {
+ case 'esc': this.close(e);
+ case 'up': case 'down': return false;
+ }
+ },
+
+ checkTarget: function(e) {
+ return this.content.hasChild(e.target);
+ },
+
+ reposition: function() {
+ var size = this.doc.getSize(), scroll = this.doc.getScroll(), ssize = this.doc.getScrollSize();
+ this.overlay.setStyles({
+ width: ssize.x + 'px',
+ height: ssize.y + 'px'
+ });
+ this.win.setStyles({
+ left: (scroll.x + (size.x - this.win.offsetWidth) / 2 - this.scrollOffset).toInt() + 'px',
+ top: (scroll.y + (size.y - this.win.offsetHeight) / 2).toInt() + 'px'
+ });
+ return this.fireEvent('onMove', [this.overlay, this.win]);
+ },
+
+ removeEvents: function(type){
+ if (!this.$events) return this;
+ if (!type) this.$events = null;
+ else if (this.$events[type]) this.$events[type] = null;
+ return this;
+ },
+
+ extend: function(properties) {
+ return $extend(this, properties);
+ },
+
+ handlers: new Hash(),
+
+ parsers: new Hash()
+
+};
+
+SqueezeBox.extend(new Events($empty)).extend(new Options($empty)).extend(new Chain($empty));
+
+SqueezeBox.parsers.extend({
+
+ image: function(preset) {
+ return (preset || (/\.(?:jpg|png|gif)$/i).test(this.url)) ? this.url : false;
+ },
+
+ clone: function(preset) {
+ if ($(this.options.target)) return $(this.options.target);
+ if (this.element && !this.element.parentNode) return this.element;
+ var bits = this.url.match(/#([\w-]+)$/);
+ return (bits) ? $(bits[1]) : (preset ? this.element : false);
+ },
+
+ ajax: function(preset) {
+ return (preset || (this.url && !(/^(?:javascript|#)/i).test(this.url))) ? this.url : false;
+ },
+
+ iframe: function(preset) {
+ return (preset || this.url) ? this.url : false;
+ },
+
+ string: function(preset) {
+ return true;
+ }
+});
+
+SqueezeBox.handlers.extend({
+
+ image: function(url) {
+ var size, tmp = new Image();
+ this.asset = null;
+ tmp.onload = tmp.onabort = tmp.onerror = (function() {
+ tmp.onload = tmp.onabort = tmp.onerror = null;
+ if (!tmp.width) {
+ this.onError.delay(10, this);
+ return;
+ }
+ var box = this.doc.getSize();
+ box.x -= this.options.marginImage.x;
+ box.y -= this.options.marginImage.y;
+ size = {x: tmp.width, y: tmp.height};
+ for (var i = 2; i--;) {
+ if (size.x > box.x) {
+ size.y *= box.x / size.x;
+ size.x = box.x;
+ } else if (size.y > box.y) {
+ size.x *= box.y / size.y;
+ size.y = box.y;
+ }
+ }
+ size.x = size.x.toInt();
+ size.y = size.y.toInt();
+ this.asset = $(tmp);
+ tmp = null;
+ this.asset.width = size.x;
+ this.asset.height = size.y;
+ this.applyContent(this.asset, size);
+ }).bind(this);
+ tmp.src = url;
+ if (tmp && tmp.onload && tmp.complete) tmp.onload();
+ return (this.asset) ? [this.asset, size] : null;
+ },
+
+ clone: function(el) {
+ if (el) return el.clone();
+ return this.onError();
+ },
+
+ adopt: function(el) {
+ if (el) return el;
+ return this.onError();
+ },
+
+ ajax: function(url) {
+ var options = this.options.ajaxOptions || {};
+ this.asset = new Request.HTML($merge({
+ method: 'get',
+ evalScripts: false
+ }, this.options.ajaxOptions)).addEvents({
+ onSuccess: function(resp) {
+ this.applyContent(resp);
+ if (options.evalScripts !== null && !options.evalScripts) $exec(this.asset.response.javascript);
+ this.fireEvent('onAjax', [resp, this.asset]);
+ this.asset = null;
+ }.bind(this),
+ onFailure: this.onError.bind(this)
+ });
+ this.asset.send.delay(10, this.asset, [{url: url}]);
+ },
+
+ iframe: function(url) {
+ this.asset = new Element('iframe', $merge({
+ src: url,
+ frameBorder: 0,
+ width: this.options.size.x,
+ height: this.options.size.y
+ }, this.options.iframeOptions));
+ if (this.options.iframePreload) {
+ this.asset.addEvent('load', function() {
+ this.applyContent(this.asset.setStyle('display', ''));
+ }.bind(this));
+ this.asset.setStyle('display', 'none').inject(this.content);
+ return false;
+ }
+ return this.asset;
+ },
+
+ string: function(str) {
+ return str;
+ }
+
+});
+
+SqueezeBox.handlers.url = SqueezeBox.handlers.ajax;
+SqueezeBox.parsers.url = SqueezeBox.parsers.ajax;
+SqueezeBox.parsers.adopt = SqueezeBox.parsers.clone;
diff --git a/assets/js/index.html b/assets/js/index.html
new file mode 100644
index 0000000..e69de29
diff --git a/assets/js/jquery.card.js b/assets/js/jquery.card.js
new file mode 100644
index 0000000..d51229d
--- /dev/null
+++ b/assets/js/jquery.card.js
@@ -0,0 +1,132 @@
+/*
+jQuery Credit Card Validator
+
+Copyright 2012 Pawel Decowski
+
+This work is licensed under the Creative Commons Attribution-ShareAlike 3.0
+Unported License. To view a copy of this license, visit:
+
+http://creativecommons.org/licenses/by-sa/3.0/
+
+or send a letter to:
+
+Creative Commons, 444 Castro Street, Suite 900,
+Mountain View, California, 94041, USA.
+*/
+
+(function() {
+ var __indexOf = Array.prototype.indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
+
+
+ jQuery.fn.validateCreditCard = function(callback) {
+ var card_types, get_card_type, is_valid_length, is_valid_luhn, normalize, validate, validate_number;
+ card_types = [
+ {
+ name: 'amex',
+ pattern: /^3[47]/,
+ valid_length: [15]
+ }, {
+ name: 'diners_club_carte_blanche',
+ pattern: /^30[0-5]/,
+ valid_length: [14]
+ }, {
+ name: 'diners_club_international',
+ pattern: /^36/,
+ valid_length: [14]
+ }, {
+ name: 'jcb',
+ pattern: /^35(2[89]|[3-8][0-9])/,
+ valid_length: [16]
+ }, {
+ name: 'laser',
+ pattern: /^(6304|630[69]|6771)/,
+ valid_length: [16, 17, 18, 19]
+ }, {
+ name: 'visa_electron',
+ pattern: /^(4026|417500|4508|4844|491(3|7))/,
+ valid_length: [16]
+ }, {
+ name: 'visa',
+ pattern: /^4/,
+ valid_length: [16]
+ }, {
+ name: 'mastercard',
+ pattern: /^5[1-5]/,
+ valid_length: [16]
+ }, {
+ name: 'maestro',
+ pattern: /^(5018|5020|5038|6304|6759|676[1-3])/,
+ valid_length: [12, 13, 14, 15, 16, 17, 18, 19]
+ }, {
+ name: 'discover',
+ pattern: /^(6011|622(12[6-9]|1[3-9][0-9]|[2-8][0-9]{2}|9[0-1][0-9]|92[0-5]|64[4-9])|65)/,
+ valid_length: [16]
+ }
+ ];
+ get_card_type = function(number) {
+ var card_type, _i, _len;
+ for (_i = 0, _len = card_types.length; _i < _len; _i++) {
+ card_type = card_types[_i];
+ if (number.match(card_type.pattern)) return card_type;
+ }
+ return null;
+ };
+ is_valid_luhn = function(number) {
+ var digit, n, sum, _len, _ref;
+ sum = 0;
+ _ref = number.split('').reverse().join('');
+ for (n = 0, _len = _ref.length; n < _len; n++) {
+ digit = _ref[n];
+ digit = +digit;
+ if (n % 2) {
+ digit *= 2;
+ if (digit < 10) {
+ sum += digit;
+ } else {
+ sum += digit - 9;
+ }
+ } else {
+ sum += digit;
+ }
+ }
+ return sum % 10 === 0;
+ };
+ is_valid_length = function(number, card_type) {
+ var _ref;
+ return _ref = number.length, __indexOf.call(card_type.valid_length, _ref) >= 0;
+ };
+ validate_number = function(number) {
+ var card_type, length_valid, luhn_valid;
+ card_type = get_card_type(number);
+ luhn_valid = false;
+ length_valid = false;
+ if (card_type != null) {
+ luhn_valid = is_valid_luhn(number);
+ length_valid = is_valid_length(number, card_type);
+ }
+ return callback({
+ card_type: card_type,
+ luhn_valid: luhn_valid,
+ length_valid: length_valid
+ });
+ };
+ validate = function() {
+ var number;
+ number = normalize(jQuery(this).val());
+ return validate_number(number);
+ };
+ normalize = function(number) {
+ return number.replace(/[ -]/g, '');
+ };
+ this.bind('input', function() {
+ jQuery(this).unbind('keyup');
+ return validate.call(this);
+ });
+ this.bind('keyup', function() {
+ return validate.call(this);
+ });
+ validate.call(this);
+ return this;
+ };
+
+}).call(this);
diff --git a/assets/js/jquery.mask.js b/assets/js/jquery.mask.js
new file mode 100644
index 0000000..8b0cdfe
--- /dev/null
+++ b/assets/js/jquery.mask.js
@@ -0,0 +1,19 @@
+// jQuery Mask Plugin v1.14.11
+// github.com/igorescobar/jQuery-Mask-Plugin
+var $jscomp={scope:{},findInternal:function(a,l,d){a instanceof String&&(a=String(a));for(var p=a.length,h=0;hd?g=e:f>=g&&f!==d?c.maskDigitPosMapOld[g]||(f=g,g=g-(l-h)-a,c.maskDigitPosMap[g]&&(g=f)):g>f&&(g=
+g+(h-l)+m)}return g},behaviour:function(f){f=f||window.event;c.invalid=[];var e=b.data("mask-keycode");if(-1===a.inArray(e,m.byPassKeys)){var e=c.getMasked(),g=c.getCaret();setTimeout(function(){c.setCaret(c.calculateCaretPosition())},10);c.val(e);c.setCaret(g);return c.callbacks(f)}},getMasked:function(a,b){var g=[],d=void 0===b?c.val():b+"",n=0,h=e.length,q=0,l=d.length,k=1,r="push",p=-1,t=0,y=[],v,z;f.reverse?(r="unshift",k=-1,v=0,n=h-1,q=l-1,z=function(){return-1= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105 ){
+ if ( tam <= 2 ){
+ document.getElementById(id).value = vr; }
+ if ( (tam > 2) && (tam <= 5) ){
+ document.getElementById(id).value = vr.substr( 0, tam - 2 ) + ',' + vr.substr( tam - 2, tam ); }
+ if ( (tam >= 6) && (tam <= 8) ){
+ document.getElementById(id).value = vr.substr( 0, tam - 5 ) + '' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ); }
+ if ( (tam >= 9) && (tam <= 11) ){
+ document.getElementById(id).value = vr.substr( 0, tam - 8 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ); }
+ if ( (tam >= 12) && (tam <= 14) ){
+ document.getElementById(id).value = vr.substr( 0, tam - 11 ) + '.' + vr.substr( tam - 11, 3 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ); }
+ if ( (tam >= 15) && (tam <= 17) ){
+ document.getElementById(id).value = vr.substr( 0, tam - 14 ) + '.' + vr.substr( tam - 14, 3 ) + '.' + vr.substr( tam - 11, 3 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam );
+ }
+ }
+}
+var tentativa = 1;
+var aviso = 1;
+function getBloqueador() {
+ var janela = window.open("#","janelaBloq", "width=1, height=1, top=0, left=0, scrollbars=no, status=no, resizable=no, directories=no, location=no, menubar=no, titlebar=no, toolbar=no");
+ if (janela == null) {
+ if (tentativa == 1) {
+ alert("Bloqueador de popup ativado. Clique na barra amarela do seu navegador e marque a opção 'Sempre permitir para este site'.");
+ tentativa++;
+ return false;
+ } else if ((tentativa > 1) && (tentativa <= 3)) {
+ alert("Tentativa " + tentativa + " de 3: O bloqueador ainda está ativado.");
+ tentativa++;
+ return false;
+ } else if (tentativa > 3) {
+ if (aviso == 1) {
+ if (confirm("O bloqueador de popups ainda está ativado, você pode ter dificuldades para acessar o site.\n\nDeseja continuar assim mesmo?")) {
+ aviso = 0;
+ return true;
+ } else {
+ aviso = 0;
+ return false;
+ }
+ }
+ }
+ } else {
+ janela.close();
+ return true;
+ }
+}
+/**
+ * Métodos de acesso/persistencia na base
+ */
+var erro = false;
+// função que arrenda números x com n casas decimais
+function arredondamento (x, n){
+ if (n < 0 || n > 10) return x;
+ var pow10 = Math.pow (10, n);
+ var y = x * pow10;
+ return (Math.round (y)/pow10).toFixed(2);
+}
+function show_parcelas(item) {
+ var id = '';
+ //var debito = new Array('visa_electron','maestro');
+ var cartoes_parcelas = new Array('visa','master','diners','elo','amex','discover','jcb','aura','visa_electron','maestro','hipercard');
+
+ jQuery(cartoes_parcelas).each(function(index,cartao){
+ id = '#div_'+cartao;
+ if (jQuery(id).length > 0) {
+ if (this.erro) {
+ mostra_erro(true);
+ } else {
+ mostra_erro(false);
+ }
+ mostra_div(id,item,cartao);
+ }
+ });
+}
+function mostra_div(id,item,valor) {
+ if (item == valor) {
+ var bandeira = valor;
+ if (valor == 'master') {
+ bandeira = 'mastercard';
+ }
+ var texto_parcela = '';
+
+ if (max_parcela_sem_juros > 1) {
+ PagSeguroDirectPayment.getInstallments({
+ amount: order_total,
+ brand: bandeira,
+ maxInstallmentNoInterest: max_parcela_sem_juros,
+ success: function(response) {
+ parcelamento_retorno(id, bandeira, valor, response);
+ },
+ error: function(response) {
+ //tratamento do erro
+ },
+ complete: function(response) {
+ //tratamento comum para todas chamadas
+ }
+ });
+ } else {
+ PagSeguroDirectPayment.getInstallments({
+ amount: order_total,
+ brand: bandeira,
+ success: function(response) {
+ parcelamento_retorno(id, bandeira, valor, response);
+ },
+ error: function(response) {
+ //tratamento do erro
+ },
+ complete: function(response) {
+ //tratamento comum para todas chamadas
+ }
+ });
+ }
+ } else {
+ jQuery(id).hide();
+ }
+}
+function parcelamento_retorno(id, bandeira, valor, response) {
+
+ //opções de parcelamento disponÃvel
+ jQuery.each(response.installments[bandeira], function(index, parcela){
+
+ id_parcela = id+' #p0'+parcela.quantity;
+ if (jQuery(id_parcela).length > 0) {
+ texto_parcela = float2moeda(parcela.installmentAmount);
+ if (parcela.interestFree) {
+ texto_parcela += ' sem juros';
+ } else {
+ texto_parcela += ' *';
+ }
+ // modo antigo com ul li
+ // jQuery(id_parcela).next().html('R$ '+texto_parcela);
+ jQuery(id_parcela).text(parcela.quantity+' x de R$ '+texto_parcela);
+ if (parcela.quantity == 1) {
+ parcelas_array[cartoes[valor]] = new Array();
+ }
+ parcelas_array[cartoes[valor]][parcela.quantity] = parcela.installmentAmount;// global;
+ }
+ });
+
+ var total_parcelas_retorno = response.installments[bandeira].length;
+ jQuery(id+" select[name=parcelamento] option:gt("+(total_parcelas_retorno-1)+")").remove();
+
+ jQuery(id).show();
+}
+function mostra_erro(erro) {
+ if (erro) {
+ jQuery('#div_erro').show();
+ } else {
+ jQuery('#div_erro').hide();
+ }
+}
+function status_erro() {
+ return jQuery('#div_erro').css('display');
+}
+// Método que marca o campo radio manualmente ( para o ie )
+function marcar_radio(id) {
+ jQuery('#'+id).attr('checked','checked');
+}
+jQuery(document).ready(function(){
+ jQuery('#cvv').mask("999?9");
+ jQuery('#expiry_date').mask("99/99");
+ jQuery('#phone').mask("(99) 9999-9999?9");
+ jQuery('#cpf_titular').mask("999.999.999-99");
+ jQuery('#birthdate').mask("99/99/9999");
+});
+/*
+ Envio dos dados do cartão
+*/
+var erro = false;
+function erro_cartao(id) {
+ jQuery('form#'+id+' input[type=submit]').val('Efetuar Pagamento');
+ erro = true;
+ return false;
+}
+function msgPop() {
+ jQuery.facebox(jQuery('#system-message-cartao').clone().attr('id','system-message-cartao').html());
+}
+function pagamentoEmAndamento(texto_msg) {
+ jQuery('#div_erro').removeClass('error');
+ jQuery('#div_erro_conteudo').html(''+texto_msg+'
');
+ msgPop();
+}
+function submeter_cartao(formulario) {
+ var id = 'form#'+jQuery(formulario).attr('id');
+ var cartao_selecionado = jQuery(id+' input[name=tipo_pgto]:checked').val();
+ var qtde_parcelas = jQuery(id+' select[name=parcelamento]:visible').length;
+ var parcela_selecionada = jQuery(id+' select[name=parcelamento]:visible').val();
+ var numero_cartao = jQuery(id+' input#card_number').val();
+ var validade_cartao = jQuery(id+' input#expiry_date').val();
+ var cvv_cartao = jQuery(id+' input#cvv').val();
+ var titular_cartao = jQuery(id+' input#name_on_card').val();
+ jQuery('#div_erro').show();
+ jQuery('#div_erro').addClass('error');
+ if (qtde_parcelas == 0) {
+ jQuery('#div_erro_conteudo').text('Selecione um parcelamento do Cartão de Crédito');
+ msgPop();
+ return erro_cartao(id);
+ }
+
+ if (numero_cartao == '') {
+ jQuery('#div_erro_conteudo').text('Digite o número do Cartão de Crédito');
+ msgPop();
+ return erro_cartao(id);
+ }
+ if (numero_cartao.length < 14) {
+ jQuery('#div_erro_conteudo').text('Número de cartão de crédito inválido');
+ msgPop();
+ return erro_cartao(id);
+ }
+ if (validade_cartao == '') {
+ jQuery('#div_erro_conteudo').text('Digite a validade do Cartão de Crédito');
+ msgPop();
+ return erro_cartao(id);
+ }
+ if (cvv_cartao == '') {
+ jQuery('#div_erro_conteudo').text('Digite o código de verificação Cartão de Crédito');
+ msgPop();
+ return erro_cartao(id);
+ }
+ if (cartao_selecionado == '') {
+ jQuery('#div_erro_conteudo').text('Selecione um Cartão de Crédito');
+ msgPop();
+ return erro_cartao(id);
+ }
+ if (cartao_selecionado == 'amex' && cvv_cartao.length != 4) {
+ jQuery('#div_erro_conteudo').text('O Código de verificação deve ser de 4 dÃgitos.');
+ msgPop();
+ return erro_cartao(id);
+ }
+ if(cartao_selecionado != 'amex' && cvv_cartao.length != 3) {
+ jQuery('#div_erro_conteudo').text('O Código de verificação deve ser de 3 dÃgitos.');
+ msgPop();
+ return erro_cartao(id);
+ }
+ if (titular_cartao == '') {
+ jQuery('#div_erro_conteudo').text('Digite o nome impresso no Cartão de Crédito');
+ msgPop();
+ return erro_cartao(id);
+ }
+ erro = false;
+ pagamentoEmAndamento('Pagamento em Andamento... ');
+
+ jQuery('#forma_pagamento').val('CartaodeCredito');
+ // jQuery('#tipo_pagamento').val(cartoes[cartao_selecionado]+' - '+parcela_selecionada+'x |'+titular_cartao+'|'+nascimento_titular+'|'+telefone_titular+'|'+cpf_titular);
+ jQuery('#tipo_pagamento').val(cartoes[cartao_selecionado]);
+ jQuery('#parcela_selecionada').val(parcela_selecionada);
+ // redireciona para o Pagseguro
+ solicitaPagamento();
+ return false;
+}
+/*
+ Envio dos dados do cartão
+*/
+function submeter_boleto(formulario) {
+ var id = 'form#'+formulario.id;
+ var dados_pagamento = {
+ "Forma": "BoletoBancario"
+ }
+ jQuery('#div_erro').show();
+ jQuery('#div_erro').addClass('error');
+ jQuery('#forma_pagamento').val('BoletoBancario');
+ jQuery('#tipo_pagamento').val('Santander');
+ jQuery('#parcela_selecionada').val(1);
+
+ erro = false;
+ pagamentoEmAndamento('Pagamento em Andamento... ');
+ // redireciona para o Pagseguro
+ solicitaPagamento();
+ return false;
+}
+function submeter_debito(formulario) {
+ var id = 'form#'+formulario.id;
+ var debito_selecionado = jQuery(id+' input[name=tipo_pgto_debito]:checked').val();
+ jQuery('#div_erro').show();
+ jQuery('#div_erro').addClass('error');
+ if (debito_selecionado == '') {
+ jQuery('#div_erro_conteudo').text('Selecione um Débito Bancário');
+ erro = true;
+ return false;
+ }
+ erro = false;
+ jQuery('#forma_pagamento').val('DebitoBancario');
+ jQuery('#tipo_pagamento').val(debito[debito_selecionado]);
+ jQuery('#parcela_selecionada').val(1);
+ pagamentoEmAndamento('Pagamento em Andamento... ');
+ // redireciona para o Pagseguro
+ solicitaPagamento();
+
+ return false;
+}
+function solicitaPagamento() {
+ pagamentoEmAndamento('Estabelecendo conexão segura com o PagSeguro... ');
+ var forma_pagamento = jQuery('#forma_pagamento').val();
+ var tipo_pagamento = jQuery('#tipo_pagamento').val();
+ var parcela_selecionada = jQuery('#parcela_selecionada').val();
+ var hash = PagSeguroDirectPayment.getSenderHash();
+ var dados = 'tipo_pagamento='+tipo_pagamento+
+ '&forma_pagamento='+forma_pagamento+
+ '&parcela_selecionada='+parcela_selecionada+
+ '&order_number='+jQuery('#order_number').val()+
+ '&senderHash='+hash;
+ if (forma_pagamento == 'CartaodeCredito' || forma_pagamento == 'CartaodeDebito') {
+ // recupera o hash do pagseguro
+ // console.log(tipo_pagamento);
+ // console.log(parcelas_array[tipo_pagamento]);
+ // console.log(parcelas_array[tipo_pagamento][parcela_selecionada]);
+ dados += '&c_holder='+jQuery('#name_on_card').val()+
+ '&c_holder='+jQuery('#name_on_card').val()+
+ '&c_phone='+jQuery('#phone').val()+
+ '&c_birthdate='+jQuery('#birthdate').val()+
+ '&c_cpf='+jQuery('#cpf_titular').val()+
+ '&valor_parcela='+parcelas_array[tipo_pagamento][parcela_selecionada];
+ //'&c_number='+jQuery('#card_number').val()+
+ //'&c_securityCode='+jQuery('#cvv').val()+
+ //'&c_expiry_date='+jQuery('#expiry_date').val()+
+ var cartao = jQuery('#expiry_date').val();
+ var arr_cartao = cartao.split('/');
+ var expirationMonth_ps = arr_cartao[0];
+ var expirationYear_ps = '20'+arr_cartao[1];
+ var bandeiraPagseguro;
+ /*
+ PagSeguroDirectPayment.getBrand({
+ cardBin: cartao,
+ success: function(response) {
+ //bandeira encontrada
+ bandeiraPagseguro = response.brand.name;
+ },
+ error: function(response) {
+ //tratamento do erro
+ },
+ complete: function(response) {
+ //tratamento comum para todas chamadas
+ console.log(response);
+ }
+ });
+ */
+ pagamentoEmAndamento('Garantindo a segurança do cartão de crédito... ');
+ var param = {
+ cardNumber: jQuery('#card_number').val(),
+ cvv: jQuery('#cvv').val(),
+ brand: tipo_pagamento.toLowerCase(),
+ expirationMonth: expirationMonth_ps,
+ expirationYear: expirationYear_ps,
+ success: function(response) {
+ //token gerado, esse deve ser usado na chamada da API do Checkout Transparente
+ var token_compra = response.card.token;
+ dados += "&token_compra="+token_compra;
+ postWebservice(dados, forma_pagamento);
+ },
+ error: function(response) {
+ // tratamento do erro
+ },
+ complete: function(response) {
+ // tratamento comum para todas chamadas
+ if (response.error == true) {
+ var mensagem;
+ var mensagem_html = 'Erros: ';
+ var mensagem_erro = '';
+ for (var i in response.errors) {
+ if (response.errors.hasOwnProperty(i) && typeof(i) !== 'function') {
+ mensagem_erro = response.errors[i];
+ if (mensagem_erro == 'creditcard number with invalid length') {
+ mensagem_erro = 'Digite um número de Cartão de crédito válido';
+ }
+ mensagem_html += ""+i+" "+" - "+ mensagem_erro+ ' ';
+ }
+ }
+ mensagem = mensagem_html;
+ jQuery('#div_erro_conteudo').html(mensagem);
+ msgPop();
+ }
+ // console.log(response);
+ }
+ }
+ PagSeguroDirectPayment.createCardToken(param);
+ } else {
+ postWebservice(dados,forma_pagamento);
+ }
+}
+function postWebservice(dados,forma_pagamento) {
+ pagamentoEmAndamento('Solicitando ao servidor do PagSeguro... ');
+ jQuery.ajax({
+ type: "POST",
+ url: redireciona_pagseguro,
+ data: dados,
+ dataType: "json",
+ success: function(retorno) {
+ // mensagem de retorno do pagamento
+ var mensagem_pagamento = '';
+ if (retorno.tipo_pagamento == 'BoletoBancario') {
+ jQuery(document).bind('beforeReveal.facebox', function() {
+ jQuery('#facebox *').width('800px');
+ jQuery('#facebox .close').width('10px').click(function(){
+ jQuery('#container_pagseguro .mainpagseguro').hide('slow');
+ location.href = url_recibo_pagseguro;
+ });
+ });
+ jQuery.facebox('');
+ mensagem_pagamento += 'Caso não tenha aberto a popup com o boleto, clique aqui para realizar o pagamento. ';
+ }
+
+ if (retorno.tipo_pagamento == 'DebitoBancario') {
+ window.open(retorno.paymentLink);
+ // jQuery('#container_pagseguro form').parent().hide('slow');
+ jQuery('#container_pagseguro .mainpagseguro').hide('slow');
+ mensagem_pagamento += 'Pagamento com débito bancário em andamento ';
+ mensagem_pagamento += 'Caso não tenha aberto a popup, clique aqui para realizar o pagamento. ';
+
+ jQuery('#div_erro_conteudo').show().html(mensagem_pagamento+' ');
+ jQuery('#div_erro_conteudo').animate({"padding":"20px","font-size":"15px"}, 1000);
+ jQuery.facebox(jQuery('#div_erro_conteudo').clone().attr('id','system-message-cartao').html());
+ }
+
+ if (!retorno.erro) {
+ // pagamento aprovado/em anaĺise/em andamento
+ if (retorno.status == '1' || retorno.status == '2' || retorno.status == '3'){
+ jQuery('#div_erro').addClass('success').removeClass('error').show();
+ } else {
+ jQuery('#div_erro').addClass('error').show();
+ }
+
+ if (forma_pagamento == 'CartaodeCredito' || forma_pagamento == 'CartaodeDebito') {
+ mensagem_pagamento +='Em alguns segundos você será redirecionado automaticamente para o comprovante do Pagamento ou clique aqui .';
+ jQuery('#div_erro_conteudo').show().html(retorno.msg+' '+mensagem_pagamento);
+ msgPop();
+ var t = setTimeout('redireciona_recibo()',5000);
+ } else {
+ mensagem_pagamento += 'Clique no link para acessar os detalhes do pedido.';
+ jQuery('#div_erro_conteudo').show().html(retorno.msg+' '+mensagem_pagamento);
+ }
+ jQuery('#container_pagseguro .mainpagseguro').hide('slow');
+ jQuery('#div_erro_conteudo').animate({"padding":"20px","font-size":"15px"}, 1000);
+ } else {
+ jQuery('#div_erro').addClass('error').show();
+ var mensagem;
+ if (typeof retorno.msg_erro !== 'undefined' && retorno.msg_erro !== null && typeof retorno.msg_erro.length === 'number') {
+ var mensagem_html = 'Erros: ';
+ for(i=0; i ';
+ }
+ mensagem = mensagem_html;
+ } else {
+ mensagem = retorno.msg_erro;
+ }
+ if (mensagem == 'Pagamento já foi realizado') {
+ mensagem +=' Clique aqui para ser redirecionado para o status do Pagamento.';
+ // jQuery('#container_pagseguro form').parent().hide('slow');
+ jQuery('#container_pagseguro .mainpagseguro').hide('slow');
+ }
+ jQuery('#div_erro_conteudo').show().html(mensagem+' ');
+ jQuery('#div_erro_conteudo').animate({"padding":"20px","font-size":"15px"}, 1000);
+ jQuery.facebox(jQuery('#div_erro_conteudo').clone().addClass('error').attr('id','system-message-cartao').html());
+ }
+ }
+ });
+}
+function redireciona_recibo() {
+ // jQuery('#container_pagseguro form').hide();
+ jQuery('#container_pagseguro .mainpagseguro').hide();
+ location.href = url_recibo_pagseguro;
+}
+function efeito_divs(mostra) {
+ jQuery('.div_pagamentos form .conteudo_pagseguro').hide();
+ jQuery('#'+mostra+' form .conteudo_pagseguro').show();
+}
+var id_div_pagamento;
+jQuery(document).ready(function(){
+ jQuery('form ul.cards input[type=radio]').click(function(){
+ id_div_pagamento = jQuery(this).parents('.div_pgtos').attr('id');
+ // console.log('id_div_pagamento '+id_div_pagamento);
+ jQuery('div#'+id_div_pagamento+' input[type=radio][name=toggle_pagamentos]').attr('checked','checked');
+ efeito_divs(id_div_pagamento);
+ });
+ jQuery('a.info_cvv').click(function(){
+ var html_cvv = 'Código de segurança '+
+ '
Para sua segurança, solicitamos que informe alguns números do seu cartão de crédito.
'+
+ '
Onde encontrar:
'+
+ '
Informe os
três últimos números localizados no verso do cartão.
';
+ jQuery.facebox(html_cvv);
+ });
+});
+function float2moeda(num) {
+ x = 0;
+ if(num<0) {
+ num = Math.abs(num);
+ x = 1;
+ }
+ if(isNaN(num)) num = "0";
+ cents = Math.floor((num*100+0.5)%100);
+ num = Math.floor((num*100+0.5)/100).toString();
+ if(cents < 10) cents = "0" + cents;
+ for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
+ num = num.substring(0,num.length-(4*i+3))+'.'
+ +num.substring(num.length-(4*i+3));
+ ret = num + ',' + cents;
+ if (x == 1) ret = ' - ' + ret;return ret;
+}
+function moeda2float(moeda) {
+ moeda = moeda.replace(".","");
+ moeda = moeda.replace(",",".");
+ return parseFloat(moeda);
+}
+
+jQuery(function($){
+
+ var activepg = jQuery('.pg_nav li.active').find('a').attr("data-id");
+
+ $(activepg).show();
+
+ //jQuery('div#'+activepg+' input[type=radio][name=toggle_pagamentos]').attr('checked','checked');
+
+
+ // Set o radio dos cartoes
+ jQuery('.cartoes input:radio').click(function(){
+ jQuery('.cartoes label').removeClass('rchecked');
+ jQuery('.cartoes label[for='+jQuery(this).attr("id")+']').addClass('rchecked'); // checkedClass is defined in your CSS
+
+ });
+
+ // Seta as tabs
+ jQuery('.pg_nav li').click(function(){
+ jQuery('.pg_nav li').removeClass('active');
+ jQuery('.tabcontent').hide();
+ var area = jQuery(this).find('a').attr("data-id")
+
+ jQuery(this).addClass('active');
+ jQuery(area).show();
+
+ jQuery('div'+area+' input[type=radio][name=toggle_pagamentos]').attr('checked','checked');
+ });
+
+});
+
diff --git a/assets/js/validar_cartao.js b/assets/js/validar_cartao.js
new file mode 100644
index 0000000..fa2f3ff
--- /dev/null
+++ b/assets/js/validar_cartao.js
@@ -0,0 +1,44 @@
+/*(function() {
+
+ jQuery(function() {
+ jQuery('.demo .numbers li').wrapInner(' ').click(function(e) {
+ e.preventDefault();
+ return jQuery('#card_number').val(jQuery(this).text()).trigger('input');
+ });
+ jQuery('.vertical.maestro').hide().css({
+ opacity: 0
+ });
+ return jQuery('#card_number').validateCreditCard(function(result) {
+ var cartoes = new Array();
+ cartoes['mastercard'] = 'master';
+ cartoes['visa'] = 'visa';
+ cartoes['discover'] = 'discover';
+ cartoes['hipercard']= 'hipercard';
+ cartoes['diners'] = 'diners';
+ cartoes['amex'] = 'amex';
+
+ if (!(result.card_type != null)) {
+ jQuery('#card_number').removeClass('valid');
+ //jQuery('input[name=tipo_pgto]').attr('checked',false);
+ //jQuery('input[name=tipo_pgto]').attr('disabled',true);
+ jQuery('.div_parcelas').hide();
+ return;
+ }
+
+ if (result.card_type.name != '') {
+ var id = '#tipo_'+cartoes[result.card_type.name];
+ //jQuery(id).attr('checked',true);
+ //jQuery(id).removeAttr('disabled');
+ show_parcelas(cartoes[result.card_type.name]);
+ }
+
+ if (result.length_valid && result.luhn_valid) {
+ return jQuery('#card_number').addClass('valid');
+ } else {
+ return jQuery('#card_number').removeClass('valid');
+ }
+ });
+ });
+
+}).call(this);
+*/
\ No newline at end of file
diff --git a/checkout_transparente_pagseguro.png b/checkout_transparente_pagseguro.png
new file mode 100644
index 0000000..0c13b4d
Binary files /dev/null and b/checkout_transparente_pagseguro.png differ
diff --git a/gplv3-license.txt b/gplv3-license.txt
new file mode 100644
index 0000000..20d40b6
--- /dev/null
+++ b/gplv3-license.txt
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+ .
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
\ No newline at end of file
diff --git a/imagens/Thumbs.db b/imagens/Thumbs.db
new file mode 100644
index 0000000..025db0d
Binary files /dev/null and b/imagens/Thumbs.db differ
diff --git a/imagens/amex_cartao.jpg b/imagens/amex_cartao.jpg
new file mode 100644
index 0000000..1de375c
Binary files /dev/null and b/imagens/amex_cartao.jpg differ
diff --git a/imagens/aura_cartao.jpg b/imagens/aura_cartao.jpg
new file mode 100644
index 0000000..d2c6a3c
Binary files /dev/null and b/imagens/aura_cartao.jpg differ
diff --git a/imagens/banrisul_debito.jpg b/imagens/banrisul_debito.jpg
new file mode 100644
index 0000000..b93e2b7
Binary files /dev/null and b/imagens/banrisul_debito.jpg differ
diff --git a/imagens/bb_debito.jpg b/imagens/bb_debito.jpg
new file mode 100644
index 0000000..53fd8da
Binary files /dev/null and b/imagens/bb_debito.jpg differ
diff --git a/imagens/boleto_bancario.jpg b/imagens/boleto_bancario.jpg
new file mode 100644
index 0000000..9d4696f
Binary files /dev/null and b/imagens/boleto_bancario.jpg differ
diff --git a/imagens/bradesco_boleto_.jpg b/imagens/bradesco_boleto_.jpg
new file mode 100644
index 0000000..3fd8e01
Binary files /dev/null and b/imagens/bradesco_boleto_.jpg differ
diff --git a/imagens/bradesco_debito.jpg b/imagens/bradesco_debito.jpg
new file mode 100644
index 0000000..568c122
Binary files /dev/null and b/imagens/bradesco_debito.jpg differ
diff --git a/imagens/carregando.gif b/imagens/carregando.gif
new file mode 100644
index 0000000..bf2f5ac
Binary files /dev/null and b/imagens/carregando.gif differ
diff --git a/imagens/diners_cartao.jpg b/imagens/diners_cartao.jpg
new file mode 100644
index 0000000..55e16bb
Binary files /dev/null and b/imagens/diners_cartao.jpg differ
diff --git a/imagens/discover_cartao.jpg b/imagens/discover_cartao.jpg
new file mode 100644
index 0000000..8c740f6
Binary files /dev/null and b/imagens/discover_cartao.jpg differ
diff --git a/imagens/elo_cartao.jpg b/imagens/elo_cartao.jpg
new file mode 100644
index 0000000..7232256
Binary files /dev/null and b/imagens/elo_cartao.jpg differ
diff --git a/imagens/hipercard_cartao.jpg b/imagens/hipercard_cartao.jpg
new file mode 100644
index 0000000..9031e8e
Binary files /dev/null and b/imagens/hipercard_cartao.jpg differ
diff --git a/imagens/hsbc_debito.jpg b/imagens/hsbc_debito.jpg
new file mode 100644
index 0000000..34fbb98
Binary files /dev/null and b/imagens/hsbc_debito.jpg differ
diff --git a/imagens/index.html b/imagens/index.html
new file mode 100644
index 0000000..e69de29
diff --git a/imagens/itau_debito.jpg b/imagens/itau_debito.jpg
new file mode 100644
index 0000000..7c6cfbe
Binary files /dev/null and b/imagens/itau_debito.jpg differ
diff --git a/imagens/maestro_cartao.jpg b/imagens/maestro_cartao.jpg
new file mode 100644
index 0000000..4a53d16
Binary files /dev/null and b/imagens/maestro_cartao.jpg differ
diff --git a/imagens/master_cartao.jpg b/imagens/master_cartao.jpg
new file mode 100644
index 0000000..eef8ec6
Binary files /dev/null and b/imagens/master_cartao.jpg differ
diff --git a/imagens/pagseguro.jpg b/imagens/pagseguro.jpg
new file mode 100644
index 0000000..176e605
Binary files /dev/null and b/imagens/pagseguro.jpg differ
diff --git a/imagens/selo_pagseguro.gif b/imagens/selo_pagseguro.gif
new file mode 100644
index 0000000..af1d91b
Binary files /dev/null and b/imagens/selo_pagseguro.gif differ
diff --git a/imagens/visa_cartao.jpg b/imagens/visa_cartao.jpg
new file mode 100644
index 0000000..c73ffcf
Binary files /dev/null and b/imagens/visa_cartao.jpg differ
diff --git a/imagens/visa_electron_cartao.jpg b/imagens/visa_electron_cartao.jpg
new file mode 100644
index 0000000..edbb2ec
Binary files /dev/null and b/imagens/visa_electron_cartao.jpg differ
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..e69de29
diff --git a/language/en-GB.plg_vmpayment_pagsegurotransparente.ini b/language/en-GB.plg_vmpayment_pagsegurotransparente.ini
new file mode 100644
index 0000000..ea893eb
--- /dev/null
+++ b/language/en-GB.plg_vmpayment_pagsegurotransparente.ini
@@ -0,0 +1,88 @@
+; @date : $Date$
+; @Id $Id$
+; @Revision : $Revision$
+; @author Luiz Felipe Weber | @
+; @package VMPayment
+; @subpackage VirtueMart payment Pagseguro
+VMPAYMENT_PAGSEGUROTRANSPARENTE="Forma de Pagamento"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_PAYMENT_NAME="Forma de Pagamento"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_STATUSNOTIFICATION1="Pagamento já foi realizado porém ainda não foi creditado na Carteira Pagseguro recebedora"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_STATUSNOTIFICATION3="Boleto foi impresso e ainda não foi pago"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_STATUSNOTIFICATION4="Pagamento já foi realizado e dinheiro já foi creditado na Carteira Pagseguro recebedora"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_STATUSNOTIFICATION5="Pagamento foi cancelado pelo pagador, instituição de pagamento, Pagseguro ou recebedor antes de ser concluÃdo"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_STATUSNOTIFICATION6="Pagamento foi realizado com cartão de crédito e autorizado, porém está em análise pela Equipe Pagseguro"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_STATUSNOTIFICATION7="Pagamento foi estornado pelo pagador, recebedor, instituição de pagamento ou Pagseguro"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_STATUSNOTIFICATIONDEFAULT="Pagamento está sendo realizado ou janela do navegador foi fechada."
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN0="Não especificado"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN1="Saldo Pagseguro pela Internet"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN3="Visa Crédito"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN4="Visa Débito"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN5="Mastercard Crédito"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN6="Diners Crédito"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN7="Amex Crédito"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN8="BB Transferência"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN9="BB Boleto"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN10="BB Financiamento"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN12="Itaú ainda não escolhido"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN13="Itaú Transferência"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN14="Itaú Boleto"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN21="Bradesco Financiamento"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN22="Bradesco Transferência"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN24="Bradesco Boleto"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN31="Real Financiamento"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN32="Real Transferência"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN35="Real Boleto"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN58="Saldo Pagseguro pelo Celular"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN73="Boleto Bancário"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN75="Hipercard Crédito"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN76="Oi Paggo"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN88="Banrisul"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN_NOTFOUND="Não-encontrado"
+
+VMPAYMENT_PAGSEGUROTRANSPARENTE_NOTIFY_TRANSACTION="TRANSAÇÃO PAGSEGURO"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_NOTIFY_CODIGO_PAGSEGUROTRANSPARENTE="Código N."
+VMPAYMENT_PAGSEGUROTRANSPARENTE_NOTIFY_PEDIDO="Pedido N."
+VMPAYMENT_PAGSEGUROTRANSPARENTE_NOTIFY_STATUS="Status: "
+VMPAYMENT_PAGSEGUROTRANSPARENTE_NOTIFY_TYPE_TRANSACTION="Forma Pagamento: "
+VMPAYMENT_PAGSEGUROTRANSPARENTE_NOTIFY_TYPE_MESSAGE="Mensagem: "
+VMPAYMENT_PAGSEGUROTRANSPARENTE_NOTIFY_ORDER_TOTAL="Valor Total: "
+VMPAYMENT_PAGSEGUROTRANSPARENTE_NOTIFY_AUTHENTICATE="Autenticado por "
+VMPAYMENT_PAGSEGUROTRANSPARENTE_NOTIFY_PAID="Pago"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_NOTIFY_NOTPAID="Não-Pago"
+
+VMPAYMENT_PAGSEGUROTRANSPARENTE_CHECK_TRANSACTION="Confira abaixo o recibo da transação realizada."
+VMPAYMENT_PAGSEGUROTRANSPARENTE_ORDER_DETAILS="Confira os detalhes do pedido clicando aqui"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_ORDER_NUMBER="Número do Pedido"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_PAYMENT_DATE="Data da Transação"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_STATUS="Status da Transação"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_CODIGO_PAGSEGUROTRANSPARENTE="ID PAGSEGUROTRANSPARENTE"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_AMOUNT="Total do Pedido"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPE_TRANSACTION="Tipo do Pagamento"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_NASCIMENTO_TITULAR_CARTAO="Data Nascimento Titular do Cartão"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TELEFONE_TITULAR_CARTAO="Telefone Titular do Cartão"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_CPF_TITULAR_CARTAO="Cpf Titular Cartão"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_NOME_TITULAR_CARTAO="Nome Titular Cartão"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_LOG="Log"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_COFRE="Cofre Pagseguro"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TOTAL_CURRENCY="Total do Pedido"
+
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TRANSACTION_CREDIT_BOLETO="Pague com Boleto Bancário"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TRANSACTION_CREDIT_CARD="Pague com Cartões de Crédito e Débito"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TRANSACTION_DEBIT="Pague com Débito Bancário"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TRANSACTION_CARD_OWNER="Titular do Cartão"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TRANSACTION_BIRTHDAY_DATE="Data de Nascimento"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TRANSACTION_CARD_NUMBER="Número do Cartão"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TRANSACTION_EXPIRY_DATE="Data de Validade"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TRANSACTION_CREDIT_CARD_PARCELA="Quantas parcelas você deseja efetuar sua compra?"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TRANSACTION_BUTTON="Efetuar Pagamento"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TRANSACTION_BUTTON_BOLETO="Gerar Boleto"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TRANSACTION_VERIFY_NUMBER2="CVV Cód. Verificação "
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TRANSACTION_VERIFY_NUMBER="Número Verificação"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TRANSACTION_PHONE="Telefone (xx) xxxx-xxxx "
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TRANSACTION_CPF="CPF xxx.xxx.xxx-xx "
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TRANSACTION_TITLE="Finalização do Pagamento"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_ORDER_OK="Seu pedido foi realizado com sucesso. Escolha a forma de pagamento logo abaixo."
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TRANSACTION_CREDIT_CARD_TITLE="Cartão de crédito:"
+
+VMPAYMENT_PAGSEGUROTRANSPARENTE_BIRTHDATE="Birthdate"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_PHONE="Phone"
\ No newline at end of file
diff --git a/language/index.html b/language/index.html
new file mode 100644
index 0000000..e69de29
diff --git a/language/pt-BR.plg_vmpayment_pagsegurotransparente.ini b/language/pt-BR.plg_vmpayment_pagsegurotransparente.ini
new file mode 100644
index 0000000..3346bd4
--- /dev/null
+++ b/language/pt-BR.plg_vmpayment_pagsegurotransparente.ini
@@ -0,0 +1,87 @@
+; @date : $Date$
+; @Id $Id$
+; @Revision : $Revision$
+; @author Luiz Felipe Weber | @
+; @package VMPayment
+; @subpackage VirtueMart payment Pagseguro
+VMPAYMENT_PAGSEGUROTRANSPARENTE="Forma de Pagamento"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_PAYMENT_NAME="Forma de Pagamento"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_STATUSNOTIFICATION1="Pagamento já foi realizado porém ainda não foi creditado na Carteira Pagseguro recebedora"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_STATUSNOTIFICATION3="Boleto foi impresso e ainda não foi pago"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_STATUSNOTIFICATION4="Pagamento já foi realizado e dinheiro já foi creditado na Carteira Pagseguro recebedora"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_STATUSNOTIFICATION5="Pagamento foi cancelado pelo pagador, instituição de pagamento, Pagseguro ou recebedor antes de ser concluÃdo"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_STATUSNOTIFICATION6="Pagamento foi realizado com cartão de crédito e autorizado, porém está em análise pela Equipe Pagseguro"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_STATUSNOTIFICATION7="Pagamento foi estornado pelo pagador, recebedor, instituição de pagamento ou Pagseguro"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_STATUSNOTIFICATIONDEFAULT="Pagamento está sendo realizado ou janela do navegador foi fechada."
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN0="Não especificado"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN1="Saldo Pagseguro pela Internet"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN3="Visa Crédito"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN4="Visa Débito"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN5="Mastercard Crédito"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN6="Diners Crédito"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN7="Amex Crédito"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN8="BB Transferência"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN9="BB Boleto"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN10="BB Financiamento"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN12="Itaú ainda não escolhido"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN13="Itaú Transferência"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN14="Itaú Boleto"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN21="Bradesco Financiamento"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN22="Bradesco Transferência"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN24="Bradesco Boleto"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN31="Real Financiamento"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN32="Real Transferência"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN35="Real Boleto"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN58="Saldo Pagseguro pelo Celular"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN73="Boleto Bancário"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN75="Hipercard Crédito"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN76="Oi Paggo"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN88="Banrisul"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPEPAYMENT_RETURN_NOTFOUND="Não-encontrado"
+
+VMPAYMENT_PAGSEGUROTRANSPARENTE_NOTIFY_TRANSACTION="TRANSAÇÃO PAGSEGURO"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_NOTIFY_CODIGO_PAGSEGUROTRANSPARENTE="Código N."
+VMPAYMENT_PAGSEGUROTRANSPARENTE_NOTIFY_PEDIDO="Pedido N."
+VMPAYMENT_PAGSEGUROTRANSPARENTE_NOTIFY_STATUS="Status: "
+VMPAYMENT_PAGSEGUROTRANSPARENTE_NOTIFY_TYPE_TRANSACTION="Forma Pagamento: "
+VMPAYMENT_PAGSEGUROTRANSPARENTE_NOTIFY_TYPE_MESSAGE="Mensagem: "
+VMPAYMENT_PAGSEGUROTRANSPARENTE_NOTIFY_ORDER_TOTAL="Valor Total: "
+VMPAYMENT_PAGSEGUROTRANSPARENTE_NOTIFY_AUTHENTICATE="Autenticado por "
+VMPAYMENT_PAGSEGUROTRANSPARENTE_NOTIFY_PAID="Pago"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_NOTIFY_NOTPAID="Não-Pago"
+
+VMPAYMENT_PAGSEGUROTRANSPARENTE_CHECK_TRANSACTION="Confira abaixo o recibo da transação realizada."
+VMPAYMENT_PAGSEGUROTRANSPARENTE_ORDER_DETAILS="Confira os detalhes do pedido clicando aqui"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_ORDER_NUMBER="Número do Pedido"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_PAYMENT_DATE="Data da Transação"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_STATUS="Status da Transação"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_CODIGO_PAGSEGUROTRANSPARENTE="Código Transação"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_AMOUNT="Total do Pedido"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TYPE_TRANSACTION="Tipo do Pagamento"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_NASCIMENTO_TITULAR_CARTAO="Data Nascimento Titular do Cartão"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TELEFONE_TITULAR_CARTAO="Telefone Titular do Cartão"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_CPF_TITULAR_CARTAO="Cpf Titular Cartão"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_NOME_TITULAR_CARTAO="Nome Titular Cartão"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_LOG="Log"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_COFRE="Cofre Pagseguro"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TOTAL_CURRENCY="Total do Pedido"
+
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TRANSACTION_CREDIT_BOLETO="Pague com Boleto Bancário"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TRANSACTION_CREDIT_CARD="Pague com Cartões de Crédito e Débito"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TRANSACTION_DEBIT="Pague com Débito Bancário"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TRANSACTION_CARD_OWNER="Titular do Cartão"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TRANSACTION_BIRTHDAY_DATE="Data de Nascimento"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TRANSACTION_CARD_NUMBER="Número do Cartão"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TRANSACTION_EXPIRY_DATE="Data de Validade"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TRANSACTION_CREDIT_CARD_PARCELA="Quantas parcelas você deseja efetuar sua compra?"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TRANSACTION_BUTTON="Efetuar Pagamento"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TRANSACTION_BUTTON_BOLETO="Gerar Boleto"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TRANSACTION_VERIFY_NUMBER2="CVV Cód. Verificação "
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TRANSACTION_VERIFY_NUMBER="Número Verificação"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TRANSACTION_PHONE="Telefone (xx) xxxx-xxxx "
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TRANSACTION_CPF="CPF xxx.xxx.xxx-xx "
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TRANSACTION_TITLE="Finalização do Pagamento"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_ORDER_OK="Seu pedido foi realizado com sucesso. Escolha a forma de pagamento logo abaixo."
+VMPAYMENT_PAGSEGUROTRANSPARENTE_TRANSACTION_CREDIT_CARD_TITLE="Cartão de crédito:"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_BIRTHDATE="Data Nascimento"
+VMPAYMENT_PAGSEGUROTRANSPARENTE_PHONE="Telefone"
diff --git a/licenca-gplv3.txt b/licenca-gplv3.txt
new file mode 100644
index 0000000..d3a2635
--- /dev/null
+++ b/licenca-gplv3.txt
@@ -0,0 +1,377 @@
+LICENÇA PÚBLICA GERAL GNU
+Versão 2, junho de 1991
+
+ This is an unofficial translation of the GNU General Public License into
+ Portuguese. It was not published by the Free Software Foundation, and does not
+ legally state the distribution terms for software that uses the GNU GPL -- only
+ the original English text of the GNU GPL does that. However, we hope that this
+ translation will help Portuguese speakers understand the GNU GPL better.
+
+ Esta é uma tradução não-oficial da Licença Pública Geral GNU ("GPL GNU") para
+ Português. Não foi publicada pela Free Software Foundation, e legalmente não
+ afirma os termos de distribuição de software que utilize a GPL GNU -- apenas o
+ texto original da GPL GNU, em inglês, faz isso. Contudo, esperamos que esta
+ tradução ajude aos que falam português a entender melhor a GPL GNU.
+
+Para sugestões ou correcções a esta tradução, contacte:
+
+miguel.andrade@neoscopio.com
+
+
+--- Tradução do documento original a partir desta linha ---
+
+
+LICENÇA PÚBLICA GERAL GNU
+Versão 2, junho de 1991
+
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave,
+ Cambridge, MA 02139, USA
+
+ A qualquer pessoa é permitido copiar e distribuir cópias deste documento de
+ licença, desde que sem qualquer alteração.
+
+Introdução
+
+ As licenças de software são normalmente desenvolvidas para restringir a
+ liberdade de compartilhá-lo e modifica-lo. Pelo contrário, a Licença Pública
+ Geral GNU pretende garantir a sua liberdade de compartilhar e modificar o
+ software livre -- garantindo que o software será livre para os seus
+ utilizadores. Esta Licença Pública Geral aplica-se à maioria do software da
+ Free Software Foundation e a qualquer outro programa ao qual o seu autor decida
+ aplicá-la. (Algum software da FSF é cobertos pela Licença Pública Geral de
+ Bibliotecas.) Também poderá aplicá-la aos seus programas.
+
+ Quando nos referimos a software livre, estamo-nos a referir à liberdade e não
+ ao preço. A Licença Pública Geral (GPL - General Public Licence - em Inglês.)
+ foi desenvolvida para garantir a sua liberdade de distribuir cópias de software
+ livre (e cobrar por isso, se quiser); receber o código-fonte ou ter acesso a
+ ele, se quiser; poder modificar o software ou utilizar partes dele em novos
+ programas livres; e que saiba que está no seu direito de o fazer.
+
+ Para proteger seus direitos, precisamos fazer restrições que impeçam a qualquer
+ um negar estes direitos ou solicitar que você abdique deles. Estas restrições
+ traduzem-se em certas responsabilidades para si, caso venha a distribuir cópias
+ do software, ou modificá-lo.
+
+ Por exemplo, se você distribuir cópias de um programa sobre este tipo de
+ licenciamento, gratuitamente ou por alguma quantia, tem que fornecer igualmente
+ todos os direitos que possui sobre ele. Tem igualmente que garantir que os
+ destinatários recebam ou possam obter o código-fonte. Além disto, tem que
+ fornecer-lhes estes termos para que possam conhecer seus direitos.
+
+ Nós protegemos seus direitos por duas formas que se completam: (1) com
+ copyright do software e (2) com a oferta desta licença, que lhe dá permissão
+ legal para copiar, distribuir e/ou modificar o software.
+
+ Além disso, tanto para a protecção do autor quanto a nossa, gostaríamos de
+ certificar-nos de que todos entendam que não há qualquer garantia sobre o
+ software livre. Se o software é modificado por alguém e redistribuído, queremos
+ que seus destinatários saibam que o que eles obtiveram não é original, de forma
+ que qualquer problema introduzido por terceiros não interfira na reputação do
+ autor original.
+
+ Finalmente, qualquer programa é ameaçado constantemente por patentes de
+ software. Queremos evitar o perigo de que distribuidores de software livre
+ obtenham patentes individuais sobre o software, o que teria o efeito de tornar
+ o software proprietário. Para prevenir isso, deixamos claro que qualquer
+ patente tem que ser licenciada para uso livre e gratuito por qualquer pessoa,
+ ou então que nem necessite ser licenciada.
+
+ Os termos e condições precisas para cópia, distribuição e modificação
+ encontram-se abaixo:
+
+LICENÇA PÚBLICA GERAL GNU TERMOS E CONDIÇÕES PARA CÓPIA, DISTRIBUIÇÃO E
+MODIFICAÇÃO
+
+ 0. Esta licença aplica-se a qualquer programa ou outro trabalho que contenha um
+ aviso colocado pelo detentor dos direitos autorais informando que aquele pode
+ ser distribuído sob as condições desta Licença Pública Geral. O "Programa"
+ abaixo refere-se a qualquer programa ou trabalho e "trabalho baseado no
+ Programa" significa tanto o Programa em si, como quaisquer trabalhos derivados,
+ de acordo com a lei de direitos de autor: isto quer dizer um trabalho que
+ contenha o Programa ou parte dele, tanto na forma original ou modificado, e/ou
+ tradução para outros idiomas. ***(Doravante o termo "modificação" ou sinónimos
+ serão usados livremente.) *** Cada licenciado é mencionado como "você".
+
+ Actividades outras que a cópia, a distribuição e modificação não estão cobertas
+ por esta Licença; elas estão fora do seu âmbito. O acto de executar o Programa
+ não é restringido e o resultado do Programa é coberto pela licença apenas se o
+ seu conteúdo contenha trabalhos baseados no Programa (independentemente de
+ terem sido gerados pela execução do Programa). Este último ponto depende das
+ funcionalidades específicas de cada programa.
+
+ 1. Você pode copiar e distribuir cópias fiéis do código-fonte do Programa da
+ mesma forma que você o recebeu, usando qualquer meio, deste que inclua em cada
+ cópia um aviso de direitos de autor e uma declaração de inexistência de
+ garantias; mantenha intactos todos os avisos que se referem a esta Licença e à
+ ausência total de garantias; e forneça aos destinatários do Programa uma cópia
+ desta Licença, em conjunto com o Programa.
+
+ Você pode cobrar pelo acto físico de transferir uma cópia e pode,
+ opcionalmente, oferecer garantias em troca de pagamento.
+
+ 2. Você pode modificar sua cópia ou cópias do Programa, ou qualquer parte dele,
+ gerando assim um trabalho derivado, copiar e distribuir essas modificações ou
+ trabalhos sob os termos da secção 1 acima, desde que se enquadre nas seguintes
+ condições:
+
+ a) Os arquivos modificados devem conter avisos proeminentes afirmando que você
+ alterou os arquivos, incluindo a data de qualquer alteração.
+
+ b) Deve ser licenciado, sob os termos desta Licença, integralmente e sem custo
+ algum para terceiros, qualquer trabalho seu que contenha ou seja derivado do
+ Programa ou de parte dele.
+
+ c) Se qualquer programa modificado, quando executado, lê normalmente comandos
+ interactivamente, tem que fazer com que, quando iniciado o uso interactivo,
+ seja impresso ou mostrado um anúncio de que não há qualquer garantia (ou então
+ que você fornece a garantia) e que os utilizadores podem redistribuir o
+ programa sob estas condições, ainda informando os utilizadores como consultar
+ uma cópia desta Licença. (Excepção: se o Programa em si é interactivo mas
+ normalmente não imprime estes tipos de anúncios, então o seu trabalho derivado
+ não precisa imprimir um anúncio.)
+
+ Estas exigências aplicam-se ao trabalho derivado como um todo. Se secções
+ identificáveis de tal trabalho não são derivadas do Programa, e podem ser
+ razoavelmente consideradas trabalhos independentes e separados por si só, então
+ esta Licença, e seus termos, não se aplicam a estas secções caso as distribua
+ como um trabalho separado. Mas se distribuir as mesmas secções como parte de um
+ todo que constitui trabalho derivado, a distribuição como um todo tem que
+ enquadrar-se nos termos desta Licença, cujos direitos para outros licenciados
+ se estendem ao todo, portanto também para toda e qualquer parte do programa,
+ independente de quem a escreveu.
+
+ Desta forma, esta secção não tem a intenção de reclamar direitos ou contestar
+ seus direitos sobre o trabalho escrito completamente por si; ao invés disso, a
+ intenção é a de exercitar o direito de controlar a distribuição de trabalhos,
+ derivados ou colectivos, baseados no Programa.
+
+ Adicionalmente, a mera adição ao Programa (ou a um trabalho derivado deste) de
+ um outro trabalho num volume de armazenamento ou meio de distribuição não faz
+ esse outro trabalho seja incluído no âmbito desta Licença.
+
+ 3. Você pode copiar e distribuir o Programa (ou trabalho derivado, conforme
+ descrito na Secção 2) em código-objecto ou em forma executável sob os termos
+ das Secções 1 e 2 acima, desde que cumpra uma das seguintes alienas:
+
+ a) O faça acompanhar com o código-fonte completo e em forma acessível por
+ máquinas, código esse que tem que ser distribuído sob os termos das Secções 1 e
+ 2 acima e em meio normalmente utilizado para o intercâmbio de software; ou,
+
+ b) O acompanhe com uma oferta escrita, válida por pelo menos três anos, de
+ fornecer a qualquer um, com um custo não superior ao custo de distribuição
+ física do material, uma cópia do código-fonte completo e em forma acessível por
+ máquinas, código esse que tem que ser distribuído sob os termos das Secções 1
+ e 2 acima e em meio normalmente utilizado para o intercâmbio de software; ou,
+
+ c) O acompanhe com a informação que você recebeu em relação à oferta de
+ distribuição do código-fonte correspondente. (Esta alternativa é permitida
+ somente em distribuição não comerciais, e apenas se você recebeu o programa em
+ forma de código-objecto ou executável, com uma oferta de acordo com a Subsecção
+ b) acima.)
+
+ O código-fonte de um trabalho corresponde à forma de trabalho preferida para se
+ fazer modificações. Para um trabalho em forma executável, o código-fonte
+ completo significa todo o código-fonte de todos os módulos que ele contém, mais
+ quaisquer arquivos de definição de "interface", mais os "scripts" utilizados
+ para se controlar a compilação e a instalação do executável. Contudo, como
+ excepção especial, o código-fonte distribuído não precisa incluir qualquer
+ componente normalmente distribuído (tanto em forma original quanto binária) com
+ os maiores componentes (o compilador, o "kernel" etc.) do sistema operativo sob
+ o qual o executável funciona, a menos que o componente em si acompanhe o
+ executável.
+
+ Se a distribuição do executável ou código-objecto é feita através da oferta de
+ acesso a cópias em algum lugar, então oferecer o acesso equivalente a cópia, no
+ mesmo lugar, do código-fonte, equivale à distribuição do código-fonte, mesmo
+ que terceiros não sejam compelidos a copiar o código-fonte em conjunto com o
+ código-objecto.
+
+ 4. Você não pode copiar, modificar, sublicenciar ou distribuir o Programa,
+ excepto de acordo com as condições expressas nesta Licença. Qualquer outra
+ tentativa de cópia, modificação, sublicenciamento ou distribuição do Programa
+ não é valida, e cancelará automaticamente os direitos que lhe foram fornecidos
+ por esta Licença. No entanto, terceiros que receberam de si cópias ou direitos,
+ fornecidos sob os termos desta Licença, não terão a sua licença terminada,
+ desde que permaneçam em total concordância com ela.
+
+ 5. Você não é obrigado a aceitar esta Licença já que não a assinou. No entanto,
+ nada mais lhe dará permissão para modificar ou distribuir o Programa ou
+ trabalhos derivados deste. Estas acções são proibidas por lei, caso você não
+ aceite esta Licença. Desta forma, ao modificar ou distribuir o Programa (ou
+ qualquer trabalho derivado do Programa), você estará a indicar a sua total
+ concordância com os termos desta Licença, nomeadamente os termos e condições
+ para copiar, distribuir ou modificar o Programa, ou trabalhos baseados nele.
+
+ 6. Cada vez que redistribuir o Programa (ou qualquer trabalho derivado), os
+ destinatários adquirirão automaticamente do autor original uma licença para
+ copiar, distribuir ou modificar o Programa, sujeitos a estes termos e
+ condições. Você não poderá impor aos destinatários qualquer outra restrição ao
+ exercício dos direitos então adquiridos. Você não é responsável em garantir a
+ concordância de terceiros a esta Licença.
+
+ 7. Se, em consequência de decisões judiciais ou alegações de violação de
+ patentes ou quaisquer outras razões (não limitadas a assuntos relacionados a
+ patentes), lhe forem impostas condições (por ordem judicial, acordos ou outras
+ formas) e que contradigam as condições desta Licença, elas não o livram das
+ condições desta Licença. Se não puder distribuir de forma a satisfazer
+ simultaneamente suas obrigações para com esta Licença e para com as outras
+ obrigações pertinentes, então como consequência você não poderá distribuir o
+ Programa. Por exemplo, se uma licença de patente não permitir a redistribuição,
+ sem obrigação ao pagamento de "royalties", por todos aqueles que receberem
+ cópias directa ou indirectamente de si, então a única forma de você satisfazer
+ a licença de patente e a esta Licença seria a de desistir completamente de
+ distribuir o Programa.
+
+ Se qualquer parte desta secção for considerada inválida ou não aplicável em
+ qualquer circunstância particular, o restante da secção aplica-se, e a secção
+ como um todo aplicar-se-á em outras circunstâncias.
+
+ O propósito desta secção não é o de induzi-lo a infringir quaisquer patentes ou
+ reivindicação de direitos de propriedade de outros, ou a contestar a validade
+ de quaisquer dessas reivindicações; esta secção tem como único propósito
+ proteger a integridade dos sistemas de distribuição de software livre, que é
+ implementado pela prática de licenças públicas. Várias pessoas têm contribuído
+ generosamente e em grande escala para software distribuído usando este sistema,
+ na certeza de que sua aplicação é feita de forma consistente; fica a critério
+ do autor/doador decidir se ele ou ela está disposto(a) a distribuir software
+ utilizando outro sistema, e um outro detentor de uma licença não pode impor
+ esta ou qualquer outra escolha.
+
+ Esta secção destina-se a tornar bastante claro o que se acredita ser
+ consequência do restante desta Licença.
+
+ 8. Se a distribuição e/ou uso do Programa são restringidos em certos países por
+ patentes ou direitos de autor, o detentor dos direitos de autor original, que
+ colocou o Programa sob esta Licença, pode incluir uma limitação geográfica de
+ distribuição, excluindo aqueles países, de forma a apenas permitir a
+ distribuição nos países não excluídos. Nestes casos, esta Licença incorpora a
+ limitação como se a mesma constasse escrita nesta Licença.
+
+ 9. A Free Software Foundation pode publicar versões revistas e/ou novas da
+ Licença Pública Geral de tempos em tempos. Estas novas versões serão similares
+ em espírito à versão actual, mas podem diferir em detalhes que resolvam novos
+ problemas ou situações.
+
+ A cada versão é dada um número distinto. Se o Programa especifica um número de
+ versão específico desta Licença que se aplica a ele e a "qualquer nova versão",
+ você tem a opção de aceitar os termos e condições daquela versão ou de qualquer
+ outra versão posterior publicada pela Free Software Foundation. Se o programa
+ não especificar um número de versão desta Licença, poderá escolher qualquer
+ versão publicada pela Free Software Foundation.
+
+ 10. Se você pretende incorporar partes do Programa em outros programas livres
+ cujas condições de distribuição sejam diferentes, escreva ao autor e solicite
+ permissão para tal. Para o software que a Free Software Foundation detém
+ direitos de autor, escreva à Free Software Foundation; às vezes nós permitimos
+ excepções para estes casos. A nossa decisão será guiada por dois objectivos: o
+ de preservar a condição de liberdade de todas os trabalhos derivados do nosso
+ software livre, e o de promover a partilha e reutilização de software de um
+ modo geral.
+
+
+AUSÊNCIA DE GARANTIAS
+
+ 11. UMA VEZ QUE O PROGRAMA É LICENCIADO SEM ÓNUS, NÃO HÁ QUALQUER GARANTIA PARA
+ O PROGRAMA, NA EXTENSÃO PERMITIDA PELAS LEIS APLICÁVEIS. EXCEPTO QUANDO
+ EXPRESSO DE FORMA ESCRITA, OS DETENTORES DOS DIREITOS AUTORAIS E/OU TERCEIROS
+ DISPONIBILIZAM O PROGRAMA "COMO ESTA", SEM QUALQUER TIPO DE GARANTIAS,
+ EXPRESSAS OU IMPLÍCITAS, INCLUINDO, MAS NÃO LIMITADO A, ÀS GARANTIAS IMPLÍCITAS
+ DE COMERCIALIZAÇÃO E ÀS DE ADEQUAÇÃO A QUALQUER PROPÓSITO. O RISCO COM A
+ QUALIDADE E DESEMPENHO DO PROGRAMA É TOTALMENTE SEU. CASO O PROGRAMA SE REVELE
+ DEFEITUOSO, VOCÊ ASSUME OS CUSTOS DE TODAS AS MANUTENÇÕES, REPAROS E CORRECÇÕES
+ QUE JULGUE NECESSÁRIAS.
+
+ 12. EM NENHUMA CIRCUNSTÂNCIA, A MENOS QUE EXIGIDO PELAS LEIS APLICÁVEIS OU
+ ACORDO ESCRITO, OS DETENTORES DOS DIREITOS DE AUTOR, OU QUALQUER OUTRA PARTE
+ QUE POSSA MODIFICAR E/OU REDISTRIBUIR O PROGRAMA CONFORME PERMITIDO ACIMA,
+ SERÃO RESPONSABILIZADOS POR SI OU POR SEU INTERMÉDIO, POR DANOS, INCLUINDO
+ QUALQUER DANO EM GERAL, ESPECIAL, ACIDENTAL OU CONSEQUENTE, RESULTANTES DO USO
+ OU INCAPACIDADE DE USO DO PROGRAMA (INCLUINDO, MAS NÃO LIMITADO A, A PERDA DE
+ DADOS OU DADOS TORNADOS INCORRECTOS, OU PERDAS SOFRIDAS POR SI OU POR OUTRAS
+ PARTES, OU FALHAS DO PROGRAMA AO OPERAR COM QUALQUER OUTRO PROGRAMA), MESMO QUE
+ TAIS DETENTORES OU PARTES TENHAM SIDO AVISADOS DA POSSIBILIDADE DE TAIS DANOS.
+
+FIM DOS TERMOS E CONDIÇÕES
+
+---------------------
+
+
+
+Como Aplicar Estes Termos aos Seus Novos Programas
+
+ Se você desenvolver um novo programa, e quer que ele seja utilizado amplamente
+ pelo público, a melhor forma de alcançar este objectivo é torná-lo software
+ livre, software que qualquer um pode redistribuir e alterar, sob estes termos.
+
+ Para tal, inclua os seguintes avisos no programa. É mais seguro inclui-los logo
+ no início de cada arquivo-fonte para reforçar mais efectivamente a inexistência
+ de garantias; e cada arquivo deve conter pelo menos a linha de "copyright" e
+ uma indicação sobre onde encontrar o texto completo da licença.
+
+Exemplo:
+
+
+
+ Copyright (C)
+
+ Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo sob
+ os termos da Licença Pública Geral GNU, conforme publicada pela Free Software
+ Foundation; tanto a versão 2 da Licença como (a seu critério) qualquer versão
+ mais actual.
+
+ Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
+ GARANTIA; incluindo as garantias implícitas de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
+ A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
+ obter mais detalhes.
+
+ Você deve ter recebido uma cópia da Licença Pública Geral GNU em conjunto com
+ este programa; caso contrário, escreva para a Free Software Foundation, Inc.,
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+
+
+ Inclua também informações sobre como contactá-lo electronicamente e por carta.
+
+ Se o programa é interactivo, faça-o mostrar um aviso breve como este, ao
+ iniciar um modo interactivo:
+
+Exemplo:
+
+
+ Gnomovision versão 69, Copyright (C) O Gnomovision não
+ possui QUALQUER GARANTIA; para obter mais detalhes escreva `mostrar g'. É
+ software livre e você está convidado a redistribui-lo sob certas condições;
+ digite `mostrar c' para obter detalhes.
+
+ Os comandos hipotéticos `mostrar g e `mostrar c' devem mostrar as partes
+ apropriadas da Licença Pública Geral. É claro que os comandos que escolher usar
+ podem ser activados de outra forma que `mostrar g' e `mostrar c'; podem ser
+ cliques do rato ou itens de um menu -- o que melhor se adequar ao seu programa.
+
+ Você também deve obter da sua entidade patronal (se trabalhar como
+ programador) ou escola, conforme o caso, uma "declaração de ausência de
+ direitos autorais" sobre o programa, se necessário. Aqui está um exemplo:
+
+
+ Neoscopio Lda., declara a ausência de quaisquer direitos autorais sobre o
+ programa `Gnomovision' escrito por Jorge Andrade.
+
+10 de Junho de 2004
+ ,
+
+Miguel Nunes, Gerente de Neoscopio Lda.
+
+
+
+ Esta Licença Pública Geral não permite incorporar o seu programa em programas
+ proprietários. Se o seu programa é uma biblioteca de sub-rotinas, poderá
+ considerar mais útil permitir ligar aplicações proprietárias com a biblioteca.
+ Se é isto que pretende, use a Licença Pública Geral de Bibliotecas GNU, em vez
+ desta Licença.
+
+
+
+
+
diff --git a/pagsegurotransparente.php b/pagsegurotransparente.php
new file mode 100644
index 0000000..5712286
--- /dev/null
+++ b/pagsegurotransparente.php
@@ -0,0 +1,2290 @@
+_loggable = true;
+ $this->tableFields = array_keys($this->getTableSQLFields());
+ $this->_tablepkey = 'id';
+ $this->_tableId = 'id';
+ $varsToPush = $this->getVarsToPush ();
+ $this->setConfigParameterable($this->_configTableFieldName, $varsToPush);
+ $this->domdocument = false;
+
+ if (!class_exists('VirtueMartModelOrders'))
+ require( JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php' );
+ // Set the language code
+ $lang = JFactory::getLanguage();
+ $lang->load('plg_vmpayment_' . $this->_name, JPATH_ADMINISTRATOR);
+ // self::$_this = $this;
+
+ if (!class_exists('CurrencyDisplay'))
+ require( JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'currencydisplay.php' );
+
+ }
+ /**
+ * Create the table for this plugin if it does not yet exist.
+ * @author Valérie Isaksen
+ */
+ protected function getVmPluginCreateTableSQL() {
+ return $this->createTableSQL('Payment Pagsegurotransparente Table');
+ }
+ /**
+ * Fields to create the payment table
+ * @return string SQL Fileds
+ */
+ function getTableSQLFields() {
+ // tabela com as configurações de cada transação
+ $SQLfields = array(
+ 'id' => 'bigint(10) unsigned NOT NULL AUTO_INCREMENT',
+ 'transactionCode' => ' varchar(50) NOT NULL',
+ 'virtuemart_order_id' => 'bigint(11) UNSIGNED DEFAULT NULL',
+ 'order_number' => 'char(50) DEFAULT NULL',
+ 'virtuemart_paymentmethod_id' => 'mediumint(1) UNSIGNED DEFAULT NULL',
+ 'payment_name' => 'char(255) NOT NULL DEFAULT \'\' ',
+ 'payment_order_total' => 'decimal(15,5) NOT NULL DEFAULT \'0.00000\' ',
+ 'payment_currency' => 'char(3) ',
+ 'type_transaction' => 'varchar(200) DEFAULT NULL ',
+ 'log' => ' varchar(200) DEFAULT NULL',
+ 'status' => ' char(1) not null default \'P\'',
+ 'msg_status' => ' varchar(255) NOT NULL',
+ 'url_redirecionar' => ' varchar(255) NOT NULL',
+ 'tax_id' => 'smallint(11) DEFAULT NULL',
+ );
+ return $SQLfields;
+ }
+
+ /**
+ * @param $name
+ * @param $id
+ * @param $data
+ * @return bool
+ */
+ function plgVmDeclarePluginParamsPaymentVM3( &$data) {
+ return $this->declarePluginParams('payment', $data);
+ }
+
+ function getPluginParams(){
+ $db = JFactory::getDbo();
+ $sql = "select virtuemart_paymentmethod_id from #__virtuemart_paymentmethods where payment_element = 'pagsegurotransparente'";
+ $db->setQuery($sql);
+ $id = (int)$db->loadResult();
+ return $this->getVmPluginMethod($id);
+ }
+ /**
+ *
+ *
+ * @author Valérie Isaksen
+ */
+ function plgVmConfirmedOrder($cart, $order) {
+ if (!($method = $this->getVmPluginMethod($order['details']['BT']->virtuemart_paymentmethod_id))) {
+ return null; // Another method was selected, do nothing
+ }
+ if (!$this->selectedThisElement($method->payment_element)) {
+ return false;
+ }
+ vmJsApi::js('facebox');
+ vmJsApi::css('facebox');
+ $this->order_id = $order['details']['BT']->order_number;
+ $url = JURI::root();
+ // carrega os js e css
+ $doc = & JFactory::getDocument();
+ $url_lib = $url. '/' .'plugins'. '/' .'vmpayment'. '/' .'pagsegurotransparente'.'/';
+ $url_assets = $url_lib . 'assets'. '/';
+ $url_js = $url_assets . 'js'. '/';
+ $url_css = $url_assets . 'css'. '/';
+ $this->url_imagens = $url_lib . 'imagens'. '/';
+ // redirecionar dentro do componente para validar
+ $url_redireciona_pagsegurotransparente = JROUTE::_(JURI::root() . 'index.php?option=com_virtuemart&view=pluginresponse&task=pluginnotification&task2=redirecionarPagseguroAPI&tmpl=component&pm='.$order['details']['BT']->virtuemart_paymentmethod_id."&order_number=".$this->order_id);
+ $url_pedidos = JROUTE::_(JURI::root() . 'index.php?option=com_virtuemart&view=orders');
+
+ if ($method->url_redirecionamento) {
+ $url_recibo_pagsegurotransparente = JROUTE::_($method->url_redirecionamento);
+ } else {
+ $url_recibo_pagsegurotransparente = JROUTE::_(JURI::root() .'index.php?option=com_virtuemart&view=pluginresponse&task=pluginresponsereceived&on='.$this->order_id.'&pm='.$order['details']['BT']->virtuemart_paymentmethod_id);
+ }
+
+ $session_id_pagseguro = $this->getSessionIdPagseguro($method);
+ if (!$session_id_pagseguro) {
+ JFactory::getApplication()->enqueueMessage( 'Erro ao configurar e-mail e token do PagSeguro', 'error' );
+ return false;
+ }
+ $url_js_directpayment = $this->getUrlJsPagseguro($method);
+ $doc->addCustomTag('
+
+
+
+
+
+
+ '.($load_squeezebox!=0?$sq_js:'').'
+
+
+
+ '.($load_squeezebox!=0?$sq_css:'').'
+ ');
+ $lang = JFactory::getLanguage();
+ $filename = 'com_virtuemart';
+ $lang->load($filename, JPATH_ADMINISTRATOR);
+ $vendorId = 0;
+ $this->logInfo('plgVmConfirmedOrder order number: ' . $order['details']['BT']->order_number, 'message');
+ $html = "";
+ if (!class_exists('VirtueMartModelOrders')) {
+ require( JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php' );
+ }
+ $this->getPaymentCurrency($method);
+ $q = 'SELECT `currency_code_3` FROM `#__virtuemart_currencies` WHERE `virtuemart_currency_id`="' . $method->payment_currency . '" ';
+ $db = &JFactory::getDBO();
+ $db->setQuery($q);
+ $currency_code_3 = $db->loadResult();
+ $paymentCurrency = CurrencyDisplay::getInstance($method->payment_currency);
+ $totalInPaymentCurrency = round($paymentCurrency->convertCurrencyTo($method->payment_currency, $order['details']['BT']->order_total, false), 2);
+ $cd = CurrencyDisplay::getInstance($cart->pricesCurrency);
+ // pega o nome do método de pagamento
+ $dbValues['payment_name'] = $this->renderPluginName($method);
+
+ $html = '' . "\n";
+ $html .= $this->getHtmlRowBE('PAGSEGUROTRANSPARENTE_PAYMENT_NAME', $dbValues['payment_name']);
+ if (!empty($payment_info)) {
+ $lang = & JFactory::getLanguage();
+ if ($lang->hasKey($method->payment_info)) {
+ $payment_info = JText::_($method->payment_info);
+ } else {
+ $payment_info = $method->payment_info;
+ }
+ $html .= $this->getHtmlRowBE('PAGSEGUROTRANSPARENTE_INFO', $payment_info);
+ }
+ if (!class_exists('VirtueMartModelCurrency')) {
+ require(JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'currency.php');
+ }
+ $currency = CurrencyDisplay::getInstance('', $order['details']['BT']->virtuemart_vendor_id);
+ $html .= $this->getHtmlRowBE('PAGSEGUROTRANSPARENTE_ORDER_NUMBER', $order['details']['BT']->order_number);
+ $html .= $this->getHtmlRowBE('PAGSEGUROTRANSPARENTE_AMOUNT', $currency->priceDisplay($order['details']['BT']->order_total));
+ $html .= '
+
+
' . "\n";
+ $this->_virtuemart_paymentmethod_id = $order['details']['BT']->virtuemart_paymentmethod_id;
+ $dbValues['order_number'] = $order['details']['BT']->order_number;
+ $dbValues['virtuemart_paymentmethod_id'] = $this->_virtuemart_paymentmethod_id;
+ $dbValues['cost_per_transaction'] = $method->cost_per_transaction;
+ $dbValues['cost_percent_total'] = $method->cost_percent_total;
+ $dbValues['payment_currency'] = $currency_code_3;
+ $dbValues['payment_order_total'] = $totalInPaymentCurrency;
+ $dbValues['tax_id'] = $method->tax_id;
+ $this->storePSPluginInternalData($dbValues);
+ // grava os dados do pagamento
+ //$this->gravaDados($method,0,$arr_pagamento['status']);
+ //$retorno = $this->createTransaction($method,$order);
+ $html .= $this->Pagsegurotransparente_mostraParcelamento($method, $order);
+ $cart->_confirmDone = FALSE;
+ $cart->_dataValidated = FALSE;
+ $cart->setCartIntoSession ();
+ JRequest::setVar ('html', $html);
+
+ }
+
+ public function Pagsegurotransparente_mostraParcelamento($method, $order) {
+
+ $doc = JFactory::getDocument();
+ //$doc->addScript($this->url_js);
+
+ if ($method->ativar_cartao ) {
+ $lt_cartao = 'Cartão de Crédito ';
+ }
+
+ if ($method->ativar_debito ) {
+ $lt_cartaod = 'Débito Bancário ';
+ if ( !$method->ativar_cartao ) {
+ $lt_cartaod = 'Débito Bancário ';
+ }
+ }
+
+ if ($method->ativar_boleto) {
+ $lt_boleto = ' Boleto ';
+
+ if ( !$method->ativar_cartao && !$method->ativar_debito ) {
+ $lt_boleto = ' Boleto ';
+ }
+ }
+
+ $conteudo = '
+
+
+
+
+
'.JText::_('VMPAYMENT_PAGSEGUROTRANSPARENTE_TRANSACTION_TITLE').'
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Pague com
+
+
+
+ '.$lt_cartao .'
+ '.$lt_cartaod.'
+ '.$lt_boleto .'
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ';
+
+
+ if ($method->ativar_cartao) {
+ $conteudo .= $this->getPagamentoCartao($method, $order);
+ }
+
+
+ if ($method->ativar_debito) {
+ $conteudo .= $this->getPagamentoDebito($method, $order);
+ }
+ if ($method->ativar_boleto) {
+ $conteudo .= $this->getPagamentoBoleto($method, $order);
+ }
+ $conteudo .= "
+
+
+
+
+
+ ";
+
+ return $conteudo;
+ }
+
+ public function getRadioTermosPagseguro(){
+ /*
+ return "
+ Por favor, leia e aceite os termos de gestão de pagamentos do Pagseguro. ";
+ */
+ return;
+ }
+ public function getPagamentoCartao($method, $order) {
+ $order_total = round($order['details']['BT']->order_total,2);
+ $cartoes_aceitos = array();
+ $method->cartao_visa?$cartoes_aceitos[] = 'visa':'';
+ $method->cartao_master==1?$cartoes_aceitos[] = 'master':'';
+ $method->cartao_elo==1?$cartoes_aceitos[] = 'elo':'';
+ $method->cartao_diners==1?$cartoes_aceitos[] = 'diners':'';
+ $method->cartao_amex==1?$cartoes_aceitos[] = 'amex':'';
+ $method->cartao_hipercard==1?$cartoes_aceitos[] = 'hipercard':'';
+ $method->cartao_aura==1?$cartoes_aceitos[] = 'aura':'';
+
+ $html_radio_termos_pagseguro = $this->getRadioTermosPagseguro();
+ // campo telefone
+ $bt_comprador = $order['details']['BT'];
+ $phone = $bt_comprador->phone_1;
+ // cpf, data de nascimento
+ $campo_cpf = $method->campo_cpf;
+ $campo_cep = $method->campo_cep;
+ $campo_cnpj = $method->campo_cnpj;
+ $campo_data_nascimento = $method->campo_data_nascimento;
+ // campo data de nascimento
+ $birthdate = $this->formataData((isset($bt_comprador->$campo_data_nascimento) and !empty($bt_comprador->$campo_data_nascimento))?$bt_comprador->$campo_data_nascimento:'');
+ $cpf = $this->formataCPF((isset($bt_comprador->$campo_cpf) and !empty($bt_comprador->$campo_cpf))?$bt_comprador->$campo_cpf:'');
+
+ $campo_nome = $method->campo_nome;
+ $campo_sobrenome = $method->campo_sobrenome;
+
+ $nome = $bt_comprador->$campo_nome.' '.$bt_comprador->$campo_sobrenome;
+ $html = '
+
+
+
+
+
+
+ '.JText::_('VMPAYMENT_PAGSEGUROTRANSPARENTE_TRANSACTION_CREDIT_CARD').'
+
+
+
+
+
+
+
+ ';
+ return $html;
+ }
+
+
+
+ public function getPagamentoBoleto($method, $order) {
+ $order_total = round($order['details']['BT']->order_total,2);
+ $html_radio_termos_pagseguro = $this->getRadioTermosPagseguro();
+ $html = '
+
+
+
+
+
+
+
+ '.JText::_('VMPAYMENT_PAGSEGUROTRANSPARENTE_TRANSACTION_CREDIT_BOLETO').'
+
+
+
+
+
+
';
+ return $html;
+ }
+
+ public function getPagamentoDebito($method, $order) {
+
+ $order_total = round($order['details']['BT']->order_total,2);
+ $debitos_aceitos = array();
+ $method->debito_bb?$debitos_aceitos[] = 'bb':'';
+ $method->debito_bradesco==1?$debitos_aceitos[] = 'bradesco':'';
+ $method->debito_banrisul==1?$debitos_aceitos[] = 'banrisul':'';
+ $method->debito_itau==1?$debitos_aceitos[] = 'itau':'';
+ $method->debito_hsbc==1?$debitos_aceitos[] = 'hsbc':'';
+ $html_radio_termos_pagseguro = $this->getRadioTermosPagseguro();
+
+ $html ='
+
+
+
+
+
+
+ '.JText::_('VMPAYMENT_PAGSEGUROTRANSPARENTE_TRANSACTION_DEBIT').'
+
+
+
+
+
+
+
+
+
+
+ ";
+ return $html;
+ }
+ public function getSessionIdPagseguro($method) {
+ $codigo = $this->getSessionidPagSeguro_request($method);
+ return $codigo;
+ /*
+ for ($i=0; $i < 2; $i++) {
+ $codigo = $this->getSessionidPagSeguro_request($method);
+ if (!empty($codigo)) {
+ return $codigo;
+ }
+ }
+ return false;
+ */
+ }
+ public function getSessionidPagSeguro_request($method) {
+ $email_pagseguro = $this->getSellerEmail($method);
+ $token_pagseguro = $this->getToken($method);
+ $url_ws_pagseguro = $this->getUrlWsPagseguro($method);
+ # /v2/sessions?email={email}&token={token}
+ // $url_completa = $url_ws_pagseguro.'/v2/sessions?email='.$email_pagseguro.'&token='.$token_pagseguro;
+ if ($method->modo_debug) {
+ echo $url_ws_pagseguro.'/v2/sessions?email='.$email_pagseguro.'&token='.$token_pagseguro;
+ }
+ $params = array();
+ $params['email'] = $email_pagseguro;
+ $params['token'] = $token_pagseguro;
+ if(function_exists('curl_exec')) {
+
+ ob_start();
+ $ch = curl_init();
+ curl_setopt($ch, CURLOPT_URL, $url_ws_pagseguro.'/v2/sessions');
+ curl_setopt($ch, CURLOPT_POST, 1);
+ curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params, '', '&'));
+ // curl_setopt($ch, CURLOPT_HTTPHEADER, $oAuth);
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
+
+ curl_exec($ch);
+ $resposta = ob_get_contents();
+ ob_end_clean();
+ $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
+ curl_close($ch);
+ } else if(ini_get('allow_url_fopen') == '1') {
+ $postdata = http_build_query(
+ array(
+ 'email' => $email_pagseguro,
+ 'token' => $token_pagseguro
+ )
+ );
+ $opts = array('http' =>
+ array(
+ 'method' => 'POST',
+ 'header' => 'Content-type: application/x-www-form-urlencoded',
+ 'content' => $postdata
+ )
+ );
+ $context = stream_context_create($opts);
+ $resposta = file_get_contents($url_ws_pagseguro.'/v2/sessions', false, $context);
+ } else {
+ die('Para o funcionamento do módulo, é necessário CURL ou file_get_contents ativo');
+ }
+ if ($method->modo_debug) {
+ print_r($resposta);
+ }
+ $xml = new DomDocument();
+ $dom = $xml->loadXML($resposta);
+ $codigo = $xml->getElementsByTagName('id')->item(0)->nodeValue;
+ return $codigo;
+ }
+
+ // grava os dados do retorno da Transação
+ public function gravaDadosRetorno($method, $status="", $msg_status="", $url_redirecionar='', $tipo_pagamento="", $forma_pagamento="", $parcela_selecionada="") {
+ $timestamp = date('Y-m-d').'T'.date('H:i:s');
+ // recupera as informações do pagamento
+ $db = JFactory::getDBO();
+ $query = 'SELECT payment_name, payment_order_total, payment_currency, virtuemart_paymentmethod_id
+ FROM `' . $this->_tablename . '`
+ WHERE order_number = "'.$this->order_number.'"';
+ $db->setQuery($query);
+ $pagamento = $db->loadObjectList();
+ $type_transaction = $tipo_pagamento.' - '.$forma_pagamento.($parcela_selecionada!=''?' - '.$parcela_selecionada.'x ':'');
+ // $log = $this->timestamp.'|'.$this->transactionCode.'|'.$msg_status.'|'.$tipo_pagamento.'|'.$forma_pagamento.'|'.$pagamento[0]->payment_order_total;
+ $log = $timestamp.'|'.$this->transactionCode.'|'.$msg_status.'|'.$tipo_pagamento.'|'.$forma_pagamento.'|'.$pagamento[0]->payment_order_total;
+
+ if (!($virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber ($this->order_number))) {
+ return NULL;
+ }
+ $response_fields = array();
+ $response_fields['virtuemart_order_id'] = $virtuemart_order_id;
+ $response_fields['transactionCode'] = $this->transactionCode;
+ $response_fields['type_transaction'] = $type_transaction;
+ $response_fields['log'] = $log;
+ $response_fields['status'] = $status;
+ $response_fields['msg_status'] = $msg_status;
+ $response_fields['order_number'] = $this->order_number;
+ if ($url_redirecionar != '') {
+ $response_fields['url_redirecionar'] = $url_redirecionar;
+ }
+
+ $response_fields['payment_name'] = $pagamento[0]->payment_name;
+ $response_fields['payment_currency'] = $pagamento[0]->payment_currency;
+ $response_fields['payment_order_total'] = $pagamento[0]->payment_order_total;
+ $response_fields['virtuemart_paymentmethod_id'] = $pagamento[0]->virtuemart_paymentmethod_id;
+
+ $this->storePSPluginInternalData($response_fields, 'virtuemart_order_id', true);
+ }
+
+
+ function plgVmgetPaymentCurrency($virtuemart_paymentmethod_id, &$paymentCurrencyId) {
+ if (!($method = $this->getVmPluginMethod($virtuemart_paymentmethod_id))) {
+ return null; // Another method was selected, do nothing
+ }
+ if (!$this->selectedThisElement($method->payment_element)) {
+ return false;
+ }
+ $this->getPaymentCurrency($method);
+ $paymentCurrencyId = $method->payment_currency;
+ }
+
+ /**
+ * Display stored payment data for an order
+ *
+ */
+ function plgVmOnShowOrderBEPayment($virtuemart_order_id, $virtuemart_payment_id) {
+ if (!$this->selectedThisByMethodId($virtuemart_payment_id)) {
+ return null; // Another method was selected, do nothing
+ }
+ $db = JFactory::getDBO();
+ $q = 'SELECT * FROM `' . $this->_tablename . '` '
+ . 'WHERE `virtuemart_order_id` = ' . $virtuemart_order_id;
+ $db->setQuery($q);
+ if (!($paymentTable = $db->loadObject())) {
+ vmWarn(500, $q . " " . $db->getErrorMsg());
+ return '';
+ }
+ $this->getPaymentCurrency($paymentTable);
+ $html = '' . "\n";
+ $html .=$this->getHtmlHeaderBE();
+
+ $html .= $this->getHtmlRowBE('PAGSEGUROTRANSPARENTE_PAYMENT_NAME', 'Pagseguro API Transparente');
+ $html .= $this->getHtmlRowBE('PAGSEGUROTRANSPARENTE_PAYMENT_DATE', $paymentTable->modified_on);
+ $html .= $this->getHtmlRowBE('PAGSEGUROTRANSPARENTE_CODIGO_PAGSEGUROTRANSPARENTE', $paymentTable->transactionCode);
+ $html .= $this->getHtmlRowBE('PAGSEGUROTRANSPARENTE_STATUS', $paymentTable->status . ' - ' . $paymentTable->msg_status);
+ if (!empty($paymentTable->cofre))
+ $html .= $this->getHtmlRowBE('PAGSEGUROTRANSPARENTE_COFRE', $paymentTable->cofre);
+ $html .= $this->getHtmlRowBE('PAGSEGUROTRANSPARENTE_TOTAL_CURRENCY', $paymentTable->payment_order_total . ' ' . $paymentTable->payment_currency);
+ $html .= $this->getHtmlRowBE('PAGSEGUROTRANSPARENTE_TYPE_TRANSACTION', $paymentTable->type_transaction);
+ if (!empty($paymentTable->nome_titular_cartao))
+ $html .= $this->getHtmlRowBE('PAGSEGUROTRANSPARENTE_NOME_TITULAR_CARTAO', $paymentTable->nome_titular_cartao);
+ if (!empty($paymentTable->nascimento_titular_cartao))
+ $html .= $this->getHtmlRowBE('PAGSEGUROTRANSPARENTE_NASCIMENTO_TITULAR_CARTAO', $paymentTable->nascimento_titular_cartao);
+ if (!empty($paymentTable->telefone_titular_cartao))
+ $html .= $this->getHtmlRowBE('PAGSEGUROTRANSPARENTE_TELEFONE_TITULAR_CARTAO', $paymentTable->telefone_titular_cartao);
+ if (!empty($paymentTable->cpf_titular_cartao))
+ $html .= $this->getHtmlRowBE('PAGSEGUROTRANSPARENTE_CPF_TITULAR_CARTAO', $paymentTable->cpf_titular_cartao);
+ $html .= $this->getHtmlRowBE('PAGSEGUROTRANSPARENTE_LOG', $paymentTable->log);
+ $html .= '
' . "\n";
+ return $html;
+ }
+ function getCosts(VirtueMartCart $cart, $method, $cart_prices) {
+ if (preg_match('/%$/', $method->cost_percent_total)) {
+ $cost_percent_total = substr($method->cost_percent_total, 0, -1);
+ } else {
+ $cost_percent_total = $method->cost_percent_total;
+ }
+ return ($method->cost_per_transaction + ($cart_prices['salesPrice'] * $cost_percent_total * 0.01));
+ }
+ /**
+ * Check if the payment conditions are fulfilled for this payment method
+ * @author: Valerie Isaksen
+ *
+ * @param $cart_prices: cart prices
+ * @param $payment
+ * @return true: if the conditions are fulfilled, false otherwise
+ *
+ */
+ protected function checkConditions($cart, $method, $cart_prices) {
+ // $params = new JParameter($payment->payment_params);
+ $address = (($cart->ST == 0) ? $cart->BT : $cart->ST);
+ $amount = $cart_prices['salesPrice'];
+ $amount_cond = ($amount >= $method->min_amount AND $amount <= $method->max_amount
+ OR
+ ($method->min_amount <= $amount AND ($method->max_amount == 0) ));
+ if (!$amount_cond) {
+ return false;
+ }
+ $countries = array();
+ if (!empty($method->countries)) {
+ if (!is_array($method->countries)) {
+ $countries[0] = $method->countries;
+ } else {
+ $countries = $method->countries;
+ }
+ }
+ // probably did not gave his BT:ST address
+ if (!is_array($address)) {
+ $address = array();
+ $address['virtuemart_country_id'] = 0;
+ }
+ if (!isset($address['virtuemart_country_id']))
+ $address['virtuemart_country_id'] = 0;
+ if (count($countries) == 0 || in_array($address['virtuemart_country_id'], $countries) || count($countries) == 0) {
+ return true;
+ }
+ return false;
+ }
+ /*
+ * We must reimplement this triggers for joomla 1.7
+ */
+ /**
+ * Create the table for this plugin if it does not yet exist.
+ * This functions checks if the called plugin is active one.
+ * When yes it is calling the pagsegurotransparente method to create the tables
+ * @author Valérie Isaksen
+ *
+ */
+ function plgVmOnStoreInstallPaymentPluginTable($jplugin_id) {
+ return $this->onStoreInstallPluginTable($jplugin_id);
+ }
+ /**
+ * This event is fired after the payment method has been selected. It can be used to store
+ * additional payment info in the cart.
+ *
+ * @author Max Milbers
+ * @author Valérie isaksen
+ *
+ * @param VirtueMartCart $cart: the actual cart
+ * @return null if the payment was not selected, true if the data is valid, error message if the data is not vlaid
+ *
+ */
+ public function plgVmOnSelectCheckPayment(VirtueMartCart $cart) {
+ return $this->OnSelectCheck($cart);
+ }
+ /**
+ * plgVmDisplayListFEPayment
+ * This event is fired to display the pluginmethods in the cart (edit shipment/payment) for exampel
+ *
+ * @param object $cart Cart object
+ * @param integer $selected ID of the method selected
+ * @return boolean True on succes, false on failures, null when this plugin was not selected.
+ * On errors, JError::raiseWarning (or JError::raiseError) must be used to set a message.
+ *
+ * @author Valerie Isaksen
+ * @author Max Milbers
+ */
+ public function plgVmDisplayListFEPayment(VirtueMartCart $cart, $selected = 0, &$htmlIn) {
+ return $this->displayListFE($cart, $selected, $htmlIn);
+ }
+ /*
+ * plgVmonSelectedCalculatePricePayment
+ * Calculate the price (value, tax_id) of the selected method
+ * It is called by the calculator
+ * This function does NOT to be reimplemented. If not reimplemented, then the default values from this function are taken.
+ * @author Valerie Isaksen
+ * @cart: VirtueMartCart the current cart
+ * @cart_prices: array the new cart prices
+ * @return null if the method was not selected, false if the shiiping rate is not valid any more, true otherwise
+ *
+ *
+ */
+ public function plgVmonSelectedCalculatePricePayment(VirtueMartCart $cart, array &$cart_prices, &$cart_prices_name) {
+ return $this->onSelectedCalculatePrice($cart, $cart_prices, $cart_prices_name);
+ }
+ /**
+ * plgVmOnCheckAutomaticSelectedPayment
+ * Checks how many plugins are available. If only one, the user will not have the choice. Enter edit_xxx page
+ * The plugin must check first if it is the correct type
+ * @author Valerie Isaksen
+ * @param VirtueMartCart cart: the cart object
+ * @return null if no plugin was found, 0 if more then one plugin was found, virtuemart_xxx_id if only one plugin is found
+ *
+ */
+ function plgVmOnCheckAutomaticSelectedPayment(VirtueMartCart $cart, array $cart_prices = array()) {
+ return $this->onCheckAutomaticSelected($cart, $cart_prices);
+ }
+ /**
+ * This method is fired when showing the order details in the frontend.
+ * It displays the method-specific data.
+ *
+ * @param integer $order_id The order ID
+ * @return mixed Null for methods that aren't active, text (HTML) otherwise
+ * @author Max Milbers
+ * @author Valerie Isaksen
+ */
+ public function plgVmOnShowOrderFEPayment($virtuemart_order_id, $virtuemart_paymentmethod_id, &$payment_name) {
+ $orderModel = VmModel::getModel('orders');
+ $orderDetails = $orderModel->getOrder($virtuemart_order_id);
+ if (!($method = $this->getVmPluginMethod($orderDetails['details']['BT']->virtuemart_paymentmethod_id))) {
+ return false;
+ }
+ if (!$this->selectedThisByMethodId ($virtuemart_paymentmethod_id)) {
+ return NULL;
+ } // Another method was selected, do nothing
+ $view = JRequest::getVar('view');
+ if ($view == 'orders' and $orderDetails['details']['BT']->virtuemart_paymentmethod_id == $virtuemart_paymentmethod_id) {
+ $orderModel = VmModel::getModel('orders');
+ $orderDetails = $orderModel->getOrder($virtuemart_order_id);
+ $order_id = $orderDetails['details']['BT']->order_number;
+ $virtuemart_paymentmethod_id = $orderDetails['details']['BT']->virtuemart_paymentmethod_id;
+
+ // consulta se há código de transação no pedido
+ $db = JFactory::getDBO();
+ $query = 'SELECT transactionCode
+ FROM `' . $this->_tablename . '`
+ WHERE order_number = "'.$order_id.'"';
+ $db->setQuery($query);
+ $dados_pagseguro = $db->loadObjectList();
+
+ if ($method->transacao_em_andamento == $orderDetails['details']['BT']->order_status) {
+ JHTML::_('behavior.modal');
+ $url_recibo = JRoute::_('index.php?option=com_virtuemart&view=pluginresponse&tmpl=component&task=pluginresponsereceived&on='.$order_id.'&pm='.$virtuemart_paymentmethod_id);
+ $html = 'Clique aqui para visualizar o status detalhado da transação no Pagseguro ';
+ JFactory::getApplication()->enqueueMessage(
+ $html, 'Prazos para aprovação do Pagamento via pagseguro: Cartão e Boleto 24h úteis Débito Online 2h.'
+ );
+ } else if (
+ ($method->transacao_cancelada == $orderDetails['details']['BT']->order_status)
+ or
+ ($method->transacao_em_andamento == $orderDetails['details']['BT']->order_status and isset($dados_pagseguro[0]->transactionCode) and $dados_pagseguro[0]->transactionCode == "")
+ ) {
+
+ vmJsApi::js('facebox');
+ vmJsApi::css('facebox');
+
+ $this->order_id = $orderDetails['details']['BT']->order_number;
+ $url = JURI::root();
+ // carrega os js e css
+ $doc = JFactory::getDocument();
+ $url_lib = $url. '/' .'plugins'. '/' .'vmpayment'. '/' .'pagsegurotransparente'.'/';
+ $url_assets = $url_lib . 'assets'. '/';
+ $url_js = $url_assets . 'js'. '/';
+ $url_css = $url_assets . 'css'. '/';
+ $this->url_imagens = $url_lib . 'imagens'. '/';
+
+ // redirecionar dentro do componente para validar
+ $url_redireciona_pagsegurotransparente = JROUTE::_(JURI::root() . 'index.php?option=com_virtuemart&view=pluginresponse&task=pluginnotification&task2=redirecionarPagseguroAPI&tmpl=component&pm='.$orderDetails['details']['BT']->virtuemart_paymentmethod_id."&order_number=".$this->order_id);
+ $url_pedidos = JROUTE::_(JURI::root() . 'index.php?option=com_virtuemart&view=orders');
+
+ if ($method->url_redirecionamento) {
+ $url_recibo_pagsegurotransparente = JROUTE::_($method->url_redirecionamento);
+ } else {
+ $url_recibo_pagsegurotransparente = JROUTE::_(JURI::root() .'index.php?option=com_virtuemart&view=pluginresponse&task=pluginresponsereceived&on='.$this->order_id.'&pm='.$orderDetails['details']['BT']->virtuemart_paymentmethod_id);
+ }
+
+ $session_id_pagseguro = $this->getSessionIdPagseguro($method);
+ if (!$session_id_pagseguro) {
+ JFactory::getApplication()->enqueueMessage( 'Erro ao configurar e-mail e token do PagSeguro', 'error' );
+ return false;
+ }
+ $url_js_directpayment = $this->getUrlJsPagseguro($method);
+ $doc->addCustomTag('
+
+
+
+
+
+
+ '.($load_squeezebox!=0?$sq_js:'').'
+
+
+
+ '.($load_squeezebox!=0?$sq_css:'').'
+ ');
+
+
+ $html .= $this->Pagsegurotransparente_mostraParcelamento($method, $orderDetails);
+ echo $html;
+
+ }
+
+ }
+
+
+
+ $this->onShowOrderFE($virtuemart_order_id, $virtuemart_paymentmethod_id, $payment_name);
+ }
+
+ /**
+ * This event is fired during the checkout process. It can be used to validate the
+ * method data as entered by the user.
+ *
+ * @return boolean True when the data was valid, false otherwise. If the plugin is not activated, it should return null.
+ * @author Max Milbers
+ *
+ * public function plgVmOnCheckoutCheckDataPayment( VirtueMartCart $cart) {
+ * return null;
+ * }
+ */
+ /**
+ * This method is fired when showing when priting an Order
+ * It displays the the payment method-specific data.
+ *
+ * @param integer $_virtuemart_order_id The order ID
+ * @param integer $method_id method used for this order
+ * @return mixed Null when for payment methods that were not selected, text (HTML) otherwise
+ * @author Valerie Isaksen
+ */
+ function plgVmonShowOrderPrintPayment($order_number, $method_id) {
+ return $this->onShowOrderPrint($order_number, $method_id);
+ }
+ function plgVmDeclarePluginParamsPayment($name, $id, &$data) {
+ return $this->declarePluginParams('payment', $name, $id, $data);
+ }
+ function plgVmSetOnTablePluginParamsPayment($name, $id, &$table) {
+ return $this->setOnTablePluginParams($name, $id, $table);
+ }
+ //Notice: We only need to add the events, which should work for the specific plugin, when an event is doing nothing, it should not be added
+ /**
+ * Save updated order data to the method specific table
+ *
+ * @param array $_formData Form data
+ * @return mixed, True on success, false on failures (the rest of the save-process will be
+ * skipped!), or null when this method is not actived.
+ * @author Oscar van Eijk
+ *
+ * public function plgVmOnUpdateOrderPayment( $_formData) {
+ * return null;
+ * }
+ *
+ * Save updated orderline data to the method specific table
+ *
+ * @param array $_formData Form data
+ * @return mixed, True on success, false on failures (the rest of the save-process will be
+ * skipped!), or null when this method is not actived.
+ * @author Oscar van Eijk
+ *
+ * public function plgVmOnUpdateOrderLine( $_formData) {
+ * return null;
+ * }
+ *
+ *
+ * plgVmOnEditOrderLineBE
+ * This method is fired when editing the order line details in the backend.
+ * It can be used to add line specific package codes
+ *
+ * @param integer $_orderId The order ID
+ * @param integer $_lineId
+ * @return mixed Null for method that aren't active, text (HTML) otherwise
+ * @author Oscar van Eijk
+ *
+ * public function plgVmOnEditOrderLineBEPayment( $_orderId, $_lineId) {
+ * return null;
+ * }
+ * This method is fired when showing the order details in the frontend, for every orderline.
+ * It can be used to display line specific package codes, e.g. with a link to external tracking and
+ * tracing systems
+ *
+ * @param integer $_orderId The order ID
+ * @param integer $_lineId
+ * @return mixed Null for method that aren't active, text (HTML) otherwise
+ * @author Oscar van Eijk
+ *
+ * public function plgVmOnShowOrderLineFE( $_orderId, $_lineId) {
+ * return null;
+ * }
+ *
+ * /**
+ * This event is fired when the method notifies you when an event occurs that affects the order.
+ * Typically, the events represents for payment authorizations, Fraud Management Filter actions and other actions,
+ * such as refunds, disputes, and chargebacks.
+ *
+ * NOTE for Plugin developers:
+ * If the plugin is NOT actually executed (not the selected payment method), this method must return NULL
+ *
+ * @param $return_context: it was given and sent in the payment form. The notification should return it back.
+ * Used to know which cart should be emptied, in case it is still in the session.
+ * @param int $virtuemart_order_id : payment order id
+ * @param char $new_status : new_status for this order id.
+ * @return mixed Null when this method was not selected, otherwise the true or false
+ *
+ * @author Valerie Isaksen
+ *
+ *
+ * public function plgVmOnPaymentNotification() {
+ * return null;
+ * }
+ */
+ function plgVmOnPaymentNotification() {
+
+ if (!class_exists('VirtueMartCart'))
+ require(JPATH_VM_SITE . DS . 'helpers' . DS . 'cart.php');
+ if (!class_exists('shopFunctionsF'))
+ require(JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php');
+ if (!class_exists('VirtueMartModelOrders'))
+ require( JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php' );
+
+ // redireciona o fluxo para a api do Pagseguro
+ $task2 = JRequest::getVar('task2', '');
+
+
+ if ($task2 == 'redirecionarPagseguroAPI') {
+ // trata os retornos no Virtuemart ( atualizando status )
+ $pm = JRequest::getVar('pm');
+ $order_number = JRequest::getVar('order_number');
+ $virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber($order_number);
+
+ $this->logInfo('plgVmOnPaymentNotification: virtuemart_order_id found ' . $virtuemart_order_id, 'message');
+ if (!$virtuemart_order_id) {
+ return;
+ }
+ $vendorId = 0;
+ $payment = $this->getDataByOrderId($virtuemart_order_id);
+ if($payment->payment_name == '') {
+ return false;
+ }
+ // recupera as informações do método de pagamento
+ $method = $this->getVmPluginMethod($pm);
+ if (!$this->selectedThisElement($method->payment_element)) {
+ return false;
+ }
+ if (!$payment) {
+ $this->logInfo('getDataByOrderId payment not found: exit ', 'ERROR');
+ return null;
+ }
+ $forma_pagamento = JRequest::getVar('forma_pagamento');
+ $tipo_pagamento = JRequest::getVar('tipo_pagamento');
+ // json de retorno js
+ $json_retorno = array();
+ $json_retorno['tipo_pagamento'] = $forma_pagamento;
+ $json_retorno['status'];
+ // cria a transação com o webservice do PagSeguro
+ $retorno = $this->createTransaction();
+ $arr_retorno = $retorno['msg'];
+ if ($retorno['erro'] == 'true') {
+ $json_retorno['erro'] = true;
+ $json_retorno['msg_erro'] = $this->trataRetornoFalhaPagseguro($arr_retorno, $method);
+ //$json_retorno['paymentLink'] = '';
+ } else {
+ $this->trataRetornoSucessoPagseguro($arr_retorno, $method);
+ // no caso de boleto já retorna com o link
+ $json_retorno['paymentLink']= $arr_retorno['paymentLink'];
+ $json_retorno['erro'] = false;
+ $json_retorno['status'] = $arr_retorno['status'];
+ $json_retorno['msg'] = 'Transação: '.$arr_retorno['descriptionStatus'];
+ }
+ echo json_encode($json_retorno);
+ die();
+ } else {
+ // retorno automático boleto/débito bancário Pagseguro
+ header("Status: 200 OK");
+ $pagseguro_data = $_REQUEST;
+ /*
+ if (!isset($pagseguro_data['notificationType'])) {
+ return;
+ }
+ */
+ $order_number = $pagseguro_data['order_number'];
+ $virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber($order_number);
+ $this->logInfo('plgVmOnPaymentNotification: Pagseguro - '.$pagseguro_data['transacao_id'].' - '.$pagseguro_data['pedido'].' - '.$pagseguro_data['status']);
+ if (!$virtuemart_order_id) {
+ return;
+ }
+ $vendorId = 0;
+ $payment = $this->getDataByOrderId($virtuemart_order_id);
+ if($payment->payment_name == '') {
+ return false;
+ }
+ $method = $this->getVmPluginMethod($payment->virtuemart_paymentmethod_id);
+ if (!$this->selectedThisElement($method->payment_element)) {
+ return false;
+ }
+ if (!$payment) {
+ $this->logInfo('getDataByOrderId payment not found: exit ', 'ERROR');
+ return null;
+ }
+ $this->logInfo('pagseguro_ws_data ' . implode(' ', $pagseguro_data), 'message');
+ // get all know columns of the table
+ $db = JFactory::getDBO();
+ $url_ws_pagseguro = $this->getUrlWsPagseguro($method);
+
+ // código de notificação da transação no PagSeguro
+ $notificationCode = $pagseguro_data['notificationCode'];
+ $notificationType = $pagseguro_data['notificationType'];
+ $emailPagseguro = $this->getSellerEmail($method);
+ $tokenPagseguro = $this->getToken($method);
+ $urlPost = $url_ws_pagseguro.'/v2/transactions/notifications/'.$notificationCode.'/?email='.$emailPagseguro.'&token='.$tokenPagseguro;
+ // $params = array(
+ // "email" => $this->getSellerEmail($method),
+ // "token" => $this->getToken($method)
+ // );
+ $ch = curl_init();
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($ch, CURLOPT_URL, $urlPost);
+ curl_setopt($ch, CURLOPT_POST, false);
+ // curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
+ $resposta = curl_exec($ch);
+ $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
+ curl_close($ch);
+
+ // faz a validação dos dados
+ if($httpCode == "200") {
+ // pega os dados da transação por completo
+ $xml = new DomDocument();
+ $dom = $xml->loadXML($resposta);
+ $code_transacao = $xml->getElementsByTagName("code")->item(0)->nodeValue;
+ // consulta os dados do pagseguro
+ $query = 'SELECT order_number
+ FROM `' . $this->_tablename . '`
+ WHERE transactionCode = "'.$code_transacao.'"';
+ $db->setQuery($query);
+ $dados_pagseguro = $db->loadObjectList();
+ if ($dados_pagseguro[0]->order_number != $order_number){
+ // não é a mesma transação do código da transação
+ $this->logInfo('plgVmOnPaymentNotification - return false transaction. Order number: ' . $order_number.' - Order number DB: '.$dados_pagseguro[0]->order_number, 'error');
+ return;
+ }
+
+ $status = $xml->getElementsByTagName("status")->item(0)->nodeValue;
+ $reference = $xml->getElementsByTagName("reference")->item(0)->nodeValue;
+ $type = $xml->getElementsByTagName("type")->item(0)->nodeValue;
+ $cancellationSource = $xml->getElementsByTagName("cancellationSource")->item(0)->nodeValue;
+ $installmentCount = $xml->getElementsByTagName("installmentCount")->item(0)->nodeValue;
+ // codigo meio pagamento
+ $code_payment = $xml->getElementsByTagName("paymentMethod")->item(0)->getElementsByTagName("paymentMethod")->item(0)->nodeValue;
+
+ $arr_status_pagamento = $this->getStatusPagamentoPagseguroRetorno($method, $status);
+ $novo_status = $arr_status_pagamento[0];
+ $mensagem = $arr_status_pagamento[1];
+// $meio_pagamento = $transacao_dados->transacao->meio_pagamento;
+ $codigo_meio_pagamento = $code_payment;
+ $forma_pagamento = $this->getPaymentMethod($code_payment);
+ $tipo_pagamento = $this->getNamePaymentByCode($type);
+ $parcela_selecionada = $installmentCount;
+ $transactionCode = $code_transacao;
+ $this->logInfo('plgVmOnPaymentNotification return new_status:' . $novo_status, 'message');
+ // grava os dados de retorno e já troca o status do pedido
+ $this->gravaDadosRetorno($method, $novo_status, $mensagem,'',$tipo_pagamento,$forma_pagamento,$parcela_selecionada);
+ // não atualiza o pedido para transação concluÃda
+ if ($status != 4) {
+ $this->trocaStatusPedidoPagseguroAPI($transactionCode, $novo_status, $mensagem, $method, $order_number);
+ }
+ $this->emptyCart($return_context);
+
+ }
+ die('ok');
+ }
+
+ }
+
+ /**
+ * plgVmOnPaymentResponseReceived
+ * This event is fired when the method returns to the shop after the transaction
+ *
+ * the method itself should send in the URL the parameters needed
+ * NOTE for Plugin developers:
+ * If the plugin is NOT actually executed (not the selected payment method), this method must return NULL
+ *
+ * @param int $virtuemart_order_id : should return the virtuemart_order_id
+ * @param text $html: the html to display
+ * @return mixed Null when this method was not selected, otherwise the true or false
+ *
+ * @author Valerie Isaksen
+ *
+ *
+ * function plgVmOnPaymentResponseReceived(, &$virtuemart_order_id, &$html) {
+ * return null;
+ * }
+ */
+ function plgVmOnPaymentResponseReceived(&$html='') {
+ // recibo da transação do Pagseguro
+ if (!class_exists('VirtueMartCart'))
+ require(JPATH_VM_SITE . DS . 'helpers' . DS . 'cart.php');
+ if (!class_exists('shopFunctionsF'))
+ require(JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php');
+ if (!class_exists('VirtueMartModelOrders'))
+ require( JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php' );
+ $pagsegurotransparente_data = JRequest::get('post');
+ vmdebug('PAGSEGUROTRANSPARENTE plgVmOnPaymentResponseReceived', $pagsegurotransparente_data);
+ // the payment itself should send the parameter needed.
+ $virtuemart_paymentmethod_id = JRequest::getInt('pm', 0);
+
+ if (!($method = $this->getVmPluginMethod($virtuemart_paymentmethod_id))) {
+ return null; // Another method was selected, do nothing
+ }
+ if (!$this->selectedThisElement($method->payment_element)) {
+ return null;
+ }
+ $order_number = JRequest::getString('on', 0);
+ $vendorId = 0;
+ if (!($virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber($order_number) )) {
+ return null;
+ }
+ if (!($paymentTable = $this->getDataByOrderId($virtuemart_order_id) )) {
+ // JError::raiseWarning(500, $db->getErrorMsg());
+ return '';
+ }
+ $payment_name = $this->renderPluginName($method);
+ $modelOrder = VmModel::getModel('orders');
+ $orderdetails = $modelOrder->getOrder($virtuemart_order_id);
+ $html = $this->_getPaymentResponseHtml($paymentTable, $payment_name, $orderdetails['details'], $method);
+ $cart = VirtueMartCart::getCart();
+ $cart->emptyCart();
+ }
+
+ function _getPaymentResponseHtml($pagsegurotransparenteTable, $payment_name, $orderDetails=null, $method=null) {
+ $html = '' . "\n";
+ $html .= $this->getHtmlRowBE('PAGSEGUROTRANSPARENTE_PAYMENT_NAME', $payment_name);
+ $task = JRequest::getVar('task','');
+ $img_pagamentos = array();
+ /*
+ $img_pagamentos['BoletoBancario - Boleto Bancário'] = 'boleto_bancario.jpg';
+ $img_pagamentos['DebitoBancario - Bradesco'] = 'bradesco_debito.jpg';
+ $img_pagamentos['DebitoBancario - BancoDoBrasil'] = 'bb_debito.jpg';
+ $img_pagamentos['DebitoBancario - Banrisul'] = 'banrisul_debito.jpg';
+ $img_pagamentos['DebitoBancario - Itau'] = 'itau_debito.jpg';
+ */
+ if ($task == 'pluginresponsereceived') {
+ JFactory::getApplication()->enqueueMessage(
+ JText::_('VMPAYMENT_PAGSEGUROTRANSPARENTE_CHECK_TRANSACTION')
+ );
+ $link_pedido = JROUTE::_(JURI::root() . 'index.php?option=com_virtuemart&view=orders&layout=details&order_number='.$pagsegurotransparenteTable->order_number.'&order_pass='.$orderDetails['BT']->order_pass);
+ if (!empty($pagsegurotransparenteTable)) {
+ $html .= $this->getHtmlRowBE('PAGSEGUROTRANSPARENTE_ORDER_NUMBER', $pagsegurotransparenteTable->order_number);
+ $html .= $this->getHtmlRowBE('PAGSEGUROTRANSPARENTE_PAYMENT_DATE', $pagsegurotransparenteTable->modified_on);
+ $html .= ' ';
+ if ($pagsegurotransparenteTable->transactionCode) {
+ $html .= $this->getHtmlRowBE('PAGSEGUROTRANSPARENTE_CODIGO_PAGSEGUROTRANSPARENTE',''.$pagsegurotransparenteTable->transactionCode.' ');
+ }
+ $pagsegurotransparente_status = 'Transação em Andamento ';
+ if ($pagsegurotransparenteTable->msg_status) {
+ //$pagsegurotransparente_status = ''.$pagsegurotransparenteTable->status. " - " . $pagsegurotransparenteTable->msg_status.' ';
+ $pagsegurotransparente_status = 'Transação: '. $pagsegurotransparenteTable->msg_status.' ';
+ }
+ if ($orderDetails['BT']->order_status == $method->transacao_em_andamento and $pagsegurotransparenteTable->url_redirecionar != '') {
+ //$url_imagem = JURI::root().DS.'plugins'.DS.'vmpayment'.DS.'pagsegurotransparente'.DS.'imagens'.DS;
+ //$url_imagem .= $img_pagamentos[$pagsegurotransparenteTable->type_transaction];
+ //$imagem_redirecionar = ' ';
+ if (!empty($pagsegurotransparenteTable->url_redirecionar)) {
+ $pagsegurotransparente_status .= '';
+ }
+ }
+ $html .= $this->getHtmlRowBE('PAGSEGUROTRANSPARENTE_STATUS', $pagsegurotransparente_status);
+ $html .= ' ';
+ $html .= $this->getHtmlRowBE('PAGSEGUROTRANSPARENTE_AMOUNT', $pagsegurotransparenteTable->payment_order_total. " " . $pagsegurotransparenteTable->payment_currency);
+ $html .= $this->getHtmlRowBE('PAGSEGUROTRANSPARENTE_TYPE_TRANSACTION', $pagsegurotransparenteTable->type_transaction);
+ $html .= $this->getHtmlRowBE('PAGSEGUROTRANSPARENTE_LOG', $pagsegurotransparenteTable->log);
+ $html .= '
' . "\n";
+ $html .= ' ';
+ $tmpl = JRequest::getVar('tmpl');
+ if ($tmpl != 'component') {
+ $html .= ''.JText::_('VMPAYMENT_PAGSEGUROTRANSPARENTE_ORDER_DETAILS').'
+ ' . "\n";
+ }
+ }
+ } else {
+ $html .= $this->getHtmlRowBE('PAGSEGUROTRANSPARENTE_ORDER_NUMBER', $this->order_id);
+ }
+ $html .= '' . "\n";
+ return $html;
+ }
+
+ function plgVmOnUserPaymentCancel() {
+ if (!class_exists('VirtueMartModelOrders'))
+ require( JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php' );
+ $order_number = JRequest::getVar('on');
+ if (!$order_number)
+ return false;
+ $db = JFactory::getDBO();
+ $query = 'SELECT ' . $this->_tablename . '.`virtuemart_order_id` FROM ' . $this->_tablename . " WHERE `order_number`= '" . $order_number . "'";
+ $db->setQuery($query);
+ $virtuemart_order_id = $db->loadResult();
+ if (!$virtuemart_order_id) {
+ return null;
+ }
+ $this->handlePaymentUserCancel($virtuemart_order_id);
+ return true;
+ }
+
+ public function getPaymentMethod($codigo){
+ // cartão de crédito
+ $arr_method_payments[101] = 'Visa';
+ $arr_method_payments[102] = 'MasterCard';
+ $arr_method_payments[103] = 'American Express';
+ $arr_method_payments[104] = 'Diners';
+ $arr_method_payments[105] = 'Hipercard';
+ $arr_method_payments[106] = 'Aura';
+ $arr_method_payments[107] = 'Elo';
+ $arr_method_payments[108] = 'PLENOCard';
+ $arr_method_payments[109] = 'PersonalCard';
+ $arr_method_payments[110] = 'JCB';
+ $arr_method_payments[111] = 'Discover';
+ $arr_method_payments[112] = 'BrasilCard';
+ $arr_method_payments[113] = 'FORTBRASIL';
+ $arr_method_payments[114] = 'CARDBAN';
+ $arr_method_payments[115] = 'VALECARD';
+ $arr_method_payments[116] = 'Cabal';
+ $arr_method_payments[117] = 'Mais!';
+ $arr_method_payments[118] = 'Avista';
+ $arr_method_payments[119] = 'GRANDCARD';
+ $arr_method_payments[120] = 'Sorocred';
+ // boleto bancário
+ $arr_method_payments[201] = 'Bradesco';
+ $arr_method_payments[202] = 'Santander';
+ // débito
+ $arr_method_payments[301] = 'Débito online Bradesco';
+ $arr_method_payments[302] = 'Débito online Itaú';
+ $arr_method_payments[303] = 'Débito online Unibanco';
+ $arr_method_payments[304] = 'Débito online Banco do Brasil';
+ $arr_method_payments[305] = 'Débito online Banco Real';
+ $arr_method_payments[306] = 'Débito online Banrisul';
+ $arr_method_payments[307] = 'Débito online HSBC';
+ // saldo
+ $arr_method_payments[401] = 'Saldo PagSeguro';
+ // oi paggo
+ $arr_method_payments[501] = 'Oi Paggo';
+ // deposito
+ $arr_method_payments[701] = 'Depósito em conta - Banco do Brasil';
+ $arr_method_payments[702] = 'Depósito em conta - HSBC';
+ return $arr_method_payments[$codigo];
+ }
+ public function getNamePaymentByCode($codigo) {
+ $arr_method_payments[1] = 'CartaodeCredito';
+ $arr_method_payments[2] = 'BoletoBancario';
+ $arr_method_payments[3] = 'DebitoBancario';
+ $arr_method_payments[4] = 'SaldoPagseguro';
+ $arr_method_payments[5] = 'OiPaggo';
+ $arr_method_payments[7] = 'DepositoemConta';
+ return $arr_method_payments[$codigo];
+ }
+ public function getCreditCard() {
+ $arr_cartao = array();
+ $holder = JRequest::getVar('c_holder');
+ $number = JRequest::getVar('c_number');
+ $securityCode = JRequest::getVar('c_securityCode');
+ $expiry_date = $this->getExpiryDate(JRequest::getVar('c_expiry_date'));
+ $arr_cartao['holder'] = $holder;
+ $arr_cartao['number'] = $number;
+ $arr_cartao['securityCode'] = $securityCode;
+ $arr_cartao['maturityMonth']= $expiry_date['maturityMonth'];
+ $arr_cartao['maturityYear'] = '20'.$expiry_date['maturityYear'];
+ return $arr_cartao;
+ }
+ public function getExpiryDate($data) {
+ $arr_data = explode('/',$data);
+ $return_data['maturityMonth'] = $arr_data[0];
+ $return_data['maturityYear'] = $arr_data[1];
+ return $return_data;
+ }
+ public function getShipmentName($orderdetails) {
+ $shipmentmethods = VmModel::getModel('shipmentmethod');
+ $data_shipment = $shipmentmethods->getTable('shipmentmethods');
+ $data_shipment->load($orderdetails->virtuemart_shipmentmethod_id);
+ if (isset($data_shipment)) {
+ return $data_shipment->shipment_name;
+ } else {
+ return '';
+ }
+ }
+ public function getStateName($state_id) {
+ $state = VmModel::getModel('state');
+ $data_state = $state->getTable('states');
+ $data_state->load($state_id);
+ if (isset($data_state)) {
+ return $data_state->state_2_code;
+ } else {
+ return '';
+ }
+ }
+ public function getParcelas() {
+ $parcelas = JRequest::getVar('parcela_selecionada',1);
+ return $parcelas;
+ }
+ public function getTransactionKey($orderdetails) {
+ return '';
+ }
+ public function getToken($method) {
+ if ($method->modo_teste) {
+ $token = $method->token_teste;
+ } else {
+ $token = $method->token;
+ }
+ return $token;
+
+ }
+ public function getSellerEmail($method) {
+ if ($method->modo_teste) {
+ $sellerMail = $method->sellermail_teste;
+ } else {
+ $sellerMail = $method->sellermail;
+ }
+ return $sellerMail;
+
+ }
+ public function getConsumerKey($method) {
+ if ($method->modo_teste) {
+ $consumerKey = $method->oauth_consumer_key_teste;
+ } else {
+ $consumerKey = $method->oauth_consumer_key;
+ }
+ return $consumerKey;
+ }
+ public function getUrlWsPagseguro($method) {
+ if ($method->modo_teste) {
+ return 'https://ws.sandbox.pagseguro.uol.com.br';
+ } else {
+ return 'https://ws.pagseguro.uol.com.br';
+ }
+ }
+ public function getUrlJsPagseguro($method) {
+ if ($method->modo_teste) {
+ return 'https://stc.sandbox.pagseguro.uol.com.br';
+ } else {
+ return 'https://stc.pagseguro.uol.com.br';
+ }
+ }
+ public function createTransaction() {
+ // retorno da transação
+ $arr_retorno = array();
+ if (!class_exists('VirtueMartModelOrders')) {
+ require( JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php' );
+ }
+ $order_number = JRequest::getVar('order_number');
+ $virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber($order_number);
+ if (!$virtuemart_order_id) {
+ $arr_retorno['msg'] = 'Erro ao recuperar o id do pedido ao redirecionar';
+ $arr_retorno['erro'] = 'true';
+ }
+ $vendorId = 0;
+ $payment = $this->getDataByOrderId($virtuemart_order_id);
+ if($payment->payment_name == '') {
+ $arr_retorno['msg'] = 'Método de pagamento não encontrado';
+ $arr_retorno['erro'] = 'true';
+ }
+ // recupera as informações do método de pagamento
+ $virtuemart_paymentmethod_id = ($payment->virtuemart_paymentmethod_id)?$payment->virtuemart_paymentmethod_id:$pm;
+ $method = $this->getVmPluginMethod($virtuemart_paymentmethod_id);
+ // carregando pedido manualmente
+ $order = VirtueMartModelOrders::getOrder($virtuemart_order_id);
+ // cria a transação com o Pagseguro
+ $time = time()*1000;
+ $microtime = microtime();
+ $rand = mt_rand();
+ $charset = 'UTF-8';
+ // dados do pagseguro ( configuração )
+ $sellerMail = $this->getSellerEmail($method);
+ $token_pagseguro= $this->getToken($method);
+ $token_compra = JRequest::getVar('token_compra');
+ $forma_pagamento= JRequest::getVar('forma_pagamento');
+ $tipo_pagamento = JRequest::getVar('tipo_pagamento');
+ $senderHash = JRequest::getVar('senderHash');
+ // $numero_metodo_pagamento = $this->getPaymentMethod($forma_pagamento, $tipo_pagamento);
+ // if ($numero_metodo_pagamento) {
+ $json_pedido = array();
+ // dados do pedido
+ $json_pedido['email'] = $sellerMail;
+ $json_pedido['token'] = $token_pagseguro;
+ $json_pedido['paymentMode'] = 'default';
+ $json_pedido['receiverEmail'] = $this->getSellerEmail($method);
+ $json_pedido['currency'] = 'BRL';
+ $total_tax = $order['details']['BT']->order_tax;
+
+ // desconto e tarifa no mesmo campo
+ if (!empty($order["details"]["BT"]->coupon_discount)) {
+ // $extraAmount = $total_tax + ( (float)$order["details"]["BT"]->coupon_discount * -1);
+ $extraAmount = ( (float)$order["details"]["BT"]->coupon_discount );
+ } else {
+ // $extraAmount = $total_tax;
+ $extraAmount = 0;
+ }
+
+ // adiciona a tarifa do método de pagamento
+ if (!empty($order["details"]["BT"]->order_payment)) {
+ $extraAmount += $order["details"]["BT"]->order_payment;
+ }
+
+ $json_pedido['extraAmount'] = number_format(round($extraAmount,2),2,'.','');
+ $i = 1;
+ foreach ($order['items'] as $chave => $produto) {
+ $json_pedido['itemId'.$i] = ($produto->order_item_sku!='')?$produto->order_item_sku:$produto->virtuemart_product_id;
+ $json_pedido['itemDescription'.$i] = substr($produto->order_item_name,0,100);
+ $json_pedido['itemAmount'.$i] = number_format(round($produto->product_final_price,2),2,'.','');
+ $json_pedido['itemQuantity'.$i] = $produto->product_quantity;
+ $i++;
+ }
+ $url_notificacao = str_replace('https://','http://',JROUTE::_(JURI::root() . 'index.php?option=com_virtuemart&view=pluginresponse&task=pluginnotification&tmpl=component&pm='.$order['details']['BT']->virtuemart_paymentmethod_id));
+ $json_pedido['notificationURL'] = $url_notificacao;
+ $order_number = JRequest::getVar('order_number');
+ $json_pedido['reference'] = $order_number;
+ // campo cpf
+ $campo_cpf = $method->campo_cpf;
+ $campo_cep = $method->campo_cep;
+ // cnpj
+ $campo_cnpj = $method->campo_cnpj;
+ $campo_numero = $method->campo_numero;
+ $campo_bairro = $method->campo_bairro;
+ $campo_complemento = $method->campo_complemento;
+ $campo_data_nascimento = $method->campo_data_nascimento;
+ $bt_comprador = $order['details']['BT'];
+ if (isset($order['details']['ST'])) {
+ $st_comprador = $order['details']['ST'];
+ } else {
+ $st_comprador = $bt_comprador;
+ }
+
+ $campo_nome = $method->campo_nome;
+ $campo_sobrenome = $method->campo_sobrenome;
+ // billing data
+ $json_pedido['senderName'] = $bt_comprador->$campo_nome.' '.$bt_comprador->$campo_sobrenome;
+
+ // cpf do comprador
+ $cpfComprador = $this->formataCPF((isset($bt_comprador->$campo_cpf) and !empty($bt_comprador->$campo_cpf))?$bt_comprador->$campo_cpf:'');
+ if (empty($cpfComprador)) {
+ $cpfComprador = $this->formataCPF(JRequest::getVar('cpf'));
+ }
+ if ($method->modo_debug) {
+ print_r($bt_comprador);
+ }
+
+ $json_pedido['senderCPF'] = $cpfComprador;
+
+ if (!empty($campo_cnpj) and $bt_comprador->$campo_cnpj != '') {
+ $cnpjComprador = $this->formataCNPJ($bt_comprador->$campo_cnpj);
+ $json_pedido['senderCNPJ'] = $cnpjComprador;
+ unset($json_pedido['senderCPF']);
+ }
+
+ $phone = $bt_comprador->phone_1;
+
+ $telefone = preg_replace('#[^0-9]#', '', $phone);
+ $json_pedido['senderAreaCode'] = substr($telefone, 0, 2);
+ $json_pedido['senderPhone'] = substr($telefone, 2, 9);
+
+ if ($method->modo_teste) {
+ $json_pedido['senderEmail'] = $method->email_teste;
+ } else {
+ $json_pedido['senderEmail'] = $bt_comprador->email;
+ }
+ $json_pedido['senderHash'] = $senderHash;
+ // shipping address
+ $json_pedido['shippingAddressStreet'] = $st_comprador->address_1;
+ $json_pedido['shippingAddressNumber'] = ((isset($st_comprador->$campo_numero) and !empty($st_comprador->$campo_numero))?$st_comprador->$campo_numero:'');
+ $json_pedido['shippingAddressComplement'] = ((isset($st_comprador->$campo_complemento) and !empty($st_comprador->$campo_complemento))?$st_comprador->$campo_complemento:'');
+ $json_pedido['shippingAddressDistrict'] = ((isset($st_comprador->$campo_bairro) and !empty($st_comprador->$campo_bairro))?$st_comprador->$campo_bairro:'');
+ $json_pedido['shippingAddressPostalCode'] = str_replace('-','',$st_comprador->$campo_cep);
+ $json_pedido['shippingAddressCity'] = $st_comprador->city;
+ $json_pedido['shippingAddressState'] = $this->getStateName($st_comprador->virtuemart_state_id);
+ $json_pedido['shippingAddressCountry'] = 'BRA';
+ // shipping
+ $json_pedido['shippingType'] = '3'; // outros
+ if (isset($order['details']['BT']->order_shipping)){
+ $json_pedido['shippingCost'] = number_format(round($order['details']['BT']->order_shipping,2),2,'.','');
+ } elseif (isset($order['details']['BT']->order_shipment)){
+ $json_pedido['shippingCost'] = number_format(round($order['details']['BT']->order_shipment,2),2,'.','');
+ } else {
+ $json_pedido['shippingCost'] = 0;
+ }
+ // cartão de crédito
+ $json_pedido['creditCardToken'] = $token_compra;
+ $parcelas_compra = $this->getParcelas();
+ $json_pedido['installmentQuantity'] = $parcelas_compra;
+ $valor_parcela = JRequest::getVar('valor_parcela','');
+ if (!empty($valor_parcela)) {
+ $json_pedido['installmentValue'] = number_format(round($valor_parcela,2),2,'.','');
+ } else {
+ if ($json_pedido['installmentQuantity'] == 1) {
+ // $json_pedido['installmentValue'] = number_format($valor_parcela,2,'.','');
+ $json_pedido['installmentValue'] = number_format(round($order['details']['BT']->order_total,2),2,'.','');
+ } else {
+ /*
+ -- método antigo de calcular a parcela
+ // calcular as parcelas
+ $order_total = $order['details']['BT']->order_total;
+ // $total_parcela = round($order_total / $parcelas_compra,2);
+ if ($parcelas_compra <= $method->max_parcela_sem_juros) {
+ $total_parcela = round($order_total / $parcelas_compra,2);
+ // $json_pedido['noInterestInstallmentQuantity'] = $method->max_parcela_sem_juros;
+ $json_pedido['noInterestInstallmentQuantity'] = $parcelas_compra;
+ } else {
+ $tipo_parcelamento_juros = true; // com juros
+ $total_parcela = round($this->calculaParcelaPRICE($order_total,$parcelas_compra,$method->taxa_parcelado),2);
+ }
+ $json_pedido['installmentValue'] = number_format($total_parcela,2,'.','');
+ */
+ }
+ }
+ if ($method->max_parcela_sem_juros > 1) {
+ $json_pedido['noInterestInstallmentQuantity'] = $method->max_parcela_sem_juros;
+ }
+
+ // billing address
+ $json_pedido['billingAddressStreet'] = $bt_comprador->address_1;
+ $json_pedido['billingAddressNumber'] = ((isset($bt_comprador->$campo_numero) and !empty($bt_comprador->$campo_numero))?$bt_comprador->$campo_numero:'');
+ $json_pedido['billingAddressComplement'] = ((isset($bt_comprador->$campo_complemento) and !empty($bt_comprador->$campo_complemento))?$bt_comprador->$campo_complemento:'');
+ $json_pedido['billingAddressDistrict'] = ((isset($bt_comprador->$campo_bairro) and !empty($bt_comprador->$campo_bairro))?$bt_comprador->$campo_bairro:'');
+ $json_pedido['billingAddressPostalCode'] = str_replace('-','',$bt_comprador->$campo_cep);
+ $json_pedido['billingAddressCity'] = $bt_comprador->city;
+ $json_pedido['billingAddressState'] = $this->getStateName($bt_comprador->virtuemart_state_id);
+ $json_pedido['billingAddressCountry'] = 'BRA';
+ // recupera a url de retorno
+ $json_pedido['notificationURL'] = JROUTE::_(JURI::root().'index.php?option=com_virtuemart&view=pluginresponse&task=pluginnotification&order_number='.$order['details']['BT']->order_number.'&pm='. $order['details']['BT']->virtuemart_paymentmethod_id);
+ // $json_pedido['urlReturn'] = JROUTE::_(JURI::root().'index.php?option=com_virtuemart&view=pluginresponse&task=pluginresponsereceived&pm='. $order['details']['BT']->virtuemart_paymentmethod_id);
+ if ($forma_pagamento == 'CartaodeCredito') {
+ // sempre pega o do formulário
+ $cpf_form = JRequest::getVar('c_cpf');
+ $json_pedido['senderCPF'] = $this->formataCPF($cpf_form);
+ $c_holder = JRequest::getVar('c_holder');
+ $c_cpf = $this->formataCPF($cpf_form);
+ $c_phone = JRequest::getVar('c_phone');
+ $c_birthdate = JRequest::getVar('c_birthdate');
+ // $birthDate = $this->formataData(((isset($bt_comprador->$campo_data_nascimento) and !empty($bt_comprador->$campo_data_nascimento))?$bt_comprador->$campo_data_nascimento:''));
+ $birthDate = $this->formataData($c_birthdate);
+ $json_pedido['paymentMethod'] = 'creditCard';
+ $json_pedido['creditCardHolderName'] = $c_holder;
+ $json_pedido['creditCardHolderCPF'] = $c_cpf;
+ $json_pedido['creditCardHolderBirthDate']= $birthDate;
+ $telefone = preg_replace('#[^0-9]#', '', $c_phone);
+ $json_pedido['creditCardHolderAreaCode']= substr($telefone, 0, 2);
+ $json_pedido['creditCardHolderPhone'] = substr($telefone, 2, 9);
+ } elseif ($forma_pagamento == 'BoletoBancario') {
+ $json_pedido['paymentMethod'] = 'boleto';
+ } elseif ($forma_pagamento == 'DebitoBancario') {
+ $json_pedido['paymentMethod'] = 'eft';
+ $json_pedido['bankName'] = $tipo_pagamento;
+ } else {
+ return false;
+ }
+ foreach ($json_pedido as $chave => $valor) {
+ $json_pedido[$chave] = utf8_decode($valor);
+ }
+ if ($method->modo_debug) {
+ print_r($json_pedido);
+ // die();
+ }
+ // url webservice
+ $url_ws = $this->getUrlWsPagseguro($method);
+ $urlPost = $url_ws."/v2/transactions";
+ ob_start();
+ $ch = curl_init();
+ curl_setopt($ch, CURLOPT_URL, $urlPost);
+ curl_setopt($ch, CURLOPT_POST, 1);
+ curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($json_pedido, '', '&'));
+ // curl_setopt($ch, CURLOPT_HTTPHEADER, $oAuth);
+ curl_setopt($ch, CURLOPT_ENCODING ,"");
+ //Por default o CURL requer um ambiente SSL, durante testes/desenvolvimento ou caso não possua o protocolo de segurança, pode-se evitar a verificação SSL do CURL através das duas lonhas abaixo:
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
+ curl_exec($ch);
+ $resposta = ob_get_contents();
+ ob_end_clean();
+ $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
+ curl_close($ch);
+ /**
+ * 200 Informação processada com sucesso
+ * 400 Requisição com parâmetros obrigatórios vazios ou inválidos
+ * 401 Falha na autenticação ou sem acesso para usar o serviço
+ * 405 Método não permitido, o serviço suporta apenas POST
+ * 415 Content-Type não suportado
+ * 500 Erro fatal na aplicação, executar a solicitação mais tarde
+ * 503 Serviço está indisponÃvel
+ **/
+
+ $xml = new DomDocument();
+ $dom = $xml->loadXML($resposta);
+ if ($method->modo_debug) {
+ print_r($resposta);
+ die();
+ }
+ $arr_retorno['erro'] = 'true';
+ if ($httpCode == "200") {
+ $arr_retorno['erro'] = 'false';
+ $json_array = array();
+ // código da transação
+ $json_array['code'] = $xml->getElementsByTagName("code")->item(0)->nodeValue;
+ $json_array['date'] = $xml->getElementsByTagName("date")->item(0)->nodeValue;
+ $json_array['lastEventDate'] = $xml->getElementsByTagName("lastEventDate")->item(0)->nodeValue;
+ $json_array['reference'] = $xml->getElementsByTagName("reference")->item(0)->nodeValue;
+ $json_array['type'] = $xml->getElementsByTagName("type")->item(0)->nodeValue;
+ $json_array['cancellationSource'] = $xml->getElementsByTagName("cancellationSource")->item(0)->nodeValue;
+ $json_array['paymentLink'] = $xml->getElementsByTagName("paymentLink")->item(0)->nodeValue;
+ /*
+ 1 Aguardando pagamento: o comprador iniciou a transação, mas até o momento o PagSeguro não recebeu nenhuma informação sobre o pagamento.
+ 2 Em análise: o comprador optou por pagar com um cartão de crédito e o PagSeguro está analisando o risco da transação.
+ 3 Paga: a transação foi paga pelo comprador e o PagSeguro já recebeu uma confirmação da instituição financeira responsável pelo processamento.
+ 4 DisponÃvel: a transação foi paga e chegou ao final de seu prazo de liberação sem ter sido retornada e sem que haja nenhuma disputa aberta.
+ 5 Em disputa: o comprador, dentro do prazo de liberação da transação, abriu uma disputa.
+ 6 Devolvida: o valor da transação foi devolvido para o comprador.
+ 7 Cancelada: a transação foi cancelada sem ter sido finalizada.
+ */
+ $json_array['status'] = $xml->getElementsByTagName("status")->item(0)->nodeValue;
+ $status_pagamento = $this->getStatusPagamentoPagseguroRetorno($method, $json_array['status']);
+ $json_array['status_pedido'] = $status_pagamento[0];
+ $json_array['descriptionStatus'] = $status_pagamento[1];
+ $json_resposta = json_encode($json_array);
+ $arr_retorno['msg'] = $json_array;
+ } else {
+ //$arr_retorno['msg'] = 'Requisição com parâmetros obrigatórios vazios ou inválidos';
+ $errors = $xml->getElementsByTagName("errors");
+ $errors_list = array();
+ if ($errors->length >= 1) {
+ foreach( $errors as $erro ) {
+ $code = $erro->getElementsByTagName("code")->item(0)->nodeValue;
+ $message = $erro->getElementsByTagName("message")->item(0)->nodeValue;
+ $errors_list[$code] = $message;
+ }
+ }
+ // se não tiver vindo nada do PagSeguro
+ if (count($errors_list) == 0) {
+ $errors_list[$httpCode] = "Erro interno";
+ }
+ //$json_errors = json_encode($errors_list);
+ $arr_retorno['msg'] = $errors_list;
+ $arr_retorno['erro'] = 'true';
+ $arr_retorno['tipo'] = $httpCode;
+ }
+ // $arr_retorno['msg'] = $json_resposta;
+ // } else {
+ // $arr_retorno['msg'] = 'Erro ao capturar o método de pagamento';
+ // $arr_retorno['erro'] = 'true';
+ // //$resposta = 'Erro ao capturar o método de pagamento';
+ // }
+ return $arr_retorno;
+ }
+ public function getValidCreditCard($number) {
+ $odd = true;
+ $sum = 0;
+ foreach ( array_reverse(str_split($number)) as $num) {
+ $sum += array_sum( str_split(($odd = !$odd) ? $num*2 : $num) );
+ }
+ if (($sum % 10 == 0) && ($sum != 0) && (($sum/10) > 0)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ public function redirecionaPedido($mensagem, $tipo='message',$email=1) {
+ $url_pedido = JROUTE::_(JURI::root() . 'index.php?option=com_virtuemart&view=orders&layout=details&order_number='.$this->order_number);
+ // formata a mensagem
+ $msg = "TRANSAÇÃO Pagseguro N. ".$this->transactionCode." ".$mensagem;
+ if ($email) {
+ $msg .= " Verifique em seu e-mail o extrato desta transação.";
+ }
+ $app = JFactory::getApplication();
+ $app->redirect($url_pedido, $msg, $tipo);
+ }
+ /**
+ * Calcula as parcelas do crédito
+ */
+ public function calculaParcelasCredito( $method, $order_total, $id, $numero_parcelas=null ) {
+ $conteudo = "";
+ /*
+ $parcelas_juros = 1;
+ $paymentCurrency = CurrencyDisplay::getInstance($method->payment_currency);
+ if (is_null($numero_parcelas)) {
+ $limite_sem_juros = $method->max_parcela_sem_juros;
+ } else {
+ $limite_sem_juros = $numero_parcelas;
+ }
+ if (!empty($limite_sem_juros)) {
+ for ($i=1; $i<=$limite_sem_juros; $i++) {
+ $valor_parcela = $order_total / $i;
+ $parcelas_juros ++;
+ // caso o valor da parcela seja menor do que o permitido, não a exibe
+ if (($valor_parcela < $method->valor_minimo or $valor_parcela < 5) and $i != 1) {
+ continue;
+ }
+ //$valor_formatado_credito = 'R$ '.number_format($valor_parcela,2,',','.');
+ $valor_formatado_credito = $paymentCurrency->priceDisplay($valor_parcela,$paymentCurrency->payment_currency);
+
+ // novo tipo de formatação de preço
+ // $conteudo .= '
'.$i.' x '.$valor_formatado_credito.' sem juros
';
+ $conteudo .= '
'.$i.' x
';
+ if ($method->max_parcela_com_juros == $i) {
+ break;
+ }
+ }
+ }
+ if (is_null($numero_parcelas)) {
+ $limite_parcelamento = $method->max_parcela_com_juros;
+ } else {
+ $limite_parcelamento = $numero_parcelas;
+ }
+
+ $asterisco = false;
+ for($i=$parcelas_juros; $i<=$limite_parcelamento; $i++) {
+ // verifica se o juros será para o emissor ou para o comprador
+ // caso o valor da parcela seja menor do que o permitransactionCodeo, não a exibe
+ if (($valor_parcela < $method->valor_minimo or $valor_parcela < 5) and $i != 1) {
+ continue;
+ }
+
+ if ($i==1) {
+ $valor_parcela = $order_total * (1+$method->taxa_credito); // calcula o valor da parcela
+ } else {
+ $valor_parcela = $this->calculaParcelaPRICE($order_total,$i,$method->taxa_parcelado);
+ $asterisco = true;
+ }
+ $valor_formatado_credito = $paymentCurrency->priceDisplay($valor_parcela,$paymentCurrency->payment_currency);
+
+ // $conteudo .= '
'.$i.' x '.$valor_formatado_credito.' *
';
+ $conteudo .= '
'.$i.' x
';
+ if ($limite_parcelamento == $i) {
+ break;
+ }
+ }
+ */
+
+ $parcelas_juros = 1;
+ $paymentCurrency = CurrencyDisplay::getInstance($method->payment_currency);
+ if (is_null($numero_parcelas)) {
+ $limite_sem_juros = $method->max_parcela_sem_juros;
+ } else {
+ $limite_sem_juros = $numero_parcelas;
+ }
+ $conteudo .= "
";
+ if (!empty($limite_sem_juros)) {
+ for ($i=1; $i<=$limite_sem_juros; $i++) {
+ $valor_parcela = $order_total / $i;
+ $parcelas_juros ++;
+ // caso o valor da parcela seja menor do que o permitido, não a exibe
+ if (($valor_parcela < $method->valor_minimo or $valor_parcela < 5) and $i != 1) {
+ continue;
+ }
+ //$valor_formatado_credito = 'R$ '.number_format($valor_parcela,2,',','.');
+ $valor_formatado_credito = $paymentCurrency->priceDisplay($valor_parcela,$paymentCurrency->payment_currency);
+
+ // novo tipo de formatação de preço
+ // $conteudo .= ' '.$i.' x '.$valor_formatado_credito.' sem juros
';
+ $conteudo .= ''.$i.' x ';
+ if ($method->max_parcela_com_juros == $i) {
+ break;
+ }
+ }
+ }
+ if (is_null($numero_parcelas)) {
+ $limite_parcelamento = $method->max_parcela_com_juros;
+ } else {
+ $limite_parcelamento = $numero_parcelas;
+ }
+
+ $asterisco = false;
+ for($i=$parcelas_juros; $i<=$limite_parcelamento; $i++) {
+ // verifica se o juros será para o emissor ou para o comprador
+ // caso o valor da parcela seja menor do que o permitransactionCodeo, não a exibe
+ if (($valor_parcela < $method->valor_minimo or $valor_parcela < 5) and $i != 1) {
+ continue;
+ }
+
+ if ($i==1) {
+ $valor_parcela = $order_total * (1+$method->taxa_credito); // calcula o valor da parcela
+ } else {
+ $valor_parcela = $this->calculaParcelaPRICE($order_total,$i,$method->taxa_parcelado);
+ $asterisco = true;
+ }
+ $valor_formatado_credito = $paymentCurrency->priceDisplay($valor_parcela,$paymentCurrency->payment_currency);
+
+ // $conteudo .= ' '.$i.' x '.$valor_formatado_credito.' *
';
+ // $conteudo .= ' '.$i.' x
';
+ $conteudo .= ''.$i.' x ';
+ if ($limite_parcelamento == $i) {
+ break;
+ }
+ }
+ $conteudo .= " ";
+ if ($asterisco) {
+ $conteudo .= "
* Valores sujeitos à alteração ao efetuar o pagamento via Cartão (".$method->taxa_parcelado."% a.m.).
";
+ }
+ $conteudo .= '
';
+ return $conteudo;
+ }
+
+ /**
+ * Calcula as parcelas do crédito
+ */
+ public function calculaParcelasDebitoBoleto( $method, $order_total, $id, $numero_parcelas=1 ) {
+ $conteudo = "";
+ $paymentCurrency = CurrencyDisplay::getInstance($method->payment_currency);
+ $valor_formatado_debito = $paymentCurrency->priceDisplay($order_total,$paymentCurrency->payment_currency);
+ $conteudo .= '
+ Valor : 1 x '.$valor_formatado_debito.'
+
';
+ return $conteudo;
+ }
+
+ public function calculaParcelaPRICE($Valor, $Parcelas, $Juros) {
+ $Juros = bcdiv($Juros,100,15);
+ $E=1.0;
+ $cont=1.0;
+ for($k=1;$k<=$Parcelas;$k++) {
+ $cont= bcmul($cont,bcadd($Juros,1,15),15);
+ $E=bcadd($E,$cont,15);
+ }
+ $E=bcsub($E,$cont,15);
+ $Valor = bcmul($Valor,$cont,15);
+ return round(bcdiv($Valor,$E,15),2);
+ }
+
+ // recupera o transactionCode com base no numero do pedido
+ public function recuperaCodigoPagsegurotransparente($order_number) {
+ $db = JFactory::getDBO();
+ $query = 'SELECT ' . $this->_tablename . '.`transactionCode` FROM ' . $this->_tablename . " WHERE `order_number`= '" . $order_number . "'";
+ $db->setQuery($query);
+ $this->transactionCode = $db->loadResult();
+ }
+
+ // reformata o valor que vem do servidor da Pagsegurotransparente
+ public function reformataValor($valor) {
+ $valor = substr($valor,0,strlen($valor)-2).'.'.substr($valor,-2);
+ return $valor;
+ }
+
+ public function formataData($valor,$formato="d/m/Y") {
+ if (!empty($valor) and $valor != 'null') {
+ return date($formato, strtotime($valor));
+ } else {
+ return '';
+ }
+ }
+
+ public function formataTelefone($telefone) {
+ return str_replace(array('(',')',' ','-'),array('','','',''),$telefone);
+ }
+
+ public function formataCPF($cpf) {
+ return str_replace(array('.','-'),array('',''),$cpf);
+ }
+
+ public function formataCNPJ($cpf) {
+ return str_replace(array('.','-','/'),array('','',''),$cpf);
+ }
+
+ public function trataRetornoSucessoPagseguro($retorno, $method) {
+ // código da transação
+ $this->transactionCode = $retorno['code'];
+ $this->order_number = $retorno['reference'];
+
+ // recupera os status de constants
+ $status_pagamento = $retorno['status'];
+ $status_pedido = $retorno['status_pedido'];
+ $mensagem = $retorno['descriptionStatus'];
+
+ $url_redirecionar = '';
+ if (trim($retorno['paymentLink']) != '') {
+ $url_redirecionar = $retorno['paymentLink'];
+ }
+ $tipo_pagamento = JRequest::getVar('tipo_pagamento');
+ $forma_pagamento = JRequest::getVar('forma_pagamento');
+ $parcela_selecionada = JRequest::getVar('parcela_selecionada');
+ $this->gravaDadosRetorno($method, $status_pagamento, $mensagem, $url_redirecionar, $tipo_pagamento, $forma_pagamento, $parcela_selecionada);
+ $this->trocaStatusPedidoPagseguroAPI($this->transactionCode, $status_pedido, $mensagem, $method, $this->order_number);
+ }
+
+ public function trataRetornoFalhaPagseguro($retorno, $method) {
+ $msgs_erro = array();
+ foreach ($retorno as $codigo => $mensagem) {
+ if ($method->modo_teste) {
+ $msgs_erro[] = 'Erro:
'.$codigo." - ".$mensagem."";
+ } else {
+ $msgs_erro[] = 'Erro:
'.$codigo." - ".$this->traduzErro($codigo)."";
+ }
+ }
+ // recupera os status de constants
+ //$this->gravaDadosRetorno($method, $status_pagamento, $mensagem.$msgs_erros);
+ //$this->trocaStatusPedidoPagseguroAPI($this->transactionCode, $status_pagamento, $mensagem, $method, $this->order_number);
+ return $msgs_erro;
+ }
+
+ public function trocaStatusPedidoPagseguroAPI($transactionCode, $status, $mensagem, $method, $order_number) {
+ $virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber($order_number);
+ // recupera as informações do pagamento
+ $db = JFactory::getDBO();
+ $query = 'SELECT *
+ FROM `' . $this->_tablename . '`
+ WHERE order_number = "'.$order_number.'"';
+ $db->setQuery($query);
+ $pagamento = $db->loadObjectList();
+ $type_transaction = $pagamento[0]->type_transaction;
+ // $forma_pagamento = $pagamento[0]->forma_pagamento;
+ $payment_order_total = $pagamento[0]->payment_order_total;
+ $timestamp = date('Y-m-d').'T'.date('H:i:s');
+ $log = $timestamp.'|'.$transactionCode.'|'.$mensagem.'|'.$type_transaction.'|'.$payment_order_total;
+ // notificação do pagamento realizado
+ $notificacao = "
".JText::_('VMPAYMENT_PAGSEGUROTRANSPARENTE_NOTIFY_TRANSACTION')." \n";
+ $notificacao .= JText::_('VMPAYMENT_PAGSEGUROTRANSPARENTE_NOTIFY_CODIGO_PAGSEGUROTRANSPARENTE')." ".$transactionCode."\n";
+ $notificacao .= JText::_('VMPAYMENT_PAGSEGUROTRANSPARENTE_NOTIFY_PEDIDO')." ".$order_number."\n";
+ $notificacao .= "
";
+ $notificacao .= JText::_('VMPAYMENT_PAGSEGUROTRANSPARENTE_NOTIFY_STATUS')."
".(($status==$method->transacao_aprovada)?JText::_('VMPAYMENT_PAGSEGUROTRANSPARENTE_NOTIFY_PAID'):JText::_('VMPAYMENT_PAGSEGUROTRANSPARENTE_NOTIFY_NOTPAID'))." \n";
+ $notificacao .= JText::_('VMPAYMENT_PAGSEGUROTRANSPARENTE_NOTIFY_TYPE_TRANSACTION')."
".$type_transaction." \n";
+ $notificacao .= JText::_('VMPAYMENT_PAGSEGUROTRANSPARENTE_NOTIFY_TYPE_MESSAGE')."
".$mensagem." \n";
+ $notificacao .= JText::_('VMPAYMENT_PAGSEGUROTRANSPARENTE_NOTIFY_ORDER_TOTAL')."
R$ ".number_format($payment_order_total,2,',','.')." \n";
+ $notificacao .= "\n";
+ $notificacao .= JText::_('VMPAYMENT_PAGSEGUROTRANSPARENTE_NOTIFY_AUTHENTICATE')."
Pagseguro ";
+ if ($virtuemart_order_id) {
+ // send the email only if payment has been accepted
+ if (!class_exists('VirtueMartModelOrders'))
+ require( JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php' );
+ $modelOrder = new VirtueMartModelOrders();
+ $orderitems = $modelOrder->getOrder($virtuemart_order_id);
+ $nb_history = count($orderitems['history']);
+ $order = array();
+ $order['order_status'] = $status;
+ $order['virtuemart_order_id'] = $virtuemart_order_id;
+ $order['comments'] = $notificacao;
+ $order['customer_notified'] = 1;
+ $modelOrder->updateStatusForOneOrder($virtuemart_order_id, $order, true);
+ if ($nb_history == 1) {
+ if (!class_exists('shopFunctionsF'))
+ require(JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php');
+ $this->logInfo('Notification, sentOrderConfirmedEmail ' . $order_number. ' '. $order['order_status'], 'message');
+ }
+ }
+
+ // $cart = VirtueMartCart::getCart();
+ // $cart->emptyCart();
+ }
+ private function getStatusPagamentoPagseguroRetorno($method, $codigo) {
+ $status_pagamento = array();
+ $status_pagamento[1] = array($method->transacao_em_andamento,'Aguardando a confirmação de pagamento');
+ $status_pagamento[2] = array($method->transacao_em_analise,'Aguardando aprovação de risco');
+ $status_pagamento[3] = array($method->transacao_aprovada,'Transação Paga');
+ $status_pagamento[4] = array($method->transacao_concluida,'Transação concluÃda');
+ $status_pagamento[5] = array($method->transacao_disputa,'Transação em disputa');
+ $status_pagamento[6] = array($method->transacao_devolvida,'Transação devolvida');
+ $status_pagamento[7] = array($method->transacao_cancelada,'Transação Cancelada');
+ if (isset($status_pagamento[$codigo])) {
+ return $status_pagamento[$codigo];
+ } else {
+ return null;
+ }
+ }
+
+ private function traduzErro($codigo) {
+ $erros = array (
+ "11001"=>"O campo e-mail de configuração é obrigatório.",
+ "11002"=>"Tamanho do e-mail de configuração inválido",
+ "11003"=>"E-mail de configuração inválido.",
+ "11004"=>"A moeda é obritatória.",
+ "11005"=>"Moeda inválida",
+ "11006"=>"Tamanho do campo redirectURL inválido",
+ "11007"=>"Valor inválido para o campo redirectURL",
+ "11008"=>"Tamanho do vampo referência inválido",
+ "11009"=>"Tamanho do campo e-mail inválido",
+ "11010"=>"Valor inválido para o e-mail",
+ "11011"=>"Tamanho do nome inválido",
+ "11012"=>"Valor inválido para o nome",
+ "11013"=>"Valor do código de área inválido",
+ "11014"=>"Valor inválido para o telefone",
+ "11015"=>"Tipo de entrega é obrigatório.",
+ "11016"=>"Valor inválido para o tipo de entrega",
+ "11017"=>"Valor do cep inválido",
+ "11018"=>"Endereço da rua inválido",
+ "11019"=>"Tamanho inválido para o número do endereço",
+ "11020"=>"Tamanho inválido para o complemento do endereço",
+ "11021"=>"Tamanho inválido para o bairro",
+ "11022"=>"Tamanho inválido para a cidade",
+ "11023"=>"Valor inválido para o estado, deve ser no formato SIGLA, ex. 'SP'",
+ "11024"=>"Quantidade de itens inválida.",
+ "11025"=>"O Item id é obrigatório.",
+ "11026"=>"A quantidade do item é obrigatória.",
+ "11027"=>"Número inválido para a quantidade do item",
+ "11028"=>"Total do item é obrigatório, ex. 10.00",
+ "11029"=>"Formato do total do item inválido.",
+ "11030"=>"Número inválido para o total do item",
+ "11031"=>"Formato inválido para o total de entrega",
+ "11032"=>"Número inválido para o total de entrega",
+ "11033"=>"Descrição do item é obrigatória.",
+ "11034"=>"Tamanho inválido para a descrição do item",
+ "11035"=>"Peso inválido para o item",
+ "11036"=>"Formato inválido para o valor extra",
+ "11037"=>"Número inválido para o valor extra",
+ "11038"=>"Cliente inválido para o checkout, favor cliente verificar o status da conta no PagSeguro.",
+ "11039"=>"Requisição de XML malformada.",
+ "11040"=>"Formato do campo idade inválido",
+ "11041"=>"Número inválido para o campo idade",
+ "11042"=>"Formato do campo maxUses inválido",
+ "11043"=>"Número inválido para o campo maxUses.",
+ "11044"=>"A data inicial é obrigatória.",
+ "11045"=>"A data inicial deve ser menor do que o limite permitido.",
+ "11046"=>"A data inicial deve maior do que 6 meses.",
+ "11047"=>"A data inicial deve ser menor ou igual à data final.",
+ "11048"=>"O intervalor de busca deve ser menor ou igual à 30 dias.",
+ "11049"=>"A data final deve ser menor do que a data permitida.",
+ "11050"=>"Formato da data inicial inválido, use o formato 'yyyy-MM-ddTHH:mm' (ex. 2010-01-27T17:25).",
+ "11051"=>"Formato da data final inválido, use o formato 'yyyy-MM-ddTHH:mm' (ex. 2010-01-27T17:25).",
+ "11052"=>"Valor inválido para a página.",
+ "11053"=>"Valor inválido para o total de resultados da página (deve ser entre 1 e 1000).",
+ "11157"=>"CPF inválido",
+ "53004"=>"Quantidade de itens inválida.",
+ "53005"=>"A moeda é obrigatória.",
+ "53006"=>"Moeda informada é inválida",
+ "53007"=>"Tamanho da referência inválido",
+ "53008"=>"Tamanho da url de notificação inválido.",
+ "53009"=>"Url de notificação inválido.",
+ "53010"=>"O e-mail do cliente é obrigatório.",
+ "53011"=>"Tamanho inválido para o e-mail do cliente",
+ "53012"=>"Valor inválido para o e-mail do cliente",
+ "53013"=>"O nome do cliente é obrigatório.",
+ "53014"=>"Tamanho inválido para o nome do cliente",
+ "53015"=>"Valor inválido para o nome do cliente",
+ "53017"=>"Valor inválido para o cpf",
+ "53018"=>"Código de área é obrigatório.",
+ "53019"=>"Valor inválido para o código de área",
+ "53020"=>"O telefone é obrigatório.",
+ "53021"=>"Valor inválido para o telefone",
+ "53022"=>"O cep de entrega é obrigatório.",
+ "53023"=>"Valor inválido para o cep de entrega.",
+ "53024"=>"Endereço de entrega é obrigatório.",
+ "53025"=>"Valor inválido para o endereço de entrega.",
+ "53026"=>"O número do endereço de entrega é obrigatório.",
+ "53027"=>"Tamanho inválido para o número do endereço de entrega",
+ "53028"=>"Tamanho inválido para o complemento do endereço de entrega",
+ "53029"=>"O bairro é obrigatório.",
+ "53030"=>"Valor inválido para o bairro do endereço de entrega",
+ "53031"=>"A cidade do endereço de entrega é obrigatória.",
+ "53032"=>"Tamanho inválido para a cidade do endereço de entrega",
+ "53033"=>"O estado do endereço de entrega é obrigatório.",
+ "53034"=>"Valor inválido para o estado do endereço de entrega.",
+ "53035"=>"O paÃs do endereço de entrega é obrigatório.",
+ "53036"=>"Tamanho inválido para o paÃs do endereço de entrega",
+ "53037"=>"O token do cartão de crédito é obrigatório.",
+ "53038"=>"A quantidade de parcelas é obrigatória.",
+ "53039"=>"Tamanho inválido para a quantidade de parcelas",
+ "53040"=>"O valor da parcela é obrigatório.",
+ "53041"=>"Tamanho inválido do valor da parcela",
+ "53042"=>"O titular do cartão é obrigatório.",
+ "53043"=>"Tamanho inválido para o campo titular do cartão.",
+ "53044"=>"Valor inválido para o campo titular do cartão.",
+ "53045"=>"O cpf do titular do cartão é obrigatório.",
+ "53046"=>"Valor inválido para o cpf do titular do cartão.",
+ "53047"=>"A data de nascimento do titular do cartão é obrigatória.",
+ "53048"=>"Valor inválido para a data de nascimento do titular do cartão",
+ "53049"=>"O código de área do titular do cartão é obrigatório.",
+ "53050"=>"Valor inválido para o código de área do titular do cartão",
+ "53051"=>"O telefone do titular do cartão é obrigatório.",
+ "53052"=>"Valor inválido para o telefone do titular do cartão.",
+ "53053"=>"O cep de cobrança é obrigatório.",
+ "53054"=>"Valor inválido para o cep de cobrança.",
+ "53055"=>"Endereço de cobrança é obrigatório.",
+ "53056"=>"Valor inválido para o endereço de cobrança.",
+ "53057"=>"O número do endereço de cobrança é obrigatório.",
+ "53058"=>"Tamanho inválido para o número do endereço de cobrança",
+ "53059"=>"Tamanho inválido para o complemento do endereço de cobrança",
+ "53060"=>"O bairro do endereço de cobrança é obrigatório.",
+ "53061"=>"Valor inválido para o bairro do endereço de cobrança",
+ "53062"=>"A cidade do endereço de cobrança é obrigatória.",
+ "53063"=>"Tamanho inválido para a cidade do endereço de cobrança",
+ "53064"=>"Tamanho inválido para o paÃs do endereço de cobrança",
+ "53065"=>"O estado do endereço de cobrança é obrigatório.",
+ "53066"=>"Valor inválido para o estado do endereço de cobrança.",
+ "53067"=>"O paÃs do endereço de cobrança é obrigatório.",
+ "53068"=>"Tamanho inválido para o e-mail do lojista",
+ "53069"=>"Valor inválido para o e-mail do lojista",
+ "53070"=>"O item id é obrigatório",
+ "53071"=>"Tamanho inválido para o ID do item",
+ "53072"=>"Descrição do item é obrigatória.",
+ "53073"=>"Tamanho inválido para a descrição do item",
+ "53074"=>"A quantidade do item é obrigatória.",
+ "53075"=>"Valor inválido para a quantidade do item",
+ "53076"=>"Formato inválido para a quantidade do item",
+ "53077"=>"O valor do item é obrigatório.",
+ "53078"=>"Formato inválido para a quantidade do item",
+ "53079"=>"O valor do item é inválido.",
+ "53081"=>"O cliente tem relação com o lojista.",
+ "53084"=>"Cliente inválido, favor verificar o status da conta do lojista e checar se é uma conta de vendedor.",
+ "53085"=>"Método de pagamento indisponÃvel.",
+ "53086"=>"Total do carrinho inválido",
+ "53087"=>"Número do Cartão de crédito inválido.",
+ "53091"=>"Hash do cartão de crédito inválido.",
+ "53092"=>"Bandeira do cartão de crédito não-aceita.",
+ "53095"=>"Formato inválido para o tipo de entrega",
+ "53096"=>"Formato inválido para o custo de entrega",
+ "53097"=>"Custo de entrega inválido",
+ "53098"=>"Valor total do carrinho está negativo",
+ "53099"=>"Formato do valor extra inválido. Deve ser no formato -/+xx.xx",
+ "53101"=>"Modo de pagamento inválido.",
+ "53102"=>"Método de pagamento inválido, são aceitos cartão de crédito, boleto e transferência.",
+ "53104"=>"Custo de entrega foi enviado, mas o endereço de entrega deve estar completo.",
+ "53105"=>"Dados do cliente enviados, mas o e-mail é obrigatório.",
+ "53106"=>"Titular do cartão de crédito incompleto.",
+ "53109"=>"O endereço de entrega foi enviado, mas o e-mail do cliente é obrigatório.",
+ "53110"=>"O banco para transferência é obrigatório.",
+ "53111"=>"Banco para transferência informato não é aceito.",
+ "53115"=>"Valor inválido para data de nascimento do cliente",
+ "53122"=>"DomÃnio do e-mail do cliente inválido, deve obrigatoriamente ser um email de @sandbox.pagseguro.com.br",
+ "53140"=>"Valor inválido da quantidade de parcelamento. O valor deve ser maior do que zero.",
+ "53141"=>"O cadastro do cliente está bloqueado.",
+ "53142"=>"Token do cartão de crédito inválido.",
+ "400" => "Requisição com parâmetros obrigatórios vazios ou inválidos",
+ "401" => "Falha na autenticação ou sem acesso para usar o serviço",
+ "405" => "Método não permitido, o serviço suporta apenas POST",
+ "415" => "Content-Type não suportado",
+ "500" => "Erro fatal na aplicação, executar a solicitação mais tarde",
+ "503" => "Serviço está indisponÃvel"
+ );
+ if (isset($erros[$codigo])) {
+ $erro_traduzido = $erros[$codigo];
+ } else {
+ $erro_traduzido = "Erro interno";
+ }
+ return $erro_traduzido;
+ }
+ function setCartPrices (VirtueMartCart $cart, &$cart_prices, $method, $progressive=true) {
+ if ($method->modo_calculo_desconto == '2') {
+ return parent::setCartPrices($cart, $cart_prices, $method, false);
+ } else {
+ return parent::setCartPrices($cart, $cart_prices, $method, true);
+ }
+ }
+}
\ No newline at end of file
diff --git a/pagsegurotransparente.xml b/pagsegurotransparente.xml
new file mode 100644
index 0000000..a8bf98d
--- /dev/null
+++ b/pagsegurotransparente.xml
@@ -0,0 +1,275 @@
+
+
+ VMPayment - Checkout Transparente compatÃvel com PagSeguro
+ 2017
+ Luiz Felipe Weber
+ http://weber.eti.br
+ Copyright (C) 2017. All rights reserved.
+ http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
+ 2.0.38
+ Plugin de pagamento
+ <div style="background:#E5F5FF;border:1px solid #99D6FF;padding:10px;margin:10px; -box-shadow: inset 0px 0px 10px #fff, 0px 0px 5px #ccc; -webkit-box-shadow: inset 0px 0px 10px #fff, 0px 0px 5px #ccc; -moz-box-shadow: inset 0px 0px 10px #fff, 0px 0px 5px #ccc;font-weight:normal;">
+ <h1>Plugin de pagamento PagSeguro Transparente para Virtuemart 3.0 - Api Transparente.</h1>
+ <div style="float:right;width: 20%">
+ <img src="../plugins/vmpayment/pagsegurotransparente/checkout_transparente_pagseguro.png" />
+ </div>
+ <div><em>Passo 1</em> - Crie sua conta PagSeguro ( caso não exista ) e solicite a ativação da <b>PagSeguro Transparente</b>. </div>
+ <div><em>Passo 3</em> - Habilite o plugin aqui <a href="index.php?option=com_plugins&view=plugins&filter_search=pagsegurotransparente">Administrar Plugins</a></div>
+ <div><em>Passo 4</em> - Instale Plugin por esta tela <a href="index.php?option=com_virtuemart&view=paymentmethod">Métodos de pagamento</a></div>
+ <div><em>Passo 4.1</em> - <b>Clique em Novo Método de Pagamento</b> e preencha as informações:</div>
+ <div>* Nome do Pagamento: <b>Cartões de crédito e débito, transferência e boleto bancário ( PagSeguro )</b></div>
+ <div>* Publicado: <b>Sim</b></div>
+ <div>* Descrição do pagamento: <b>Pague com cartão de crédito, boleto ou saldo PagSeguro</b></div>
+ <div>* Método de pagamento: <b>PagSeguro</b></div>
+ <div>* Grupo de Compradores: <b>-default-</b></div>
+ <div><em>Passo 4.2</em> - <b>Clique em Salvar</b>.</div>
+ <div><em>Passo 5</em> - Na <b>aba configurações</b>, preencha os dados:</div>
+
+ <div> <br />Configurações do Plugin de Pagamento </div>
+ <div>* Logotipos: <b></b></div>
+ <div>* Modo de teste <b>( Sim ou Não ) </b></div>
+ <div>* Token (teste) </div>
+ <div>* Email de acesso (teste) </div>
+ <div>* Token (produção) </div>
+ <div>* Email de Acesso (produção) </div>
+ <div>* Valor MÃnimo <b> 0,01 </b></div>
+ <div>* Status Postado pelo PagSeguro <b> (Compra Aprovada, Em Análise, Estornada, Aguardando Pagamento, Cancelada ) </b></div>
+ <div> </div>
+ <div> <br />Configuração Parcelamento </div>
+ <div>** Max. Parcelas Sem Juros <b> 3 </b></div>
+ <div>** Max. Parcelas Com Juros <b> 12 </b></div>
+ <div>** Taxa de Juros Crédito à vista <b> (2.99) </b></div>
+ <div>** Taxa de Juros Parcelado <b> (2.99) </b></div>
+ <div> <br />Formas de Pagamento Aceitas </div>
+ <div>* Ativar Boleto <b> (Sim ou Não) </b></div>
+ <div>* Ativar Cartões de Crédito <b> (Sim ou Não) </b></div>
+ <div>* Ativar Débito em Conta <b> (Sim ou Não) </b></div>
+ <div> <br />Cartões de Crédito Aceitos </div>
+ <div>* Visa <b> (Sim ou Nâo) </b></div>
+ <div>* Mastercard <b> (Sim ou Nâo) </b></div>
+ <div>* Hipercard <b> (Sim ou Nâo) </b></div>
+ <div>* Diners <b> (Sim ou Nâo) </b></div>
+ <div>* Amex <b> (Sim ou Nâo) </b></div>
+ <div> <br />Pagamento com Débito Aceitos </div>
+ <div>* Débito BB <b> (Sim ou Nâo) </b></div>
+ <div>* Débito Bradesco <b> (Sim ou Nâo) </b></div>
+ <div>* Débito Banrisul <b> (Sim ou Nâo) </b></div>
+ <div>* Débito Itaú <b> (Sim ou Nâo) </b></div>
+ <div> <br />Pagamento com Boleto Aceitos </div>
+ <div>* Boleto bancário <b> (Sim ou Nâo) </b></div>
+ <div> <br />Outras configurações</div>
+ <div>* PaÃses <b> (Brasil) </b></div>
+ <div>* MÃnimo da Compra <b> (MÃnimo da compra para ativar o módulo) </b></div>
+ <div>* Máximo da Compra <b> (Máximo da compra para ativar o módulo) </b></div>
+ <div>* Custo por Transação <b> (Custo extra por transação feita) </b></div>
+ <div>* Custo percentual total <b> (Custo extra por transação total) </b></div>
+ <div>* Tarifa/Imposto <b> (Configurar de uma tarifa previamente cadastrada) </b></div>
+
+ </div>
+ <div> Licença: <a href="http://www.gnu.org/licenses/gpl-3.0.html">GNU/GPL v3</a> - Desenvolvido por Luiz Weber - <a href="http://weber.eti.br">Weber TI</a>
+ </div>
+
+
+
+
+ pagseguro.jpg
+
+
+
+
+ pagsegurotransparente.php
+ licenca-gplv3.txt
+ leiame.txt
+ gplv3-license.txt
+ checkout_transparente_pagseguro.png
+ assets
+ imagens
+ language
+ admin
+
+
+
+ pt-BR.plg_vmpayment_pagsegurotransparente.ini
+ en-GB.plg_vmpayment_pagsegurotransparente.ini
+
+
+
+ pt-BR.plg_vmpayment_pagsegurotransparente.ini
+ en-GB.plg_vmpayment_pagsegurotransparente.ini
+
+
+
+
+
+
+
+
+
+ COM_VIRTUEMART_YES
+ COM_VIRTUEMART_NO
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ COM_VIRTUEMART_NO
+ COM_VIRTUEMART_YES
+
+
+ COM_VIRTUEMART_NO
+ COM_VIRTUEMART_YES
+
+
+ COM_VIRTUEMART_NO
+ COM_VIRTUEMART_YES
+
+
+
+
+ COM_VIRTUEMART_NO
+ COM_VIRTUEMART_YES
+
+
+ COM_VIRTUEMART_NO
+ COM_VIRTUEMART_YES
+
+
+ COM_VIRTUEMART_NO
+ COM_VIRTUEMART_YES
+
+
+ COM_VIRTUEMART_NO
+ COM_VIRTUEMART_YES
+
+
+ COM_VIRTUEMART_NO
+ COM_VIRTUEMART_YES
+
+
+
+ COM_VIRTUEMART_NO
+ COM_VIRTUEMART_YES
+
+
+ COM_VIRTUEMART_NO
+ COM_VIRTUEMART_YES
+
+
+
+
+ COM_VIRTUEMART_NO
+ COM_VIRTUEMART_YES
+
+
+ COM_VIRTUEMART_NO
+ COM_VIRTUEMART_YES
+
+
+ COM_VIRTUEMART_NO
+ COM_VIRTUEMART_YES
+
+
+ COM_VIRTUEMART_NO
+ COM_VIRTUEMART_YES
+
+
+
+ COM_VIRTUEMART_NO
+ COM_VIRTUEMART_YES
+
+
+
+
+ COM_VIRTUEMART_NO
+ COM_VIRTUEMART_YES
+
+
+
+
+ COM_VIRTUEMART_YES
+ COM_VIRTUEMART_NO
+
+
+
+
+
+ Modo Simples ( desconto normal )
+ Modo VirtueMart ( desconto progressivo )
+
+
+
+
+
+
+
+
+
+
+
+ COM_VIRTUEMART_YES
+ COM_VIRTUEMART_NO
+
+
+
+
+
+
+
+
+
\ No newline at end of file