rents 0.1.11 → 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 +4 -4
- data/lib/rents/version.rb +3 -3
- data/spec/rents/transaction_spec.rb +78 -50
- 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: e06c58eb1321502e8141b471a5aba0b782406cb4
|
4
|
+
data.tar.gz: 338f971e9e496295b298b6178d801b37139c7d08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73c6a89696092ab521a65ffd26b054120748df24b49dd59d769a4b76146547ac58f7011eb7da059b7540194d47e87b7ff2a2610f6d724036416d26cc32413798
|
7
|
+
data.tar.gz: 510f56ab6d54b8a9292743759ca2e6c4398da68866ffb0ca9dfea7c057e80e5457884c6f0ac60368fbec348ab40f1abefaa3d1a430d59ea25cc6e9dd204bae60
|
data/lib/rents/version.rb
CHANGED
@@ -135,6 +135,28 @@ describe Rents::Transaction do
|
|
135
135
|
it 'resp should not be null' do
|
136
136
|
expect(@resp).to_not be_nil
|
137
137
|
end
|
138
|
+
|
139
|
+
it 'resp should have a full SUCCESSFUL transaction status' do
|
140
|
+
status = @resp[:status]
|
141
|
+
expect(status[:name]).to eq('charged')
|
142
|
+
expect(status[:code]).to eq(6) # TODO change it to ENUM
|
143
|
+
expect(status[:msg].index('Capturada').nil?).to_not be_truthy
|
144
|
+
end
|
145
|
+
|
146
|
+
it 'resp should have a full CardObj which is allowed to be stored {:rid, :truncated, :flag}' do
|
147
|
+
card = @resp[:card]
|
148
|
+
expect(card[:rid]).to be_a Integer
|
149
|
+
expect(card[:rid] == 0).to_not be_truthy
|
150
|
+
expect(card[:brand_mark]).to eq('visa')
|
151
|
+
expect(card[:truncated].index('***')).to_not be_nil
|
152
|
+
end
|
153
|
+
|
154
|
+
it 'resp should have the remote reference (TransactionRID)' do
|
155
|
+
rid = @resp[:rid]
|
156
|
+
expect(rid).to_not be_nil
|
157
|
+
expect(rid).to be_a Integer
|
158
|
+
expect(rid != 0).to be_truthy
|
159
|
+
end
|
138
160
|
end
|
139
161
|
|
140
162
|
# TRANSACTION DENIED example
|
@@ -149,16 +171,16 @@ describe Rents::Transaction do
|
|
149
171
|
amount = "#{amount}71" if amount[amount.length-2, amount.length] == '00'
|
150
172
|
|
151
173
|
@store_transaction = Rents::Transaction.new({
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
174
|
+
card:{
|
175
|
+
flag: 'visa',
|
176
|
+
cvv: '321',
|
177
|
+
expiration_month: '05',
|
178
|
+
expiration_year: '2018',
|
179
|
+
number: '9999999999999999',
|
180
|
+
holder: Faker::Name.name,
|
181
|
+
},
|
182
|
+
|
183
|
+
amount: amount
|
162
184
|
})
|
163
185
|
|
164
186
|
# Fake SoldItems added
|
@@ -173,65 +195,71 @@ describe Rents::Transaction do
|
|
173
195
|
expect(@resp).to_not be_nil
|
174
196
|
end
|
175
197
|
|
176
|
-
it 'should
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
expect(@resp.purchase_url).to_not be_nil
|
198
|
+
it 'resp should have a full SUCCESSFUL transaction status' do
|
199
|
+
status = @resp[:status]
|
200
|
+
expect(status[:name]).to eq('error')
|
201
|
+
expect(status[:code]).to eq(5) # TODO change it to ENUM
|
202
|
+
expect(status[:msg].index('não').nil?).to_not be_truthy
|
182
203
|
end
|
183
204
|
|
184
|
-
it 'resp should
|
185
|
-
|
186
|
-
|
187
|
-
expect(
|
205
|
+
it 'resp should have a full CardObj which is allowed to be stored {:rid, :truncated, :flag}' do
|
206
|
+
card = @resp[:card]
|
207
|
+
expect(card[:rid]).to be_nil
|
208
|
+
expect(card[:brand_mark]).to eq('visa')
|
209
|
+
expect(card[:truncated].index('***')).to_not be_nil
|
188
210
|
end
|
189
211
|
|
190
|
-
it 'resp should
|
191
|
-
|
192
|
-
|
193
|
-
expect(
|
194
|
-
expect(
|
195
|
-
end
|
196
|
-
|
197
|
-
it 'must be verifiable' do
|
198
|
-
# SetUps
|
199
|
-
verify_resp = @page_transaction.verify
|
200
|
-
error = verify_resp[:error]
|
201
|
-
error = verify_resp['error'] if error.nil?
|
202
|
-
|
203
|
-
# Validations
|
204
|
-
expect(verify_resp).to_not be_nil
|
205
|
-
expect(error).to be_nil
|
206
|
-
end
|
207
|
-
|
208
|
-
it 'must have a get accessible URL request' do
|
209
|
-
url = @page_transaction.url_requested+@page_transaction.request_params.it_keys_to_get_param
|
210
|
-
expect(be_accessible(url)).to be_truthy
|
212
|
+
it 'resp should have the remote reference (TransactionRID)' do
|
213
|
+
rid = @resp[:rid]
|
214
|
+
expect(rid).to_not be_nil
|
215
|
+
expect(rid).to be_a Integer
|
216
|
+
expect(rid != 0).to be_truthy
|
211
217
|
end
|
212
218
|
end
|
213
219
|
|
214
220
|
# NOT_OK on the authentication Store Page tests
|
215
221
|
describe '(BAD REQUEST) Store - BuyPage' do
|
216
222
|
# SetUp/Config
|
217
|
-
before(:
|
223
|
+
before(:all) do
|
218
224
|
Rents.test_env = false
|
219
225
|
Rents.debugger = false
|
220
226
|
Rents.app_id = 1
|
221
227
|
Rents.secret_key = '12312321312$2a$10$NmV9EysKVLe8ItBdl9CHN.LF05bOuDdoOkmfptdbJs7cuaDWksuUu'
|
222
|
-
base_url = 'http://localhost:7000'
|
223
228
|
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
+
amount = Random.rand(99999).to_s
|
230
|
+
amount = "#{amount}00" if amount[amount.length-2, amount.length] != '00'
|
231
|
+
|
232
|
+
@store_transaction = Rents::Transaction.new({
|
233
|
+
card:{
|
234
|
+
flag: 'visa',
|
235
|
+
cvv: '321',
|
236
|
+
expiration_month: '05',
|
237
|
+
expiration_year: '2018',
|
238
|
+
number: '9999999999999999',
|
239
|
+
holder: Faker::Name.name,
|
240
|
+
},
|
241
|
+
|
242
|
+
amount: amount
|
229
243
|
})
|
230
244
|
|
231
|
-
#
|
232
|
-
@
|
245
|
+
# Fake SoldItems added
|
246
|
+
@store_transaction.sold_items = fake_sold_items
|
247
|
+
|
248
|
+
# Send StoreCharge
|
249
|
+
@resp = @store_transaction.charge_store
|
233
250
|
end
|
234
251
|
|
235
252
|
# ================ Tests/Expects/Should ================
|
253
|
+
it 'resp should exist (do not be empty)' do
|
254
|
+
expect(@resp).to_not be_nil
|
255
|
+
end
|
256
|
+
|
257
|
+
it 'resp should contain auth error' do
|
258
|
+
error = @resp[:error].downcase
|
259
|
+
expect(error).to_not be_nil
|
260
|
+
expect(error.index('auth error').nil?).to_not be_truthy
|
261
|
+
expect(error.index('AppID'.downcase).nil?).to_not be_truthy
|
262
|
+
expect(error.index('SecretKey'.downcase).nil?).to_not be_truthy
|
263
|
+
end
|
236
264
|
end
|
237
265
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rents
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ilton Garcia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|