bcash-ruby 0.1.5 → 1.0.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 56254dd2f0786d847f685f7d4985b775f279beb7
4
- data.tar.gz: 83083decb8436e97c84a2d0429f2c3f5b52e52ef
3
+ metadata.gz: da056ba52deafba16ee01151a62a5d48fc75774c
4
+ data.tar.gz: f0e8e0c2a4d2d0e388e8e7c2418895809a6abe92
5
5
  SHA512:
6
- metadata.gz: 71dc86b149bdb6b468a9272c47c1cc55219a550f4f7b5cce39ea230880a70ef3956df1759211582e940f251d25e0b28509ad9414a831794e8daa89f7c3b8897e
7
- data.tar.gz: 31973c3bd114dfca5170990785291a7ca129fb52cebae8d8389ac6d2d4ac819af1e6fd3b12b83465344f881c202a5b7d133ad62ed17978cb27cd792b9aa3d154
6
+ metadata.gz: b858120cceb4faf482907c332fee959c2e1ac230244426baf51e89d305d9dcbbcdda7ff616b455eced20131ae2ab5ec9fc2b6e00e91246c68e03b0a22c05d133
7
+ data.tar.gz: 70ab9db6d3afb3ff1aaf5efd33848fdbab0bb859a1bbc91213399661770cc0383d2a91b2f735991ebdc7f6f8740550fbdc7ad798070e7ce295b8081cd225b30b
data/README.md CHANGED
@@ -13,7 +13,6 @@ transaction methods.
13
13
  ## Installation
14
14
  gem install bcash-ruby
15
15
 
16
-
17
16
  ## Resources
18
17
  * [View Source on GitHub][code]
19
18
  * [Report Issues on GitHub][issues]
@@ -23,8 +22,96 @@ transaction methods.
23
22
  [issues]: https://github.com/minestore/bcash-ruby/issues
24
23
  [wiki]: https://wiki.github.com/minestore/bcash-ruby
25
24
 
25
+ ## Configuration
26
+
27
+ ```ruby
28
+ Bcash.configure do |b|
29
+ b.email = Rails.application.secrets.bcash["email"]
30
+ b.token = Rails.application.secrets.bcash["token"]
31
+ end
32
+ ```
33
+
26
34
  ## Usage Examples
27
35
 
36
+ ### Search accounts by CPF
37
+
38
+ ```ruby
39
+ client = Bcash::Client.new
40
+ response = client.search_account_by_cpf('07411111111')
41
+ response.code # 1
42
+ response.cpf # 074111111111
43
+ response.message # Foi encontrado 1 registro para o CPF ou email informado!
44
+ response.accounts.size # 1
45
+ response.accounts.first # { "mail" => 'pessoa@hotmail.com', "token" => 'kx4F3mkZDlGUejQNKWdnP5Ttmk', "idClient" => '205' }
46
+ ```
47
+
48
+ ### Create account
49
+ ```ruby
50
+ data = {
51
+ owner: {
52
+ email: "jose@vendedor.net",
53
+ gender: "M",
54
+ name: "José o Vendedor",
55
+ cpf: "43677708699",
56
+ birth_date: "12/12/1912"
57
+ },
58
+ address: {
59
+ address: "Rua Agostinho",
60
+ zip_code: "81560-040",
61
+ number: "1000",
62
+ neighborhood: "Centro",
63
+ complement: "Casa",
64
+ city: "Curitiba",
65
+ state: "PR"
66
+ },
67
+ contact: {
68
+ phone_number: "41-3333-3333"
69
+ }
70
+ }
71
+
72
+ client = Bcash::Client.new
73
+ response = client.create_account(data)
74
+ response.success? # true
75
+ response.message # Conta criada com sucesso
76
+ ```
77
+
78
+ ### Find Transaction
79
+
80
+ ```ruby
81
+ client = Bcash::Client.new
82
+
83
+ # Find by order id
84
+ response = client.find_by_order_id('1001')
85
+ response.success? # true
86
+ response.transaction
87
+ # { "id_transacao"=>"123456",
88
+ # "data_transacao"=>"07/10/2014",
89
+ # "data_credito"=>"22/10/2014",
90
+ # "valor_original"=>"5.00", ...}
91
+
92
+ # Find by transaction_id
93
+ response = client.find_by_transaction_id('2343856')
94
+ response.success? # false
95
+ response.message # Pedido não localizado
96
+ ```
97
+
98
+ ### Verify Bcash return
99
+
100
+ ```ruby
101
+ data = {
102
+ transacao: '2833',
103
+ status: 'Transação em Andamento',
104
+ cod_status: '0',
105
+ valor_original: '2145.23',
106
+ valor_loja: '2083.23',
107
+ token: '1211CF51917E074BC3784592C71FC'
108
+ }
109
+
110
+ client = Bcash::Client.new
111
+ response = client.verify_return(data)
112
+ response.verified? #true
113
+ ```
114
+
28
115
  ## Supported Ruby Versions
