payture-cheques 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2e2140551b23ffb46f17098703c5fc4428994c5d
4
- data.tar.gz: 1d338224780734d0dc0b0c47c97e722019cebf10
3
+ metadata.gz: 2b9032801d12b79cdc80714d708bc657bec95a78
4
+ data.tar.gz: bb7c52a7d07ced38a97833d0e111ea8d2ee0cc8d
5
5
  SHA512:
6
- metadata.gz: 6e9b5d024fac7fb6f7ae65725a8eb825db4fdd60b6d8c1c5d72923a81fdc3436763002811a492343139f4fdcac27f17bf671c8a8f88dc793c62c76645a2bd3aa
7
- data.tar.gz: d2787db6314619181e8c65f913c037c4278d98c04adeaa27127357dae3b50bbd0b811fe98e9da6b6161c497c4ef695dd0b23f12dc6f7ab00cb5aca269bef5519
6
+ metadata.gz: fc986c857b1aff15597fcff72d059bc485500a73ed9df18255817e3b5d41985f5a168040054f5bfbaf559c6a6544c9684f1d9e0e5467879763e3842435d79227
7
+ data.tar.gz: 226fac0e06f779b56fbc0213247e875f9c071c7895b02b48cc03c8b42d2da593ca2511bf4d167537881f269d4664643224d3ad16899595742fe67d48ec968db2
@@ -3,15 +3,19 @@ module Payture::Cheques
3
3
  class ChequeStatus
4
4
  attr_reader :sent, :cheque, :error_code, :status
5
5
 
6
- def initialize(args)
7
- @sent = args["Sended"]
8
- @cheque = args["Cheque"]
9
- @status = args["Status"]
10
- @error_code = args["ErrCode"] || Status::ERROR_STATES[@status]
6
+ def initialize(data)
7
+ @sent = data['Sended']
8
+ @cheque = data['Cheque']
9
+ @status = data['Status']
10
+ @error_code = data['ErrCode'] || Status::ERROR_STATES[@status]
11
11
  end
12
12
 
13
- def success?
14
- @sent == true && @status == 'Created'
13
+ def processed?
14
+ error_code.nil? && @sent == true && @status == 'Created'
15
+ end
16
+
17
+ def processing_error?
18
+ !error_code.nil?
15
19
  end
16
20
  end
17
21
  end
@@ -15,7 +15,15 @@ module Payture::Cheques
15
15
  end
16
16
 
17
17
  def success?
18
- body['Success'] == true && cheques.all?(&:success?)
18
+ body['Success'] == true
19
+ end
20
+
21
+ def processed?
22
+ error_code.nil? && cheques.all?(&:processed?)
23
+ end
24
+
25
+ def processing_error?
26
+ !error_code.nil? || cheques.any?(&:processing_error?)
19
27
  end
20
28
 
21
29
  def error_code
@@ -1,5 +1,5 @@
1
1
  module Payture
2
2
  module Cheques
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: payture-cheques
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Sviridov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-12-07 00:00:00.000000000 Z
11
+ date: 2017-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday