mundipagg_api 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mundipagg/MundipaggApi.rb +53 -3
- data/mundipagg-api.gemspec +1 -1
- data/spec/integration/gateway_spec.rb +13 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 678000dc7ab4537980bc2741f8d5eb59bd8119d2
|
4
|
+
data.tar.gz: 97af4cfc5964d9d9afdd873a9533a5bbb7255746
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c76569c9778c2088d42fdbd187ae3548eb325a80a6da0362c6adf9cb19542d4d159cbe1d9793171aa1853d8d74a682cf50846fe46674d1530831654e4398a322
|
7
|
+
data.tar.gz: 87e7676fcbe54a9550ecd6b4733c93e3624231fdd6ff7578d4ec23970ed000f227d5f7a78440d26ad92fed62ae3e242b0640cdc3005af345fd7594b311283a4b
|
@@ -12,11 +12,13 @@ class MundipaggApi
|
|
12
12
|
@@SERVICE_HEADERS = {:MerchantKey => "#{@merchantKey}", :Accept => 'application/json', :"Content-Type" => 'application/json'}
|
13
13
|
end
|
14
14
|
|
15
|
-
# URL de
|
15
|
+
# URL de producao
|
16
16
|
@@SERVICE_URL_PRODUCTION = 'https://transactionv2.mundipaggone.com/Sale/'
|
17
|
+
@@SERVICE_URL_PRODUCTION_CREDIT_CARD = 'https://transactionv2.mundipaggone.com/CreditCard/'
|
17
18
|
|
18
|
-
# URL de
|
19
|
+
# URL de homologacao
|
19
20
|
@@SERVICE_URL_STAGING = 'https://stagingv2.mundipaggone.com/Sale/'
|
21
|
+
@@SERVICE_URL_STAGING_CREDIT_CARD = 'https://stagingv2.mundipaggone.com/CreditCard/'
|
20
22
|
|
21
23
|
# permite que o integrador adicione uma busca por transacoes utilizando alguns criterios
|
22
24
|
def Query(querySaleRequestEnum, key)
|
@@ -37,7 +39,7 @@ class MundipaggApi
|
|
37
39
|
return err.response
|
38
40
|
end
|
39
41
|
|
40
|
-
# se
|
42
|
+
# se nao houver erros, trata o json e retorna o objeto
|
41
43
|
querySaleResponse = JSON.load response
|
42
44
|
querySaleResponse
|
43
45
|
end
|
@@ -302,6 +304,7 @@ class MundipaggApi
|
|
302
304
|
return response
|
303
305
|
end
|
304
306
|
|
307
|
+
# ffaz o download do transaction report file e salva no computador em .txt
|
305
308
|
def TransactionReportFileDownloader(date, file_name, path)
|
306
309
|
begin
|
307
310
|
path = path + file_name + '.txt'
|
@@ -323,6 +326,53 @@ class MundipaggApi
|
|
323
326
|
return response
|
324
327
|
end
|
325
328
|
|
329
|
+
def InstantBuyKey(instant_buy_key)
|
330
|
+
# try, tenta fazer o request
|
331
|
+
begin
|
332
|
+
|
333
|
+
# se for homologacao faz a chamada por aqui
|
334
|
+
if @serviceEnvironment == :staging
|
335
|
+
response = RestClient.get @@SERVICE_URL_STAGING_CREDIT_CARD + instant_buy_key, headers=@@SERVICE_HEADERS
|
336
|
+
|
337
|
+
# se for producao, faz a chamada por aqui
|
338
|
+
elsif @serviceEnvironment == :production
|
339
|
+
response = RestClient.get @@SERVICE_URL_PRODUCTION_CREDIT_CARD + instant_buy_key, headers=@@SERVICE_HEADERS
|
340
|
+
end
|
341
|
+
|
342
|
+
# se der algum erro, trata aqui
|
343
|
+
rescue RestClient::ExceptionWithResponse => err
|
344
|
+
return err.response
|
345
|
+
end
|
346
|
+
|
347
|
+
# se nao houver erros, trata o json e retorna o objeto
|
348
|
+
instant_buy_response = JSON.load response
|
349
|
+
instant_buy_response
|
350
|
+
end
|
351
|
+
|
352
|
+
def BuyerKey(buyer_key)
|
353
|
+
# try, tenta fazer o request
|
354
|
+
begin
|
355
|
+
|
356
|
+
# se for homologacao faz a chamada por aqui
|
357
|
+
if @serviceEnvironment == :staging
|
358
|
+
response = RestClient.get @@SERVICE_URL_STAGING_CREDIT_CARD + buyer_key + '/BuyerKey', headers=@@SERVICE_HEADERS
|
359
|
+
|
360
|
+
# se for producao, faz a chamada por aqui
|
361
|
+
elsif @serviceEnvironment == :production
|
362
|
+
response = RestClient.get @@SERVICE_URL_PRODUCTION_CREDIT_CARD + buyer_key + '/BuyerKey', headers=@@SERVICE_HEADERS
|
363
|
+
end
|
364
|
+
|
365
|
+
# se der algum erro, trata aqui
|
366
|
+
rescue RestClient::ExceptionWithResponse => err
|
367
|
+
return err.response
|
368
|
+
end
|
369
|
+
|
370
|
+
# se nao houver erros, trata o json e retorna o objeto
|
371
|
+
buyer_response = JSON.load response
|
372
|
+
buyer_response
|
373
|
+
end
|
374
|
+
|
375
|
+
# funcao de post generica
|
326
376
|
def postRequest(payload, url)
|
327
377
|
response = nil
|
328
378
|
begin
|
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.1.0' # Major.Minor.Revision
|
6
6
|
s.author = 'MundiPagg'
|
7
7
|
s.email = 'github@mundipagg.com'
|
8
8
|
s.homepage = 'http://www.mundipagg.com/'
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative '../../lib/mundipagg_api'
|
2
2
|
require_relative 'test_helper'
|
3
3
|
|
4
|
-
merchant_key = '
|
4
|
+
merchant_key = '8A2DD57F-1ED9-4153-B4CE-69683EFADAD5'
|
5
5
|
gateway = MundipaggApi.new(:production, merchant_key)
|
6
6
|
|
7
7
|
RSpec.describe MundipaggApi do
|
@@ -518,4 +518,16 @@ RSpec.describe MundipaggApi do
|
|
518
518
|
file_exist = File.exist?(file_path)
|
519
519
|
expect(file_exist).to eq true
|
520
520
|
end
|
521
|
+
|
522
|
+
it 'should consult transaction with instant buy key' do
|
523
|
+
response = gateway.InstantBuyKey('2B2894E2-6767-4FE4-9A37-5F3E60EF9814')
|
524
|
+
|
525
|
+
expect(response['ErrorReport']).to eq nil
|
526
|
+
end
|
527
|
+
|
528
|
+
it 'should consult transaction with buyer key' do
|
529
|
+
response = gateway.BuyerKey('EF42EDE1-D482-4A13-84F2-637A201AA4F2')
|
530
|
+
|
531
|
+
expect(response['ErrorReport']).to eq nil
|
532
|
+
end
|
521
533
|
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.1.0
|
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-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|