nitro_pay 1.0.9 → 1.0.10
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/.gitignore +0 -1
- data/Gemfile +3 -3
- data/lib/nitro_pay/config/proxy.yml +4 -0
- data/lib/nitro_pay/connection.rb +8 -8
- data/lib/nitro_pay/transaction.rb +9 -8
- data/lib/nitro_pay/version.rb +1 -1
- data/spec/nitro_pay/transaction_spec.rb +6 -10
- metadata +4 -4
- data/lib/nitro_pay/config/proxy.example.yml +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66e32f810e2b5cf2a581015aeb16213681156709
|
4
|
+
data.tar.gz: d09157450a076fd4e39a6e23b10f757594a0f3b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77ffc4020ca0977832a414a835c6758c3cfa85075d502e4c0d6901bea0443acc27c6c64b078c987876ea62da125da8e1c75840364925f6c4f79d826affe748f0
|
7
|
+
data.tar.gz: 46af32d895178e60107d6d5328b75f9e03cf09114e8390b9b1969c370893546db27304706058ef51ebae90e32be2c7c1f98897052973089ae8bcee1ece72023f
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/lib/nitro_pay/connection.rb
CHANGED
@@ -19,7 +19,6 @@ module NitroPay
|
|
19
19
|
|
20
20
|
# Static part
|
21
21
|
self.request_params = {transaction:params}
|
22
|
-
setup_config
|
23
22
|
self.domain = 'pay.nitrostart.me'
|
24
23
|
|
25
24
|
# If using test or Debug it is not production
|
@@ -37,6 +36,9 @@ module NitroPay
|
|
37
36
|
|
38
37
|
# Dynamic env
|
39
38
|
setup_default_app if params[:test_env]
|
39
|
+
|
40
|
+
# Setups
|
41
|
+
setup_config
|
40
42
|
setup_attrs(params)
|
41
43
|
self.recurrent_tid = params[:tid] unless params[:tid].nil?
|
42
44
|
end
|
@@ -109,15 +111,13 @@ module NitroPay
|
|
109
111
|
app = get_json_request[:app]
|
110
112
|
NitroPay.app_id = app[:id]
|
111
113
|
NitroPay.secret_key = app[:secret]
|
114
|
+
end
|
112
115
|
|
113
|
-
|
116
|
+
# get global subscription
|
117
|
+
def get_global_subscription
|
118
|
+
# setup test_subscription path
|
114
119
|
self.path = 'global_subscription'
|
115
|
-
|
116
|
-
self.recurrent_tid = recurrence[:tid]
|
117
|
-
|
118
|
-
return puts 'Please run: rails g nitro_pay:install' if NitroPay.app_id.nil? || NitroPay.secret_key.nil?
|
119
|
-
self.auth = {app_id:NitroPay.app_id, secret_key:NitroPay.secret_key}
|
120
|
-
self.request_params.merge!(auth:self.auth)
|
120
|
+
get_json_request
|
121
121
|
end
|
122
122
|
|
123
123
|
# SetUp all attrs
|
@@ -62,8 +62,7 @@ module NitroPay
|
|
62
62
|
|
63
63
|
# Update the recurrence amount
|
64
64
|
def update_subscription(tid=nil, full_resp=false)
|
65
|
-
|
66
|
-
self.recurrent_tid = tid if tid
|
65
|
+
setup_tid(tid)
|
67
66
|
self.path = "transactions/#{self.recurrent_tid}/subscription"
|
68
67
|
|
69
68
|
# Perform the request
|
@@ -75,8 +74,7 @@ module NitroPay
|
|
75
74
|
|
76
75
|
# Stop a recurrence based on it transaction tid
|
77
76
|
def unsubscribe(tid=nil, full_resp=false)
|
78
|
-
|
79
|
-
self.recurrent_tid = tid if tid
|
77
|
+
setup_tid(tid)
|
80
78
|
self.path = "transactions/#{self.recurrent_tid}/subscription/unsubscribe"
|
81
79
|
|
82
80
|
# Perform the request
|
@@ -88,8 +86,7 @@ module NitroPay
|
|
88
86
|
|
89
87
|
# Return the payments executed for the purchase passed
|
90
88
|
def payment_history(tid=nil, full_resp=false)
|
91
|
-
|
92
|
-
self.recurrent_tid = tid if tid
|
89
|
+
setup_tid(tid)
|
93
90
|
self.path = "transactions/#{self.recurrent_tid}/subscription/payment_history"
|
94
91
|
self.path = "#{self.path}#{self.request_params.it_keys_to_get_param}"
|
95
92
|
|
@@ -102,8 +99,7 @@ module NitroPay
|
|
102
99
|
|
103
100
|
# Check if a subscription is up-to-date or have any pending
|
104
101
|
def up_to_date(tid=nil, full_resp=false)
|
105
|
-
|
106
|
-
self.recurrent_tid = tid if tid
|
102
|
+
setup_tid(tid)
|
107
103
|
|
108
104
|
# Create/customize the path & add the auth as param
|
109
105
|
self.path = "transactions/#{self.recurrent_tid}/subscription/up-to-date"
|
@@ -121,6 +117,11 @@ module NitroPay
|
|
121
117
|
self.resp.is_a?(String) ? JSON.parse(self.resp).it_keys_to_sym : self.resp
|
122
118
|
end
|
123
119
|
|
120
|
+
# Set it TID up
|
121
|
+
def setup_tid(tid)
|
122
|
+
tid ? self.recurrent_tid = tid : self.recurrent_tid = get_global_subscription[:tid]
|
123
|
+
end
|
124
|
+
|
124
125
|
# ================ STATIC methods ================
|
125
126
|
# GET /api/transactions/:tid by the tid passed
|
126
127
|
def self.find(tid)
|
data/lib/nitro_pay/version.rb
CHANGED
@@ -441,11 +441,12 @@ describe NitroPay::Transaction do
|
|
441
441
|
@transaction = NitroPay::Transaction.new tid: global_sample_transaction[:id]
|
442
442
|
|
443
443
|
# Send Unsubscribe
|
444
|
-
@
|
444
|
+
@transactions_resp = @transaction.payment_history
|
445
|
+
@transaction_resp = @transactions_resp.first
|
445
446
|
end
|
446
447
|
|
447
|
-
it 'should be a simple hash' do
|
448
|
-
expect(@
|
448
|
+
it 'should be a simple hash, just one register' do
|
449
|
+
expect(@transactions_resp.length).to eq(1)
|
449
450
|
end
|
450
451
|
|
451
452
|
it 'should not have any error' do
|
@@ -459,12 +460,7 @@ describe NitroPay::Transaction do
|
|
459
460
|
:created_at, :updated_at
|
460
461
|
]
|
461
462
|
|
462
|
-
invalid_keys = [
|
463
|
-
:next_transaction_at, :recurrence_period_id
|
464
|
-
]
|
465
|
-
|
466
463
|
valid_keys.each {|key| expect(@transaction_resp[key]).to_not be_nil}
|
467
|
-
invalid_keys.each {|key| expect(@transaction_resp[key]).to be_nil}
|
468
464
|
end
|
469
465
|
end
|
470
466
|
|
@@ -690,8 +686,8 @@ describe NitroPay::Transaction do
|
|
690
686
|
|
691
687
|
context 'Remote sample connection test' do
|
692
688
|
before(:all) do
|
693
|
-
NitroPay.debug=
|
694
|
-
NitroPay.test_env=
|
689
|
+
NitroPay.debug=true
|
690
|
+
NitroPay.test_env=true
|
695
691
|
@remote = NitroPay::Status.new
|
696
692
|
end
|
697
693
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nitro_pay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ilton Garcia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -215,7 +215,7 @@ files:
|
|
215
215
|
- lib/nitro_pay/config/enums/payment_methods.yml
|
216
216
|
- lib/nitro_pay/config/enums/recurrence_periods.yml
|
217
217
|
- lib/nitro_pay/config/enums/transaction_codes.yml
|
218
|
-
- lib/nitro_pay/config/proxy.
|
218
|
+
- lib/nitro_pay/config/proxy.yml
|
219
219
|
- lib/nitro_pay/connection.rb
|
220
220
|
- lib/nitro_pay/currency.rb
|
221
221
|
- lib/nitro_pay/hash.rb
|
@@ -258,7 +258,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
258
258
|
version: '0'
|
259
259
|
requirements: []
|
260
260
|
rubyforge_project:
|
261
|
-
rubygems_version: 2.4.
|
261
|
+
rubygems_version: 2.4.8
|
262
262
|
signing_key:
|
263
263
|
specification_version: 4
|
264
264
|
summary: NitroPay the NITRO START Gateway & Intermediary Payments ruby gem
|