diff --git a/README.md b/README.md index c462029..5993d08 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,9 @@ repositório: https://github.com/emersonjsouza/node-pagseguro-sample.git pagseguro = require('pagseguro'); pag = new pagseguro({ email : 'suporte@lojamodelo.com.br', - token: '95112EE828D94278BD394E91C4388F20' + token: '95112EE828D94278BD394E91C4388F20', + maxAge: 3000, // Determina o prazo (em segundos) durante o qual o código de pagamento poderá ser utilizado (opcional) + maxUses: 5 // Determina o número máximo de vezes que o código de pagamento poderá ser usado (opcional) }); //Configurando a moeda e a referência do pedido diff --git a/lib/pagseguro.coffee b/lib/pagseguro.coffee index f1dfdd5..957dbba 100644 --- a/lib/pagseguro.coffee +++ b/lib/pagseguro.coffee @@ -4,6 +4,7 @@ req = require('request'); class pagseguro constructor: (configObj) -> + @obj = {} if arguments.length > 1 @email = arguments[0] @token = arguments[1] @@ -14,7 +15,10 @@ class pagseguro @email = configObj.email @token = configObj.token @mode = configObj.mode or "payment" - @obj = {} + + @obj.maxAge = configObj.maxAge if configObj.maxAge? + @obj.maxUses = configObj.maxUses if configObj.maxUses? + @xml = '' return this diff --git a/lib/pagseguro.js b/lib/pagseguro.js index af2ab97..d49feec 100644 --- a/lib/pagseguro.js +++ b/lib/pagseguro.js @@ -1,4 +1,4 @@ -// Generated by CoffeeScript 1.9.3 +// Generated by CoffeeScript 1.12.7 (function() { var pagseguro, req, xml; @@ -8,6 +8,7 @@ pagseguro = (function() { function pagseguro(configObj) { + this.obj = {}; if (arguments.length > 1) { this.email = arguments[0]; this.token = arguments[1]; @@ -18,7 +19,12 @@ this.token = configObj.token; this.mode = configObj.mode || "payment"; } - this.obj = {}; + if (configObj.maxAge != null) { + this.obj.maxAge = configObj.maxAge; + } + if (configObj.maxUses != null) { + this.obj.maxUses = configObj.maxUses; + } this.xml = ''; return this; }