aceitafacil 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/README.md +1 -1
- data/aceitafacil.gemspec +1 -1
- data/lib/aceitafacil.rb +2 -2
- data/lib/aceitafacil/card.rb +2 -4
- data/lib/aceitafacil/payment.rb +5 -3
- data/lib/aceitafacil/version.rb +1 -1
- data/spec/aceitafacil/card_spec.rb +2 -2
- data/spec/aceitafacil/connection_spec.rb +1 -1
- data/spec/aceitafacil/payment_spec.rb +3 -2
- data/spec/aceitafacil/vendor_spec.rb +9 -7
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
ZGNhYTVlYzUyMWRiYWNiNGY4YTdlMDU5N2M0ZTg1YjY0M2M0NTY1ZA==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 71530145a6fb4cb77dd89fad3f46cdc4fd2b9e41
|
4
|
+
data.tar.gz: 750abf3795f0054d428c3828be181ac21d49bcf7
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
ZmE2YWZlYTkwMjg4ZjYxZTEwMzQ0MjhkYzc5OTM2NmRjOGY5MmRjOTdhNThj
|
11
|
-
ODA4MmEyMmY0MDU2OGM2NjQ1NDI3MDExMTgzMmY2ZWJmOTBlMDQ=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
OWM1YzkyZjE1NTM1NTVlN2Y0MGExMjZhNjg0ODMyYmI0MjMwODQxNTcyZjc4
|
14
|
-
NjM2ZWRlNWE5NWI3M2VkZmQ0NDc4MTQ5M2IzOTJmYTM0NjE3N2E2ZjczNDU2
|
15
|
-
ZWZkMDAxYWM0N2RkYjEyYzUzZTA3MmU3MGMwMmM0YjE1YTI1OWU=
|
6
|
+
metadata.gz: 5d2c8a60cf4a1bfe4e8211c87390511bd669ead31f91586220ec703fc75509caa97b71323cba382d96b0475f71f2d1c49b806d241ef79624addb95385aaef824
|
7
|
+
data.tar.gz: 10992a6a4a9212228dc236ce8ed33dea2323e49712f0164b67a5c0c85497dd00b59125c70dc2ae9593e94f131a7d4b3de311a482e2ddae01bd7ca426622105e2
|
data/README.md
CHANGED
@@ -42,7 +42,7 @@ O id: refere-se ao ID do vendedor na base de dados da aplicação Host. O objeto
|
|
42
42
|
|
43
43
|
Implemente um formulário para capturar os dados do cartão de crédito. Segue um exemplo:
|
44
44
|
|
45
|
-
@card = Aceitafacil::Card.new(name: "Card Holder", number: "4012001038443335",
|
45
|
+
@card = Aceitafacil::Card.new(name: "Card Holder", number: "4012001038443335", exp_date: "201807", customer_id: "1")
|
46
46
|
@card.save
|
47
47
|
|
48
48
|
O customer_id reference ao ID do cliente no banco de dados da aplicação Host.
|
data/aceitafacil.gemspec
CHANGED
@@ -27,5 +27,5 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_development_dependency "rspec-rails", "2.14.2"
|
28
28
|
spec.add_development_dependency "fakeweb", "1.3.0"
|
29
29
|
spec.add_development_dependency "factory_girl_rails", "4.4.0"
|
30
|
-
spec.add_development_dependency "
|
30
|
+
spec.add_development_dependency "byebug", "3.1.2"
|
31
31
|
end
|
data/lib/aceitafacil.rb
CHANGED
@@ -22,9 +22,9 @@ module Aceitafacil
|
|
22
22
|
|
23
23
|
@@environment = :test
|
24
24
|
mattr_accessor :environment
|
25
|
-
@@api_key = "
|
25
|
+
@@api_key = "c3794e9a24b4f302d8c2f2fd77db345122295905"
|
26
26
|
mattr_accessor :api_key
|
27
|
-
@@api_password = "
|
27
|
+
@@api_password = "34e066b02fc6443575f12ff0bb3af876e52f19ba"
|
28
28
|
mattr_accessor :api_password
|
29
29
|
|
30
30
|
def self.setup
|
data/lib/aceitafacil/card.rb
CHANGED
@@ -5,10 +5,10 @@ module Aceitafacil
|
|
5
5
|
include ActiveModel::Model
|
6
6
|
include ActiveModel::Validations
|
7
7
|
|
8
|
-
validates :customer_id, :number, :name, :
|
8
|
+
validates :customer_id, :number, :name, :exp_date, presence: true
|
9
9
|
validates :exp_date, format: { with: /\d{6}/ }
|
10
10
|
|
11
|
-
attr_accessor :customer_id, :number, :name, :
|
11
|
+
attr_accessor :customer_id, :number, :name, :exp_date
|
12
12
|
attr_accessor :token, :card_brand, :last_digits, :status
|
13
13
|
|
14
14
|
def self.find_by_customer_id(customer_id)
|
@@ -59,7 +59,6 @@ module Aceitafacil
|
|
59
59
|
self.customer_id = params[:customer_id]
|
60
60
|
self.number = params[:number]
|
61
61
|
self.name = params[:name]
|
62
|
-
self.cvv = params[:cvv]
|
63
62
|
self.exp_date = params[:exp_date]
|
64
63
|
self.status = params[:status]
|
65
64
|
self.token = params[:token]
|
@@ -73,7 +72,6 @@ module Aceitafacil
|
|
73
72
|
params["customer[id]"] = self.customer_id
|
74
73
|
params["card[name]"] = self.name
|
75
74
|
params["card[number]"] = self.number
|
76
|
-
params["card[cvv]"] = self.cvv
|
77
75
|
params["card[exp_date]"] = self.exp_date
|
78
76
|
|
79
77
|
return params
|
data/lib/aceitafacil/payment.rb
CHANGED
@@ -5,10 +5,10 @@ module Aceitafacil
|
|
5
5
|
include ActiveModel::Validations
|
6
6
|
include ActiveModel::Model
|
7
7
|
|
8
|
-
validates :
|
9
|
-
validates :
|
8
|
+
validates :customer_id, :cvv, presence: true
|
9
|
+
validates :paymentmethod_id, :total_amount, presence: true
|
10
10
|
|
11
|
-
attr_accessor :card_token, :customer_id, :customer_name, :customer_email, :customer_email_language
|
11
|
+
attr_accessor :card_token, :cvv, :customer_id, :customer_name, :customer_email, :customer_email_language
|
12
12
|
attr_accessor :organization_id, :organization_name, :paymentmethod, :charge_type, :payer, :total_amount
|
13
13
|
attr_accessor :paid, :closed, :attempted, :attempted_count, :next_payment_attempt, :period_start
|
14
14
|
attr_accessor :period_end, :items, :id, :description, :paymentmethod_id, :chargetype
|
@@ -17,6 +17,7 @@ module Aceitafacil
|
|
17
17
|
@connection = Aceitafacil::Connection.new
|
18
18
|
|
19
19
|
self.card_token = params[:card_token]
|
20
|
+
self.cvv = params[:cvv]
|
20
21
|
self.customer_id = params[:customer_id]
|
21
22
|
self.customer_name = params[:customer_name]
|
22
23
|
self.customer_email = params[:customer_email]
|
@@ -31,6 +32,7 @@ module Aceitafacil
|
|
31
32
|
params = {}
|
32
33
|
|
33
34
|
params["card[token]"] = self.card_token
|
35
|
+
params["card[cvv]"] = self.cvv
|
34
36
|
params["customer[id]"] = self.customer_id.to_i
|
35
37
|
params["customer[name]"] = self.customer_name unless self.customer_name.blank?
|
36
38
|
params["customer[email]"] = self.customer_email unless self.customer_name.blank?
|
data/lib/aceitafacil/version.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Aceitafacil::Card do
|
4
|
-
let(:card_params) { { name: "Card Holder", number: "4012001038443335",
|
4
|
+
let(:card_params) { { name: "Card Holder", number: "4012001038443335", exp_date: "201807", customer_id: "1" } }
|
5
5
|
|
6
6
|
before do
|
7
7
|
@card = Aceitafacil::Card.new(card_params)
|
@@ -17,7 +17,7 @@ describe Aceitafacil::Card do
|
|
17
17
|
it "should return message erros for fields" do
|
18
18
|
@invalid = Aceitafacil::Card.new
|
19
19
|
@invalid.valid?
|
20
|
-
[:customer_id, :number, :name, :
|
20
|
+
[:customer_id, :number, :name, :exp_date].each do |key|
|
21
21
|
@invalid.errors.messages.keys.should include(key)
|
22
22
|
end
|
23
23
|
end
|
@@ -16,7 +16,7 @@ describe Aceitafacil::Connection do
|
|
16
16
|
|
17
17
|
describe "making a request" do
|
18
18
|
it "should make a request" do
|
19
|
-
@card = Aceitafacil::Card.new(name: "Card Holder", number: "4012001038443335",
|
19
|
+
@card = Aceitafacil::Card.new(name: "Card Holder", number: "4012001038443335", exp_date: "201807", customer_id: "1")
|
20
20
|
response = @connection.post(:card, @card.params)
|
21
21
|
response.body.should_not be_nil
|
22
22
|
response.should be_kind_of Net::HTTPOK
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
describe Aceitafacil::Payment do
|
6
|
-
let(:card_params) { { name: "Card Holder", number: "4012001038443335",
|
6
|
+
let(:card_params) { { name: "Card Holder", number: "4012001038443335", exp_date: "201807", customer_id: "1" } }
|
7
7
|
|
8
8
|
let(:bank_params) {
|
9
9
|
{
|
@@ -48,7 +48,8 @@ describe Aceitafacil::Payment do
|
|
48
48
|
paymentmethod_id: 1, # 1 Credit Card, 2 billet
|
49
49
|
total_amount: 10,
|
50
50
|
items: [@item],
|
51
|
-
card_token: @card.token
|
51
|
+
card_token: @card.token,
|
52
|
+
cvv: "123"
|
52
53
|
}
|
53
54
|
}
|
54
55
|
|
@@ -74,6 +74,8 @@ describe Aceitafacil::Vendor do
|
|
74
74
|
|
75
75
|
describe "making a update call" do
|
76
76
|
it do
|
77
|
+
@vendor.save
|
78
|
+
|
77
79
|
response = @vendor.update
|
78
80
|
|
79
81
|
response.should be_kind_of Net::HTTPSuccess
|
@@ -88,11 +90,11 @@ describe Aceitafacil::Vendor do
|
|
88
90
|
end
|
89
91
|
end
|
90
92
|
|
91
|
-
describe "making a save call" do
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
end
|
93
|
+
# describe "making a save call" do
|
94
|
+
# it "should create a new remote vendor" do
|
95
|
+
# response = @vendor.save
|
96
|
+
# puts response.inspect
|
97
|
+
# response.should be_kind_of Net::HTTPOK
|
98
|
+
# end
|
99
|
+
# end
|
98
100
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aceitafacil
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wilbert Ribeiro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -56,14 +56,14 @@ dependencies:
|
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '1.5'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.5'
|
69
69
|
- !ruby/object:Gem::Dependency
|
@@ -123,27 +123,27 @@ dependencies:
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: 4.4.0
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
126
|
+
name: byebug
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - '='
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 1.
|
131
|
+
version: 3.1.2
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - '='
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: 1.
|
139
|
-
description:
|
138
|
+
version: 3.1.2
|
139
|
+
description: " It implements Cards and Payments from aceitaFacil doc spec. "
|
140
140
|
email:
|
141
141
|
- wkelyson@gmail.com
|
142
142
|
executables: []
|
143
143
|
extensions: []
|
144
144
|
extra_rdoc_files: []
|
145
145
|
files:
|
146
|
-
- .gitignore
|
146
|
+
- ".gitignore"
|
147
147
|
- Gemfile
|
148
148
|
- LICENSE
|
149
149
|
- README.md
|
@@ -176,12 +176,12 @@ require_paths:
|
|
176
176
|
- lib
|
177
177
|
required_ruby_version: !ruby/object:Gem::Requirement
|
178
178
|
requirements:
|
179
|
-
- -
|
179
|
+
- - ">="
|
180
180
|
- !ruby/object:Gem::Version
|
181
181
|
version: '0'
|
182
182
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
183
183
|
requirements:
|
184
|
-
- -
|
184
|
+
- - ">="
|
185
185
|
- !ruby/object:Gem::Version
|
186
186
|
version: '0'
|
187
187
|
requirements: []
|