mundipagg_api 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +45 -25
- data/mundipagg-api.gemspec +2 -1
- data/spec/integration/gateway_spec.rb +1 -1
- metadata +22 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f813f6c66392ced5a7c84bd59552ac3f4bc89f5f
|
4
|
+
data.tar.gz: 119a156ea7438edf107cb629c250a83bfbbc0712
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 582006ab251b617f32973b0cd45332c520a5c5bd783961614eecd146609efb3ff5fd19bcf2bd414c65081bfd447206d4cfda7db27d4417b72ee58a4ef4a526fc
|
7
|
+
data.tar.gz: 95099adcd37fb6ea5eb75f36cf104fb634d44d95621825d62f1e6954d454f20bde7b6b8c2e45734665eeb4bdd2f8ba3d4a83225f797f88eadc6e9a79580d9051
|
data/README.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
# mundipagg-one-ruby
|
2
2
|
|
3
|
+
### Mundipagg Gem Download
|
4
|
+
https://rubygems.org/gems/mundipagg_api
|
5
|
+
|
6
|
+
```ruby
|
7
|
+
$ gem install mundipagg_api
|
8
|
+
```
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
require 'mundipagg_api'
|
12
|
+
```
|
13
|
+
|
14
|
+
Ruby DevKit is required.
|
15
|
+
|
3
16
|
### About Windows
|
4
17
|
The recommended Windows version of Ruby is Ruby 2.1.
|
5
18
|
For gems work correctly it'll be necessary run the following commands:
|
@@ -19,6 +32,7 @@ $ gem install nori
|
|
19
32
|
$ gem install gyoku
|
20
33
|
$ gem install nokogiri
|
21
34
|
$ gem install ffi
|
35
|
+
$ gem install bundler
|
22
36
|
```
|
23
37
|
### Bundler
|
24
38
|
Run the following commands to install gems:
|
@@ -29,31 +43,40 @@ $ gem install bundler
|
|
29
43
|
$ bundle install
|
30
44
|
```
|
31
45
|
|
32
|
-
Running tests
|
46
|
+
Running tests with `bundle exec`:
|
33
47
|
|
34
|
-
Rodando testes
|
48
|
+
Rodando testes com `bundle exec`:
|
35
49
|
```ruby
|
36
50
|
$ bundle exec rspec spec/integration/gateway_spec.rb
|
37
51
|
```
|
38
52
|
|
53
|
+
Running tests with `rake`:
|
54
|
+
|
55
|
+
Rodando testes com `rake`:
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
$ rake
|
59
|
+
```
|
60
|
+
|
39
61
|
## Code Examples
|
40
62
|
|
41
63
|
### Create a Credit Card Transaction
|
42
64
|
```ruby
|
43
|
-
|
65
|
+
require 'mundipagg_api'
|
44
66
|
|
45
67
|
# passa a merchantKey na variável
|
46
68
|
merchantKey = 'sua merchantKey'
|
47
69
|
|
48
70
|
# instancia classe com métodos de requisição
|
49
71
|
# :staging ou nada para ambiente sandbox e :production para ambiente de produção
|
50
|
-
gateway =
|
72
|
+
gateway = MundipaggApi.new(:production, merchantKey)
|
51
73
|
|
52
74
|
# coleta dados do cartão
|
53
75
|
creditCardTransaction = CreditCardTransaction.new
|
54
76
|
creditCardTransaction.AmountInCents = 100
|
55
77
|
creditCardTransaction.InstallmentCount = 1
|
56
78
|
creditCardTransaction.TransactionReference = 'CreditCard One RubySDK Test'
|
79
|
+
creditCardTransaction.CreditCardOperation = 'AuthOnly'
|
57
80
|
creditCardTransaction.Options.PaymentMethodCode = 1
|
58
81
|
creditCardTransaction.Options.SoftDescriptorText = 'My Store Name'
|
59
82
|
creditCardTransaction.CreditCard.CreditCardNumber = '5453010000066167'
|
@@ -74,14 +97,14 @@ response = gateway.CreateSale(createSaleRequest)
|
|
74
97
|
|
75
98
|
### Create a BoletoTransaction
|
76
99
|
```ruby
|
77
|
-
|
100
|
+
require 'mundipagg_api'
|
78
101
|
|
79
102
|
# passa a merchantKey na variável
|
80
103
|
merchantKey = 'sua merchantKey'
|
81
104
|
|
82
105
|
# instancia classe com métodos de requisição
|
83
106
|
# :staging ou nada para ambiente sandbox e :production para ambiente de produção
|
84
|
-
gateway =
|
107
|
+
gateway = MundipaggApi.new(:production, merchantKey)
|
85
108
|
|
86
109
|
# instancia um objeto de transação de boleto
|
87
110
|
boletoTransaction = BoletoTransaction.new
|
@@ -106,13 +129,13 @@ response = gateway.CreateSale(createSaleRequest)
|
|
106
129
|
|
107
130
|
### Cancel Method
|
108
131
|
```ruby
|
109
|
-
|
132
|
+
require 'mundipagg_api'
|
110
133
|
|
111
134
|
merchantKey = 'Sua Merchant Key'
|
112
135
|
|
113
136
|
# instancia classe com métodos de requisição
|
114
137
|
# :staging para ambiente sandbox e :production para ambiente de produção
|
115
|
-
gateway =
|
138
|
+
gateway = MundipaggApi.new(:staging, merchantKey)
|
116
139
|
|
117
140
|
# preenche um item de colecao, necessario para cancelamento da transacao de cartao de credito
|
118
141
|
cancelCreditCardTransactionItem = ManageCreditCardTransaction.new
|
@@ -125,9 +148,6 @@ cancelSaleRequest = ManageSaleRequest.new
|
|
125
148
|
cancelSaleRequest.OrderKey = 'OrderKey AQUI'
|
126
149
|
cancelSaleRequest.CreditCardTransactionCollection << cancelCreditCardTransactionItem
|
127
150
|
|
128
|
-
# incrementa na coleção o item de retry
|
129
|
-
retrySaleRequest.RetrySaleCreditCardTransactionCollection << retrySaleCreditCardTransactionItem
|
130
|
-
|
131
151
|
# faz a requisição de cancelamento, retorna um hash com a resposta
|
132
152
|
response = gateway.Cancel(cancelSaleRequest)
|
133
153
|
```
|
@@ -135,14 +155,14 @@ response = gateway.Cancel(cancelSaleRequest)
|
|
135
155
|
|
136
156
|
### Capture Method
|
137
157
|
```ruby
|
138
|
-
|
158
|
+
require 'mundipagg_api'
|
139
159
|
|
140
160
|
# merchant key
|
141
161
|
merchantKey = 'sua merchantKey'
|
142
162
|
|
143
163
|
# inicializa a classe com métodos de requisição
|
144
164
|
# :staging ou nada para ambiente de sandbox e :production para ambiente de produção
|
145
|
-
gateway =
|
165
|
+
gateway = MundipaggApi.new(merchantKey)
|
146
166
|
|
147
167
|
# itens necessários para captura da transacão
|
148
168
|
captureCreditCardTransactionItem = ManageCreditCardTransaction.new
|
@@ -164,13 +184,13 @@ response = gateway.Capture(captureSaleRequest)
|
|
164
184
|
|
165
185
|
### Retry Method
|
166
186
|
```ruby
|
167
|
-
|
187
|
+
require 'mundipagg_api'
|
168
188
|
|
169
189
|
merchantKey = 'Sua Merchant Key'
|
170
190
|
|
171
191
|
# instancia classe com métodos de requisição
|
172
192
|
# :staging para ambiente sandbox e :production para ambiente de produção
|
173
|
-
gateway =
|
193
|
+
gateway = MundipaggApi.new(:staging, merchantKey)
|
174
194
|
|
175
195
|
retrySaleRequest = RetrySaleRequest.new
|
176
196
|
retrySaleCreditCardTransactionItem = RetrySaleCreditCardTransaction.new
|
@@ -192,14 +212,14 @@ response = gateway.Retry(retrySaleRequest)
|
|
192
212
|
|
193
213
|
### Query Method
|
194
214
|
```ruby
|
195
|
-
|
215
|
+
require 'mundipagg_api'
|
196
216
|
|
197
217
|
# merchant key
|
198
218
|
merchantKey = 'sua merchantKey'
|
199
219
|
|
200
220
|
# inicializa a classe com métodos de requisição
|
201
221
|
# :staging ou nada para ambiente de sandbox e :production para ambiente de produção
|
202
|
-
gateway =
|
222
|
+
gateway = MundipaggApi.new(merchantKey)
|
203
223
|
|
204
224
|
# inicializa a QuerySaleRequest
|
205
225
|
querySaleRequest = QuerySaleRequest.new
|
@@ -225,14 +245,14 @@ The ParseXmlToNotification takes an XML and convert it to a hash variable.
|
|
225
245
|
O ParseXmlToNotification converte um XML para uma variável hash.
|
226
246
|
|
227
247
|
```ruby
|
228
|
-
|
248
|
+
require 'mundipagg_api'
|
229
249
|
|
230
250
|
# merchant key
|
231
251
|
merchantKey = 'sua merchantKey'
|
232
252
|
|
233
253
|
# inicializa a classe com métodos de requisição
|
234
254
|
# :staging ou nada para ambiente de sandbox e :production para ambiente de produção
|
235
|
-
gateway =
|
255
|
+
gateway = MundipaggApi.new(merchantKey)
|
236
256
|
|
237
257
|
xml = 'xml que será passsado na variável'
|
238
258
|
|
@@ -243,14 +263,14 @@ response = gateway.ParseXmlToNotification(xml)
|
|
243
263
|
|
244
264
|
### TransactionReportFile Method
|
245
265
|
```ruby
|
246
|
-
|
266
|
+
require 'mundipagg_api'
|
247
267
|
|
248
268
|
# merchant key
|
249
269
|
merchantKey = 'sua merchantKey'
|
250
270
|
|
251
271
|
# inicializa a classe com métodos de requisição
|
252
272
|
# :staging ou nada para ambiente de sandbox e :production para ambiente de produção
|
253
|
-
gateway =
|
273
|
+
gateway = MundipaggApi.new(merchantKey)
|
254
274
|
|
255
275
|
# cria uma variável do tipo Date, passando apenas o ano, mês e dia (nessa ordem)
|
256
276
|
date = Date.new(2014, 12, 10)
|
@@ -265,14 +285,14 @@ If you want the string that is received from TransactionReportFile Method to be
|
|
265
285
|
|
266
286
|
Este método faz um parse na string recebida do método TransactionReportFile e retorna um hash.
|
267
287
|
```ruby
|
268
|
-
|
288
|
+
require 'mundipagg_api'
|
269
289
|
|
270
290
|
# merchant key
|
271
291
|
merchantKey = 'sua merchantKey'
|
272
292
|
|
273
293
|
# inicializa a classe com métodos de requisição
|
274
294
|
# :staging ou nada para ambiente de sandbox e :production para ambiente de produção
|
275
|
-
gateway =
|
295
|
+
gateway = MundipaggApi.new(merchantKey)
|
276
296
|
|
277
297
|
# cria uma variável do tipo Date, passando apenas o ano, mês e dia (nessa ordem)
|
278
298
|
date = Date.new(2014, 12, 10)
|
@@ -289,14 +309,14 @@ This method download and save the TransactionReportFile to a '.txt' file.
|
|
289
309
|
|
290
310
|
Este método faz o download e salva o TransactionReportFile em um arquivo '.txt' no local indicado.
|
291
311
|
```ruby
|
292
|
-
|
312
|
+
require 'mundipagg_api'
|
293
313
|
|
294
314
|
# merchant key
|
295
315
|
merchantKey = 'sua merchantKey'
|
296
316
|
|
297
317
|
# inicializa a classe com métodos de requisição
|
298
318
|
# :staging ou nada para ambiente de sandbox e :production para ambiente de produção
|
299
|
-
gateway =
|
319
|
+
gateway = MundipaggApi.new(merchantKey)
|
300
320
|
|
301
321
|
# cria uma variável do tipo Date, passando apenas o ano, mês e dia (nessa ordem)
|
302
322
|
date = Date.new(2015, 9, 15)
|
data/mundipagg-api.gemspec
CHANGED
@@ -2,7 +2,7 @@ Gem::Specification.new do |s|
|
|
2
2
|
s.name = 'mundipagg_api'
|
3
3
|
s.summary = 'MundiPagg Ruby Client Library'
|
4
4
|
s.description = 'Ruby library for integrating with the MundiPagg payment web services'
|
5
|
-
s.version = '1.0.
|
5
|
+
s.version = '1.0.1' # Major.Minor.Revision
|
6
6
|
s.author = 'MundiPagg'
|
7
7
|
s.email = 'github@mundipagg.com'
|
8
8
|
s.homepage = 'http://www.mundipagg.com/'
|
@@ -13,6 +13,7 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.add_dependency 'gyoku', '~> 1.3', '>= 1.3.1'
|
14
14
|
s.add_dependency 'nokogiri', '~> 1.6', '>= 1.6.6.2'
|
15
15
|
s.add_dependency 'ffi', '~> 1.9', '>= 1.9.10'
|
16
|
+
s.add_dependency 'bundler', '~> 1.10', '>= 1.10.6'
|
16
17
|
s.required_ruby_version = '>= 2.1.7'
|
17
18
|
s.license = 'Apache 2.0'
|
18
19
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mundipagg_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MundiPagg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -130,6 +130,26 @@ dependencies:
|
|
130
130
|
- - ">="
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: 1.9.10
|
133
|
+
- !ruby/object:Gem::Dependency
|
134
|
+
name: bundler
|
135
|
+
requirement: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - "~>"
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '1.10'
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: 1.10.6
|
143
|
+
type: :runtime
|
144
|
+
prerelease: false
|
145
|
+
version_requirements: !ruby/object:Gem::Requirement
|
146
|
+
requirements:
|
147
|
+
- - "~>"
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '1.10'
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 1.10.6
|
133
153
|
description: Ruby library for integrating with the MundiPagg payment web services
|
134
154
|
email: github@mundipagg.com
|
135
155
|
executables: []
|