braspag-pagador 0.9.6 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -64,9 +64,7 @@ module BraspagPagador
64
64
  braspag_url + "/BraspagGeneralService/BraspagGeneralService.asmx"
65
65
  when :save_credit_card
66
66
  protected_card_url + "/CartaoProtegido.asmx?wsdl"
67
- when :get_card
68
- protected_card_url + "/CartaoProtegido.asmx/GetCreditCard"
69
- when :recurrency
67
+ when :get_credit_card
70
68
  protected_card_url + "/CartaoProtegido.asmx?wsdl"
71
69
  end
72
70
  end
@@ -94,7 +92,7 @@ module BraspagPagador
94
92
 
95
93
  def convert(method_name, direction, args)
96
94
  target = case method_name
97
- when :authorize, :void, :capture, :save_credit_card, :get_card, :recurrency
95
+ when :authorize, :void, :capture, :save_credit_card, :get_credit_card, :authorize_saved_credit_card
98
96
  CreditCard
99
97
  when :generate_billet
100
98
  Billet
@@ -76,8 +76,8 @@ module BraspagPagador
76
76
  validates :year, :expirator => { :on => check_on }
77
77
  end
78
78
 
79
- [:purchase, :authorize, :recurrency].each do |check_on|
80
- validates :verification_value, :length => {:minimum => 1, :maximum => 4, :on => check_on}
79
+ [:purchase, :authorize].each do |check_on|
80
+ # validates :verification_value, :length => {:minimum => 1, :maximum => 4, :on => check_on}
81
81
  end
82
82
 
83
83
  [:get_recurrency, :recurrency].each do |check_on|
@@ -91,7 +91,7 @@ module BraspagPagador
91
91
  'CustomerName' => customer.name.to_s,
92
92
  'CardHolder' => credit_card.holder_name.to_s,
93
93
  'CardNumber' => credit_card.number.to_s,
94
- 'CardExpiration' => "#{credit_card.month}/#{credit_card.year}",
94
+ 'CardExpiration' => "#{format('%02d', credit_card.month)}/#{credit_card.year}",
95
95
  'RequestId' => request_id
96
96
  }
97
97
  }
@@ -102,6 +102,20 @@ module BraspagPagador
102
102
  params[:save_credit_card_response][:save_credit_card_result]
103
103
  end
104
104
 
105
+ def self.to_get_credit_card(connection,just_click_key)
106
+ {
107
+ 'getCreditCardRequestWS' => {
108
+ 'MerchantKey' => connection.merchant_id,
109
+ 'JustClickKey' => just_click_key
110
+ }
111
+ }
112
+ end
113
+
114
+ def self.from_get_credit_card(connection,just_click_key,params)
115
+ params = params.body
116
+ params[:get_credit_card_response][:get_credit_card_result]
117
+ end
118
+
105
119
  def self.to_authorize(connection, order, credit_card)
106
120
  year_normalize = credit_card.year.to_s[-2, 2]