29
116
  This library aims to support and is [tested against][travis] the following Ruby
30
117
  implementations:
data/lib/bcash/api.rb CHANGED
@@ -1,11 +1,13 @@
1
1
  module Bcash::Api
2
2
  autoload :Accounts, 'bcash/api/accounts'
3
3
  autoload :VerifyReturn, 'bcash/api/verify_return'
4
+ autoload :FindTransaction, 'bcash/api/find_transaction'
4
5
  autoload :Response, 'bcash/api/response'
5
6
  autoload :AccountResponse, 'bcash/api/account_response'
6
7
  autoload :CreateAccountResponse, 'bcash/api/create_account_response'
7
8
  autoload :AccountNotValidResponse, 'bcash/api/account_not_valid_response'
8
9
  autoload :VerifyReturnResponse, 'bcash/api/verify_return_response'
10
+ autoload :TransactionResponse, 'bcash/api/transaction_response'
9
11
 
10
12
  autoload :BaseRequest, 'bcash/api/request/base_request'
11
13
  autoload :AddressRequest, 'bcash/api/request/address_request'
@@ -1,7 +1,7 @@
1
1
  module Bcash::Api
2
2
  module Accounts
3
3
  def search_account_by_cpf(cpf)
4
- response = json_request :post, 'searchAccount', { cpf: cpf }
4
+ response = json_request :post, '/searchAccount/json', data: { cpf: cpf }.to_json
5
5
  Bcash::Api::AccountResponse.new(response)
6
6
  end
7
7
 
@@ -9,7 +9,7 @@ module Bcash::Api
9
9
  data = Bcash::Api::AccountCreationRequest.new(data)
10
10
 
11
11
  if data.valid?
12
- response = json_request :post, 'createAccount', data
12
+ response = json_request :post, '/createAccount/json', data: data.to_json
13
13
  Bcash::Api::CreateAccountResponse.new(response)
14
14
  else
15
15
  Bcash::Api::AccountNotValidResponse.new(data)
@@ -0,0 +1,22 @@
1
+ module Bcash::Api
2
+ module FindTransaction
3
+ URL = 'https://www.pagamentodigital.com.br/transacao/consulta'
4
+
5
+ def find_by_order_id(order_id)
6
+ find(id_pedido: order_id)
7
+ end
8
+
9
+ def find_by_transaction_id(transaction_id)
10
+ find(id_transacao: transaction_id)
11
+ end
12
+
13
+ private
14
+
15
+ def find(options)
16
+ options.merge! tipo_retorno: 2
17
+ response = json_request :post, URL, options
18
+ Bcash::Api::TransactionResponse.new(response)
19
+ end
20
+
21
+ end
22
+ end
@@ -0,0 +1,15 @@
1
+ module Bcash::Api
2
+ class TransactionResponse < Response
3
+ def errors
4
+ body['erro']
5
+ end
6
+
7
+ def message
8
+ success ? '' : errors['descricao']
9
+ end
10
+
11
+ def transaction
12
+ success ? body['transacao'] : nil
13
+ end
14
+ end
15
+ end
@@ -1,7 +1,7 @@
1
1
  module Bcash::Api
