gladepay 0.1.2 → 0.1.2.1

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: b0210dc48d4de061b0a7ffd3710af03c25399331
4
- data.tar.gz: 1f029306e5c948919f5a311d93e6d17ed129e175
3
+ metadata.gz: 348f59ad27a88b13265f2be4c716af52989fd622
4
+ data.tar.gz: a7f03b7650b48889fe7ce492f38c12314e50ef69
5
5
  SHA512:
6
- metadata.gz: d194a3767ff8534ab6a9f4477189331a75a63415a8e2b83a4654ab7c2b7ba8adfdb2171ca93a513e8477a2edf3c1b4543073ac079cb62a9caa89e6065e11dd75
7
- data.tar.gz: 2ba3526ce35d5f9fec65c7fa490ca1dbd6d806b4a0136f956b8d2ad2b21c006d6657310bb421be2eed905ce71507ec5c227618fdb007469b183aff5f886f2c51
6
+ metadata.gz: 8829da2af8bc4bd3fc1c7261e187657433a7a37c83b0e2a45962677ea5c959cb5ef8ce6cb6b4dc451dec46f9543599fa8d596230673eaad6b7d38fd417ada7de
7
+ data.tar.gz: c3b799e7adc61417f1f77c7aef41283514d85674f30fba2d68f4a847b7e7b07dde539e82da4b1c9321d48a256943247b8321717e13af74e38e25a1e3b7353667
data/.rubocop.yml CHANGED
@@ -25,7 +25,7 @@ Metrics/ClassLength:
25
25
  Metrics/AbcSize:
26
26
  # The ABC size is a calculated magnitude, so this number can be an Integer or
27
27
  # a Float.
28
- Max: 35
28
+ Max: 37
29
29
  # Max: 15
30
30
 
31
31
  # Avoid complex methods.
data/README.md CHANGED
@@ -94,6 +94,9 @@ Or install it yourself as:
94
94
  #Get the charges applicable to a card: (first six digit of the card no)
95
95
  card_charges_response = gladepay.card_charges(amount, card_no)
96
96
 
97
+ #Get the charges applicable to an account
98
+ account_charges_response = gladepay.account_charges(amount)
99
+
97
100
  #charge with token
98
101
  response = gladepay.charge_with_token(
99
102
  user,
@@ -1,3 +1,3 @@
1
1
  class Gladepay
2
- VERSION = '0.1.2'.freeze
2
+ VERSION = '0.1.2.1'.freeze
3
3
  end
data/lib/gladepay.rb CHANGED
@@ -220,6 +220,16 @@ class Gladepay
220
220
  return response
221
221
  end
222
222
 
223
+ def account_charges(amount)
224
+ request_data = {
225
+ 'inquire' => 'charges',
226
+ 'type' => 'account',
227
+ 'amount' => amount
228
+ }
229
+ response = call_put_api('resources', request_data)
230
+ return response
231
+ end
232
+
223
233
  def validate_otp(txn_ref, otp)
224
234
  request_data = {
225
235
  'action' => 'validate',
@@ -286,10 +296,11 @@ class Gladepay
286
296
  end
287
297
 
288
298
  result = JSON.parse(response.body)
289
- # puts 'CALL_PUT_API:-RESULT '
290
- # puts result
299
+ puts 'CALL_PUT_API:-RESULT ', result
291
300
 
292
- raise GladepayServerError.new(response), 'Server Message: '. result['message'].to_s unless result['status'] != 0
301
+ unless (result.instance_of? Integer) != false
302
+ raise GladepayServerError.new(response), 'Server Message: '. result['message'].to_s unless result['status'] != 0
303
+ end
293
304
  rescue JSON::ParserError => jsonerr
294
305
  raise GladepayServerError.new(response), 'Invalid result data. Could not parse JSON response body \n' + jsonerr.message
295
306
  rescue GladepayServerError => e
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gladepay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chinaka Light
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-08-29 00:00:00.000000000 Z
11
+ date: 2018-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler