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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2cdd221a97a690d745583c4bc7e54fcd303d4879
4
- data.tar.gz: 9d23c91218a24476477766477f67e73d7cfb0e1b
3
+ metadata.gz: 66e32f810e2b5cf2a581015aeb16213681156709
4
+ data.tar.gz: d09157450a076fd4e39a6e23b10f757594a0f3b1
5
5
  SHA512:
6
- metadata.gz: 2dcc8d5cb7fc72d42013a20ea9e07bbf09ebc8573cc09860be7701814e57173390010bce4ae022b1ea5c251a62049bf470a2a2fc6e1b660a053e08b65c219a6d
7
- data.tar.gz: 6072978a76c7f47a7474496dafde9f7a3961adc259eedcce79ffbec3de3b41110df1b5263a7f2774a71ceda9f42c4ac22f108f847a56bdfe10e49e7ea69fc2b1
6
+ metadata.gz: 77ffc4020ca0977832a414a835c6758c3cfa85075d502e4c0d6901bea0443acc27c6c64b078c987876ea62da125da8e1c75840364925f6c4f79d826affe748f0
7
+ data.tar.gz: 46af32d895178e60107d6d5328b75f9e03cf09114e8390b9b1969c370893546db27304706058ef51ebae90e32be2c7c1f98897052973089ae8bcee1ece72023f
data/.gitignore CHANGED
@@ -9,7 +9,6 @@ _yardoc
9
9
  .idea/
10
10
  .idea/*
11
11
  /pkg/
12
- lib/nitro_pay/config/proxy.yml
13
12
  coverage
14
13
  coverage/
15
14
  coverage/*
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
- ruby '2.2.3'
2
- #ruby=2.2.3@nitro_pay_gem
1
+ ruby '2.2.4'
2
+ #ruby=2.2.4@nitro_pay_gem
3
3
  source 'https://rubygems.org'
4
4
 
5
5
  # Specify your gem's dependencies in nitro_pay.gemspec
6
- gemspec
6
+ gemspec
@@ -0,0 +1,4 @@
1
+ #host: proxy_host
2
+ #port: proxy_port
3
+ #login: your_login
4
+ #password: your_password
@@ -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
- # Get the GlobalRecurrent & setup/config
116
+ # get global subscription
117
+ def get_global_subscription
118
+ # setup test_subscription path
114
119
  self.path = 'global_subscription'
115
- recurrence = get_json_request
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
- # SetUp
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
- # SetUp
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
- # SetUp
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
- # SetUp
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)
@@ -1,6 +1,6 @@
1
1
  module NitroPay
2
2
  MAJOR = 1
3
3
  MINOR = 0
4
- PATCH = 9
4
+ PATCH = 10
5
5
  VERSION = "#{MAJOR}.#{MINOR}.#{PATCH}"
6
6
  end
@@ -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
- @transaction_resp = @transaction.payment_history
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(@transaction_resp).to be_a Hash
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=false
694
- NitroPay.test_env=false
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.9
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-03-29 00:00:00.000000000 Z
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.example.yml
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.5.1
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
@@ -1,4 +0,0 @@
1
- login: your_login
2
- password: your_password
3
- host: proxy_host
4
- port: proxy_port