2
2
  class VerifyReturnResponse < Response
3
3
  def verified?
4
- body == 'VERIFICADO'
4
+ message == 'VERIFICADO'
5
5
  end
6
6
 
7
7
  def message
data/lib/bcash/client.rb CHANGED
@@ -7,6 +7,7 @@ module Bcash
7
7
  include Helpers::Request
8
8
  include Api::Accounts
9
9
  include Api::VerifyReturn
10
+ include Api::FindTransaction
10
11
 
11
12
  base_uri "https://api.bcash.com.br/service"
12
13
  default_timeout 20
@@ -6,9 +6,9 @@ module Bcash::Helpers::Request
6
6
 
7
7
  options.merge! headers: {
8
8
  "Authorization" => authorization_key,
9
- }, body: { data: data.to_json }
9
+ }, body: data
10
10
 
11
- self.class.send(verb, "/#{method}/json", options)
11
+ self.class.send(verb, method, options)
12
12
  end
13
13
 
14
14
  def assert_valid_keys(hash, *valid_keys)
data/lib/bcash/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Bcash
2
- VERSION = "0.1.5"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -0,0 +1,101 @@
1
+ #encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe Bcash::Api::FindTransaction do
5
+ let(:email) { 'contato@minestore.com.br' }
6
+ let(:token) { 'AF3AISDkEF92ABCD820C37FEABCE1' }
7
+ let(:client){ Bcash::Client.new(email: email, token: token) }
8
+
9
+ describe '#find_by_order_id' do
10
+ context 'when api return matching transaction' do
11
+ let(:order_id) { '1001' }
12
+ it 'must return transaction data' do
13
+ VCR.use_cassette('find_transaction_exists') do
14
+ response = client.find_by_order_id(order_id)
15
+ expect(response).to be_success
16
+ expect(response.transaction).to eq(transaction_response)
17
+ end
18
+ end
19
+ end
20
+
21
+ context 'when not matching transaction is returned' do
22
+ let(:order_id) { '12345' }
23
+ it 'must return message and not success' do
24
+ VCR.use_cassette('find_transaction_not_exists') do
25
+ response = client.find_by_order_id(order_id)
26
+ expect(response).to_not be_success
27
+ expect(response.message).to eq('Pedido não localizado')
28
+ end
29
+ end
30
+ end
31
+ end
32
+
33
+ describe '#find_by_transaction_id' do
34
+ context 'when api return matching transaction' do
35
+ let(:transaction_id) { '1001' }
36
+ it 'must return transaction data' do
37
+ VCR.use_cassette('find_transaction_by_transaction_id_exists') do
38
+ response = client.find_by_transaction_id(transaction_id)
39
+ expect(response).to be_success
40
+ expect(response.transaction).to eq(transaction_response)
41
+ end
42
+ end
43
+ end
44
+
45
+ context 'when not matching transaction is returned' do
46
+ let(:transaction_id) { '12345' }
47
+ it 'must return message and not success' do
48
+ VCR.use_cassette('find_transaction_by_transaction_id_not_exists') do
49
+ response = client.find_by_transaction_id(transaction_id)
50
+ expect(response).to_not be_success
51
+ expect(response.message).to eq('Pedido não localizado')
52
+ end
53
+ end
54
+ end
55
+ end
56
+
57
+ def transaction_response
58
+ {
59
+ "id_transacao"=>"123456",
60
+ "data_transacao"=>"07/10/2014",
61
+ "data_credito"=>"22/10/2014",
62
+ "valor_original"=>"5.00",
63
+ "valor_loja"=>"4.77",
64
+ "valor_total"=>"5.00",
65
+ "desconto_programado"=>"0.00",
66
+ "desconto"=>"13.70",
67
+ "acrescimo"=>"0.00",
68
+ "cod_meio_pagamento"=>"1",
69
+ "meio_pagamento"=>"Visa",
70
+ "parcelas"=>"1",
71
+ "cod_status"=>"3",
72
+ "status"=>"Aprovada",
73
+ "data_alteracao_status"=>"07/10/2014 19:16:18",
74
+ "cliente_razao_social"=>"",
75
+ "cliente_nome_fantasia"=>"",
76
+ "cliente_nome"=>"José Comprador",
77
+ "cliente_email"=>"jose@hotmail.com",
78
+ "cliente_rg"=>"237382937",
79
+ "cliente_data_emissao_rg"=>"01/06/2007",
80
+ "cliente_orgao_emissor_rg"=>"SSP",
81
+ "cliente_estado_emissor_rg"=>"PR",
82
+ "cliente_cnpj"=>"",
83
+ "cliente_cpf"=>"07875183952",
84
+ "cliente_sexo"=>"M",
85
+ "cliente_data_nascimento"=>"12/12/1912",
86
+ "cliente_telefone"=>"4133333333",
87
+ "cliente_endereco"=>"Rua Agostinho Carlos, 1001",
88
+ "cliente_complemento"=>"",
89
+ "cliente_bairro"=>"",
90
+ "cliente_cidade"=>"Curitiba",
91
+ "cliente_estado"=>"PR",
92
+ "cliente_cep"=>"80002040",
93
+ "frete"=>"13.70",
94
+ "tipo_frete"=>"PAC",
95
+ "id_pedido"=>"1001",
96
+ "free"=>"",
97
+ "email_vendedor"=>"jose@vendedor.com",
98
+ "pedidos"=>[{"codigo_produto"=>"", "nome_produto"=>"Teste", "qtde"=>"1", "valor_total"=>"5.00", "extra"=>""}]
99
+ }
100
+ end
101
+ end
@@ -14,12 +14,13 @@ describe Bcash::Api::VerifyReturn do
14
14
  }
15
15
  }
16
16
 
17
- describe 'verify_return' do
17
+ describe '#verify_return' do
18
18
  context 'when data is valid' do
19
19
  it 'must return VERIFICADO from response and return verified is true' do
20
20
  VCR.use_cassette('verify_return_verified') do
21
21
  response = client.verify_return(data)
22
22
  expect(response).to be_verified
23
+ expect(response.message).to eq('VERIFICADO')
23
24
  end
24
25
  end
25
26
  end
@@ -34,6 +35,5 @@ describe Bcash::Api::VerifyReturn do
34
35
  end
35
36
  end
36
37
  end
37
-
38
38
  end
39
39
 
@@ -0,0 +1,40 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://contato%40minestore.com.br:AF3AISDkEF92ABCD820C37FEABCE1@www.pagamentodigital.com.br/transacao/consulta
6
+ body:
7
+ encoding: UTF-8
8
+ string: id_transacao=1001&tipo_retorno=2
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ Content-Type:
16
+ - text/html
17
+ Date:
18
+ - Wed, 08 Oct 2014 04:08:08 GMT
19
+ P3p:
20
+ - CP="CAO PSA OUR"
21
+ Server:
22
+ - Apache
23
+ Set-Cookie:
24
+ - ci_session_transacao=Ua%2BwkSQocWxuJnG4MNAcpiXAWXiQQ649UNCKtsKn0dZ6KArkQTuzAFbuV5tpHN4PGjZZ7lbcLZeGLHilwbAOWFSkpUWvGTz7BcFCVSPzBpPSOAIRh8kuKvxOMv98VAcKJXEsr2BhUa7YUhxxOqPgrnOvNzA82v0YqUxyV%2FSgwtf0K1p9S1G4WTGaD8AjnuE5nLgNQCFSNQmdGfKVcN9d8Jv5XLhj0P7V%2BuczKmdK9vAPm2n0sReR%2BG7l3GHPB68df5EEZNukQUAGZWWemAQYsxYUoy34rynNL%2FGd6flNCyr%2F%2FKHadjYdsUUzyL%2BeR%2BX01BTMzsgDlew%2BmdkNhR7Cu1hRQChznDcbYhdG7fAzir3Ih6sDA5fEgSl1LPHI2qAxCJolAVL44QboO4BXh6PoX%2BEHjuJrMYX0sJ81QSvR4INn58XT29%2F922hoCYWXHS5%2B8tgQafUPqu4A7GoPd7YAOMjLvuIVuZC02Oxcu%2B6ec9BpALXtokAgnOF8UKMNNNuFd1qzO0WtlthAMNAcP9sameHVbYKUdLlsTsU%3D;
25
+ expires=Wed, 08-Oct-2014 06:08:08 GMT; path=/; secure; httponly
26
+ Vary:
27
+ - Accept-Encoding
28
+ Content-Length:
29
+ - '1187'
30
+ Connection:
31
+ - keep-alive
32
+ body:
33
+ encoding: UTF-8
34
+ string: '{"transacao":{"id_transacao":"123456","data_transacao":"07\/10\/2014","data_credito":"22\/10\/2014","valor_original":"5.00","valor_loja":"4.77","valor_total":"5.00","desconto_programado":"0.00","desconto":"13.70","acrescimo":"0.00","cod_meio_pagamento":"1","meio_pagamento":"Visa","parcelas":"1","cod_status":"3","status":"Aprovada","data_alteracao_status":"07\/10\/2014
35
+ 19:16:18","cliente_razao_social":"","cliente_nome_fantasia":"","cliente_nome":"José
36
+ Comprador","cliente_email":"jose@hotmail.com","cliente_rg":"237382937","cliente_data_emissao_rg":"01\/06\/2007","cliente_orgao_emissor_rg":"SSP","cliente_estado_emissor_rg":"PR","cliente_cnpj":"","cliente_cpf":"07875183952","cliente_sexo":"M","cliente_data_nascimento":"12\/12\/1912","cliente_telefone":"4133333333","cliente_endereco":"Rua
37
+ Agostinho Carlos, 1001","cliente_complemento":"","cliente_bairro":"","cliente_cidade":"Curitiba","cliente_estado":"PR","cliente_cep":"80002040","frete":"13.70","tipo_frete":"PAC","id_pedido":"1001","free":"","email_vendedor":"jose@vendedor.com","pedidos":[{"codigo_produto":"","nome_produto":"Teste","qtde":"1","valor_total":"5.00","extra":""}]}}'
38
+ http_version:
39
+ recorded_at: Wed, 08 Oct 2014 04:08:08 GMT
40
+ recorded_with: VCR 2.9.2
@@ -0,0 +1,37 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://contato%40minestore.com.br:AF3AISDkEF92ABCD820C37FEABCE1@www.pagamentodigital.com.br/transacao/consulta
6
+ body:
7
+ encoding: UTF-8
8
+ string: id_transacao=12345&tipo_retorno=2
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 400
13
+ message: Bad Request
14
+ headers:
15
+ Content-Type:
16
+ - text/json; charset=UTF-8
17
+ Date:
18
+ - Wed, 08 Oct 2014 04:46:25 GMT
19
+ P3p:
20
+ - CP="CAO PSA OUR"
21
+ Server:
22
+ - Apache
23
+ Set-Cookie:
24
+ - ci_session_transacao=CDPDntFmCsWwljYclhOr4w3qoLd7PymJcevfmLwTGtB69Pdtt%2BQnOzP61K%2BHEylYVJk1K7AfZW4cghdWkUokmZaH6%2BfqvkUmgT12C0KbWwJeQko1We%2FBRslGyUepDbrH8W3fPoeb1B5jeBm4grwudP9yQBqCx52ovAGrCQtNa63IJ3f9yJbRnHyEsLpHF9HHzNM1EvW6MnHfPXgeuvESz%2FwFdsOQLXeEeEDkfqmM8SX37wYrLpWFalbCpGDPlrJe6zbtJV%2ByJlJIOBHxTCzA%2BoQoBZquVP8wDlY%2FOmJwner6XnhCmV35kssDZ1vcYxa8Ddn7IdJUTuVGRup0X9ijuhdFZCzgL7nM8CroGywfx52cMc7oU7Ex0P7nYlbb8unED2C4ct%2BqmI4rBFjVjmvOgwfBGrDZVxsrUR2UCZrQ7FT8KD0hmh6TxnUZIT0vSxIoPcfY%2F1s4%2FrOMgGeCx8MPtmNJhILJATjkRjfnoq4Roc7NXqdFhN2JGXeyHNgaM0YRCWbrt%2F4BaB3M3HiJiAByCh9Rdd6XVcu3Io%2BDDHPxOOQ%3D;
25
+ expires=Wed, 08-Oct-2014 06:46:25 GMT; path=/; secure; httponly
26
+ Content-Length:
27
+ - '66'
28
+ Connection:
29
+ - keep-alive
30
+ body:
31
+ encoding: ASCII-8BIT
32
+ string: !binary |-
33
+ eyJlcnJvIjp7ImNvZGlnbyI6IjIwMTUwMDMiLCJkZXNjcmljYW8iOiJQZWRp
34
+ ZG8gbsOjbyBsb2NhbGl6YWRvIn19
35
+ http_version:
36
+ recorded_at: Wed, 08 Oct 2014 04:46:25 GMT
37
+ recorded_with: VCR 2.9.2
@@ -0,0 +1,40 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://contato%40minestore.com.br:AF3AISDkEF92ABCD820C37FEABCE1@www.pagamentodigital.com.br/transacao/consulta
6
+ body:
7
+ encoding: UTF-8
8
+ string: id_pedido=1001&tipo_retorno=2
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ Content-Type:
16
+ - text/html
17
+ Date:
18
+ - Wed, 08 Oct 2014 04:08:08 GMT
19
+ P3p:
20
+ - CP="CAO PSA OUR"
21
+ Server:
22
+ - Apache
23
+ Set-Cookie:
24
+ - ci_session_transacao=Ua%2BwkSQocWxuJnG4MNAcpiXAWXiQQ649UNCKtsKn0dZ6KArkQTuzAFbuV5tpHN4PGjZZ7lbcLZeGLHilwbAOWFSkpUWvGTz7BcFCVSPzBpPSOAIRh8kuKvxOMv98VAcKJXEsr2BhUa7YUhxxOqPgrnOvNzA82v0YqUxyV%2FSgwtf0K1p9S1G4WTGaD8AjnuE5nLgNQCFSNQmdGfKVcN9d8Jv5XLhj0P7V%2BuczKmdK9vAPm2n0sReR%2BG7l3GHPB68df5EEZNukQUAGZWWemAQYsxYUoy34rynNL%2FGd6flNCyr%2F%2FKHadjYdsUUzyL%2BeR%2BX01BTMzsgDlew%2BmdkNhR7Cu1hRQChznDcbYhdG7fAzir3Ih6sDA5fEgSl1LPHI2qAxCJolAVL44QboO4BXh6PoX%2BEHjuJrMYX0sJ81QSvR4INn58XT29%2F922hoCYWXHS5%2B8tgQafUPqu4A7GoPd7YAOMjLvuIVuZC02Oxcu%2B6ec9BpALXtokAgnOF8UKMNNNuFd1qzO0WtlthAMNAcP9sameHVbYKUdLlsTsU%3D;
25
+ expires=Wed, 08-Oct-2014 06:08:08 GMT; path=/; secure; httponly
26
+ Vary:
27
+ - Accept-Encoding
28
+ Content-Length:
29
+ - '1187'
30
+ Connection:
31
+ - keep-alive
32
+ body:
33
+ encoding: UTF-8
34
+ string: '{"transacao":{"id_transacao":"123456","data_transacao":"07\/10\/2014","data_credito":"22\/10\/2014","valor_original":"5.00","valor_loja":"4.77","valor_total":"5.00","desconto_programado":"0.00","desconto":"13.70","acrescimo":"0.00","cod_meio_pagamento":"1","meio_pagamento":"Visa","parcelas":"1","cod_status":"3","status":"Aprovada","data_alteracao_status":"07\/10\/2014
35
+ 19:16:18","cliente_razao_social":"","cliente_nome_fantasia":"","cliente_nome":"José
36
+ Comprador","cliente_email":"jose@hotmail.com","cliente_rg":"237382937","cliente_data_emissao_rg":"01\/06\/2007","cliente_orgao_emissor_rg":"SSP","cliente_estado_emissor_rg":"PR","cliente_cnpj":"","cliente_cpf":"07875183952","cliente_sexo":"M","cliente_data_nascimento":"12\/12\/1912","cliente_telefone":"4133333333","cliente_endereco":"Rua
37
+ Agostinho Carlos, 1001","cliente_complemento":"","cliente_bairro":"","cliente_cidade":"Curitiba","cliente_estado":"PR","cliente_cep":"80002040","frete":"13.70","tipo_frete":"PAC","id_pedido":"1001","free":"","email_vendedor":"jose@vendedor.com","pedidos":[{"codigo_produto":"","nome_produto":"Teste","qtde":"1","valor_total":"5.00","extra":""}]}}'
38
+ http_version:
39
+ recorded_at: Wed, 08 Oct 2014 04:08:08 GMT
40
+ recorded_with: VCR 2.9.2
@@ -0,0 +1,37 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://contato%40minestore.com.br:AF3AISDkEF92ABCD820C37FEABCE1@www.pagamentodigital.com.br/transacao/consulta
6
+ body:
7
+ encoding: UTF-8
8
+ string: id_pedido=12345&tipo_retorno=2
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 400
13
+ message: Bad Request
14
+ headers:
15
+ Content-Type:
16
+ - text/json; charset=UTF-8
17
+ Date:
18
+ - Wed, 08 Oct 2014 04:20:34 GMT
19
+ P3p:
20
+ - CP="CAO PSA OUR"
21
+ Server:
22
+ - Apache
23
+ Set-Cookie:
24
+ - ci_session_transacao=t2QpLxDCUEL1uIKnIhvCzIF%2B%2FRyfTBI3JNQ0WpymaO7SPFiGpu8TSnNi30GTo5yy%2F8S%2F5DM%2FoUdoaOm94s4k39eYt6QLm0f9uf3I7Dvjvg72KHqMe%2FEW%2B1xDvj5qD7PHK4w6OmRmeCTEczJrvfDTw2RWdWRQ2sXvNDW%2Bm7La7taKyfnrxgT5z3WnMVBVkN4Uxs5hcLI%2FRGZ7Jd9G%2BC%2BQfAeRhKIzoie9g4GJJnTV9FPsJaQWUQnaU7CQvVbo1HYZIe1XurtOcaYVlihFrEgWUxqw3ScUoHGN2ULa%2FAN9iKwsO0ZST0nPhkBdTNle40DKbtkCF2XpSkUD695wubfCItXQ9X%2FF6ZORBVPslbrACnLvUbl%2FC1kZtkXdEUj7RjfFuXrTCRvfEhAWcAblF%2FlVammMVZZgkveFfUWdjBg%2FGDEB%2FbdEypOZVEpJHf3vYG%2Bl34ZcdgJ9AlqrezXDrxdpT4vJ8LUKfKvQcsTxnF5IciMeSIt5FzA6fWugxf06G5LtjubB9yivfO1J1uaWXloGcVoyyYQCg%2B5g0hQCcpNgXSI%3D;
25
+ expires=Wed, 08-Oct-2014 06:20:34 GMT; path=/; secure; httponly
26
+ Content-Length:
27
+ - '66'
28
+ Connection:
29
+ - keep-alive
30
+ body:
31
+ encoding: ASCII-8BIT
32
+ string: !binary |-
33
+ eyJlcnJvIjp7ImNvZGlnbyI6IjIwMTUwMDMiLCJkZXNjcmljYW8iOiJQZWRp
34
+ ZG8gbsOjbyBsb2NhbGl6YWRvIn19
35
+ http_version:
36
+ recorded_at: Wed, 08 Oct 2014 04:20:34 GMT
37
+ recorded_with: VCR 2.9.2
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bcash-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Raphael Costa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-02 00:00:00.000000000 Z
11
+ date: 2014-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -188,12 +188,14 @@ files:
188
188
  - lib/bcash/api/account_response.rb