107
121
  {
@@ -7,13 +7,36 @@ module BraspagPagador
7
7
  ActiveMerchant::Billing::Response.new(status,nil,response,:test => homologation?)
8
8
  end
9
9
 
10
- # request the credit card info in Braspag PCI Compliant
11
- def get_recurrency(credit_card)
10
+ def get_credit_card(just_click_key)
11
+ response = self.soap_request(:get_credit_card, just_click_key)
12
+ status = response[:success]
12
13
 
14
+ if status
15
+ expire_month, expire_year = response[:card_expiration].split('/')
16
+ response = BraspagPagador::CreditCard.new(
17
+ holder_name: response[:card_holder],
18
+ number: response[:card_number],
19
+ month: expire_month,
20
+ year: expire_year
21
+ )
22
+ else
23
+ ActiveMerchant::Billing::Response.new(status,nil,response,:test => homologation?)
24
+ end
13
25
  end
14
26
 
15
- def recurrency(order, credit_card, request_id)
27
+ def authorize_saved_credit_card(order,just_click_key)
28
+ credit_card = get_credit_card(just_click_key)
29
+
30
+ response = self.post(:authorize, order, credit_card)
16
31
 
32
+ status = (response[:status] == "0" || response[:status] == "1")
33
+
34
+ ActiveMerchant::Billing::Response.new(status,
35
+ response[:message],
36
+ response,
37
+ :test => homologation?,
38
+ :authorization => response[:number])
17
39
  end
40
+
18
41
  end
19
42
  end
@@ -1,3 +1,3 @@
1
1
  module BraspagPagador
2
- VERSION = "0.9.6"
2
+ VERSION = "1.0.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: braspag-pagador
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.6
4
+ version: 1.0.0
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - CodeMiner42
@@ -11,81 +12,92 @@ authors:
11
12
  autorequire:
12
13
  bindir: bin
13
14
  cert_chain: []
14
- date: 2013-06-24 00:00:00.000000000 Z
15
+ date: 2013-07-09 00:00:00.000000000 Z
15
16
  dependencies:
16
17
  - !ruby/object:Gem::Dependency
17
18
  name: activemerchant
18
19
  requirement: !ruby/object:Gem::Requirement
20
+ none: false
19
21
  requirements:
20
- - - '>='
22
+ - - ! '>='
21
23
  - !ruby/object:Gem::Version
22
24
  version: 1.28.0
23
25
  type: :runtime
24
26
  prerelease: false
25
27
  version_requirements: !ruby/object:Gem::Requirement
28
+ none: false
26
29
  requirements:
27
- - - '>='
30
+ - - ! '>='
28
31
  - !ruby/object:Gem::Version
29
32
  version: 1.28.0
30
33
  - !ruby/object:Gem::Dependency
31
34
  name: active_attr
32
35
  requirement: !ruby/object:Gem::Requirement
36
+ none: false
33
37
  requirements:
34
- - - '>='
38
+ - - ! '>='
35
39
  - !ruby/object:Gem::Version
36
40
  version: '0.6'
37
41
  type: :runtime
38
42
  prerelease: false
39
43
  version_requirements: !ruby/object:Gem::Requirement
44
+ none: false
40
45
  requirements:
41
- - - '>='
46
+ - - ! '>='
42
47
  - !ruby/object:Gem::Version
43
48
  version: '0.6'
44
49
  - !ruby/object:Gem::Dependency
45
50
  name: httpi
46
51
  requirement: !ruby/object:Gem::Requirement
52
+ none: false
47
53
  requirements:
48
- - - '>='
54
+ - - ! '>='
49
55
  - !ruby/object:Gem::Version
50
56
  version: 0.9.6
51
57
  type: :runtime
52
58
  prerelease: false
53
59
  version_requirements: !ruby/object:Gem::Requirement
60
+ none: false
54
61
  requirements:
55
- - - '>='
62
+ - - ! '>='
56
63
  - !ruby/object:Gem::Version
57
64
  version: 0.9.6
58
65
  - !ruby/object:Gem::Dependency
59
66
  name: json
60
67
  requirement: !ruby/object:Gem::Requirement
68
+ none: false
61
69
  requirements:
62
- - - '>='
70
+ - - ! '>='
63
71
  - !ruby/object:Gem::Version
64
72
  version: 1.6.1
65
73
  type: :runtime
66
74
  prerelease: false
67
75
  version_requirements: !ruby/object:Gem::Requirement
76
+ none: false
68
77
  requirements:
69
- - - '>='
78
+ - - ! '>='
70
79
  - !ruby/object:Gem::Version
71
80
  version: 1.6.1
72
81
  - !ruby/object:Gem::Dependency
73
82
  name: nokogiri
74
83
  requirement: !ruby/object:Gem::Requirement
84
+ none: false
75
85
  requirements:
76
- - - '>='
86
+ - - ! '>='
77
87
  - !ruby/object:Gem::Version
78
88
  version: 1.4.7
79
89
  type: :runtime
80
90
  prerelease: false
81
91
  version_requirements: !ruby/object:Gem::Requirement
92
+ none: false
82
93
  requirements:
83
- - - '>='
94
+ - - ! '>='
84
95
  - !ruby/object:Gem::Version
85
96
  version: 1.4.7
86
97
  - !ruby/object:Gem::Dependency
87
98
  name: savon
88
99
  requirement: !ruby/object:Gem::Requirement
100
+ none: false
89
101
  requirements:
90
102
  - - ~>
91
103
  - !ruby/object:Gem::Version
@@ -93,6 +105,7 @@ dependencies:
93
105
  type: :runtime
94
106
  prerelease: false
95
107
  version_requirements: !ruby/object:Gem::Requirement
108
+ none: false
96
109
  requirements:
97
110
  - - ~>
98
111
  - !ruby/object:Gem::Version
@@ -100,60 +113,68 @@ dependencies:
100
113
  - !ruby/object:Gem::Dependency
101
114
  name: rake
102
115
  requirement: !ruby/object:Gem::Requirement
116
+ none: false
103
117
  requirements:
104
- - - '>='
118
+ - - ! '>='
105
119
  - !ruby/object:Gem::Version
106
120
  version: '0'
107
121
  type: :development
108
122
  prerelease: false
109
123
  version_requirements: !ruby/object:Gem::Requirement
124
+ none: false
110
125
  requirements:
111
- - - '>='
126
+ - - ! '>='
112
127
  - !ruby/object:Gem::Version
113
128
  version: '0'
114
129
  - !ruby/object:Gem::Dependency
115
130
  name: rspec
116
131
  requirement: !ruby/object:Gem::Requirement
132
+ none: false
117
133
  requirements:
118
- - - '>='
134
+ - - ! '>='
119
135
  - !ruby/object:Gem::Version
120
136
  version: '0'
121
137
  type: :development
122
138
  prerelease: false
123
139
  version_requirements: !ruby/object:Gem::Requirement
140
+ none: false
124
141
  requirements:
125
- - - '>='
142
+ - - ! '>='
126
143
  - !ruby/object:Gem::Version
127
144
  version: '0'
128
145
  - !ruby/object:Gem::Dependency
129
146
  name: simplecov
130
147
  requirement: !ruby/object:Gem::Requirement
148
+ none: false
131
149
  requirements:
132
- - - '>='
150
+ - - ! '>='
133
151
  - !ruby/object:Gem::Version
134
152
  version: '0'
135
153
  type: :development
136
154
  prerelease: false
137
155
  version_requirements: !ruby/object:Gem::Requirement
156
+ none: false
138
157
  requirements:
139
- - - '>='
158
+ - - ! '>='
140
159
  - !ruby/object:Gem::Version
141
160
  version: '0'
142
161
  - !ruby/object:Gem::Dependency
143
162
  name: pry
144
163
  requirement: !ruby/object:Gem::Requirement
164
+ none: false
145
165
  requirements:
146
- - - '>='
166
+ - - ! '>='
147
167
  - !ruby/object:Gem::Version
148
168
  version: '0'
149
169
  type: :development
150
170
  prerelease: false
151
171
  version_requirements: !ruby/object:Gem::Requirement
172
+ none: false
152
173
  requirements:
153
- - - '>='
174
+ - - ! '>='
154
175
  - !ruby/object:Gem::Version
155
176
  version: '0'
156
- description: 'Braspag: brazilian gateway, agnostic, support all features in braspag'
177
+ description: ! 'Braspag: brazilian gateway, agnostic, support all features in braspag'
157
178
  email:
158
179
  - contato@codeminer42.com
159
180
  - renato.elias@gmail.com
@@ -254,27 +275,28 @@ files:
254
275
  - spec/spec_helper.rb
255
276
  homepage: http://github.com/raphaelcosta/braspag-pagador
256
277
  licenses: []
257
- metadata: {}
258
278
  post_install_message:
259
279
  rdoc_options: []
260
280
  require_paths:
261
281
  - lib
262
282
  required_ruby_version: !ruby/object:Gem::Requirement
283
+ none: false
263
284
  requirements:
264
- - - '>='
285
+ - - ! '>='
265
286
  - !ruby/object:Gem::Version
266
287
  version: '0'
267
288
  required_rubygems_version: !ruby/object:Gem::Requirement
289
+ none: false
268
290
  requirements:
269
- - - '>='
291
+ - - ! '>='
270
292
  - !ruby/object:Gem::Version
271
293
  version: '0'
272
294
  requirements: []
273
295
  rubyforge_project: nowarning
274
- rubygems_version: 2.0.0
296
+ rubygems_version: 1.8.25
275
297
  signing_key:
276
- specification_version: 4
277
- summary: 'Braspag: brazilian gateway, agnostic, support all features in braspag'
298
+ specification_version: 3
299
+ summary: ! 'Braspag: brazilian gateway, agnostic, support all features in braspag'
278
300
  test_files:
279
301
  - spec/core/connection_spec.rb
280
302
  - spec/core/converter_spec.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 40c19d878ac6ea45af6118e4f9e6c42a6df6dc22
4
- data.tar.gz: 241c79d0788c88fb85fe606ede2213395e714859
5
- SHA512:
6
- metadata.gz: 2b680998c1e74233247828bc5abbe6a51336ac34ae4e85c524ed71b914b562e1ab1c3d840aa6c179bd54a8cd0f4189ec16c95aa4564d4b5d81ae20fc85a51357
7
- data.tar.gz: e29baa46f5748299f67c1ea3065de163cb83e5d9c445828394cbf323f8726f49653675926225f5956479aec8a6de93c9aafb504297fd4fba684fb3645e06d1db