189
189
  - lib/bcash/api/accounts.rb
190
190
  - lib/bcash/api/create_account_response.rb
191
+ - lib/bcash/api/find_transaction.rb
191
192
  - lib/bcash/api/request/account_creation_request.rb
192
193
  - lib/bcash/api/request/address_request.rb
193
194
  - lib/bcash/api/request/base_request.rb
194
195
  - lib/bcash/api/request/contact_request.rb
195
196
  - lib/bcash/api/request/person_request.rb
196
197
  - lib/bcash/api/response.rb
198
+ - lib/bcash/api/transaction_response.rb
197
199
  - lib/bcash/api/verify_return.rb
198
200
  - lib/bcash/api/verify_return_response.rb
199
201
  - lib/bcash/client.rb
@@ -202,10 +204,15 @@ files:
202
204
  - lib/bcash/helpers/request.rb
203
205
  - lib/bcash/version.rb
204
206
  - spec/cases/api_account_spec.rb
207
+ - spec/cases/api_find_transaction_spec.rb
205
208
  - spec/cases/api_verify_request_spec.rb
206
209
  - spec/cases/bcash_spec.rb
207
210
  - spec/spec_helper.rb
208
211
  - spec/vcr_cassettes/create_account_using_minimal_data.yml
212
+ - spec/vcr_cassettes/find_transaction_by_transaction_id_exists.yml
213
+ - spec/vcr_cassettes/find_transaction_by_transaction_id_not_exists.yml
214
+ - spec/vcr_cassettes/find_transaction_exists.yml
215
+ - spec/vcr_cassettes/find_transaction_not_exists.yml
209
216
  - spec/vcr_cassettes/search_account_return_authentication_failed.yml
210
217
  - spec/vcr_cassettes/search_account_return_mutiple.yml
211
218
  - spec/vcr_cassettes/search_account_return_not_found.yml
@@ -238,10 +245,15 @@ specification_version: 4
238
245
  summary: Wrapper gem to handle BCash and account creation
239
246
  test_files:
240
247
  - spec/cases/api_account_spec.rb
248
+ - spec/cases/api_find_transaction_spec.rb
241
249
  - spec/cases/api_verify_request_spec.rb
242
250
  - spec/cases/bcash_spec.rb
243
251
  - spec/spec_helper.rb
244
252
  - spec/vcr_cassettes/create_account_using_minimal_data.yml
253
+ - spec/vcr_cassettes/find_transaction_by_transaction_id_exists.yml
254
+ - spec/vcr_cassettes/find_transaction_by_transaction_id_not_exists.yml
255
+ - spec/vcr_cassettes/find_transaction_exists.yml
256
+ - spec/vcr_cassettes/find_transaction_not_exists.yml
245
257
  - spec/vcr_cassettes/search_account_return_authentication_failed.yml
246
258
  - spec/vcr_cassettes/search_account_return_mutiple.yml
247
259
  - spec/vcr_cassettes/search_account_return_not_found.yml