bankserv 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -51,6 +51,11 @@ module Bankserv
51
51
  def completed?
52
52
  status == "completed"
53
53
  end
54
+
55
+ def pending!
56
+ self.status = "pending"
57
+ save!
58
+ end
54
59
 
55
60
  def process_response(data)
56
61
  file_name = "#{Bankserv::CONFIG_DIR}/ahv.yml"
@@ -28,6 +28,11 @@ module Bankserv
28
28
  def pending?
29
29
  status == "pending"
30
30
  end
31
+
32
+ def pending!
33
+ self.status = "pending"
34
+ save!
35
+ end
31
36
 
32
37
  def error?
33
38
  status == "error"
@@ -71,6 +71,11 @@ module Bankserv
71
71
  def pending?
72
72
  status == "pending"
73
73
  end
74
+
75
+ def pending!
76
+ self.status = "pending"
77
+ save!
78
+ end
74
79
 
75
80
  def error?
76
81
  status == "error"
@@ -86,9 +86,15 @@ module Bankserv
86
86
  # input_services.each do |bankserv_service|
87
87
  begin
88
88
  return if self.expecting_reply_file?(@service)
89
+
90
+ document = nil
91
+
92
+ Bankserv::Service.transaction do
93
+ document = Bankserv::InputDocument.generate!(@service)
94
+ end
89
95
 
90
- if document = Bankserv::InputDocument.generate!(@service)
91
- @logs[:input_files] << "Input Document created with id: #{document.id}" if document
96
+ if document
97
+ @logs[:input_files] << "Input Document created with id: #{document.id}"
92
98
 
93
99
  if self.write_file!(document)
94
100
  document.mark_processed!
@@ -19,6 +19,10 @@ module Bankserv
19
19
  def self.active
20
20
  where(active: true)
21
21
  end
22
+
23
+ def get_generation_number
24
+ self.config[:generation_number]
25
+ end
22
26
 
23
27
  def set_generation_number!(number)
24
28
  self.config[:generation_number] = number
@@ -3,6 +3,17 @@ class Bankserv::InputDocument < Bankserv::Document
3
3
  def self.document_type
4
4
  'input'
5
5
  end
6
+
7
+ def mark_processed!
8
+ mark_records_pending!
9
+ self.update_attributes!(processed: true)
10
+ end
11
+
12
+ def mark_records_pending!
13
+ records.each do |rec|
14
+ rec.pending! if rec.respond_to?(:pending!)
15
+ end
16
+ end
6
17
 
7
18
  def self.store(string)
8
19
  options = Absa::H2h::Transmission::Document.hash_from_s(string, 'input')
@@ -139,6 +139,7 @@ module Bankserv
139
139
  )
140
140
 
141
141
  records.build(record_type: transaction.record_type + "_record", data: record_data)
142
+ transaction.pending!
142
143
  end
143
144
 
144
145
  def first_action_date
@@ -1,3 +1,3 @@
1
1
  module Bankserv
2
- VERSION = "0.5.2"
2
+ VERSION = "0.5.3"
3
3
  end
@@ -5,7 +5,7 @@ describe Bankserv::Transmission::UserSet::Credit do
5
5
 
6
6
  context "Building a credit batch" do
7
7
 
8
- before(:all) do
8
+ before(:each) do
9
9
  tear_it_down
10
10
 
11
11
  bankserv_service = Bankserv::CreditService.register(client_code: '10', client_name: "LDC USER 10 AFRICA (PTY)", client_abbreviated_name: 'ALIMITTST', user_code: "9534", generation_number: 37, transmission_status: "T", transmission_number: "1")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bankserv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ date: 2012-07-10 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
17
- requirement: &70233885786960 !ruby/object:Gem::Requirement
17
+ requirement: &70238444475980 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70233885786960
25
+ version_requirements: *70238444475980
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: activerecord
28
- requirement: &70233885786460 !ruby/object:Gem::Requirement
28
+ requirement: &70238444475380 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '3.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *70233885786460
36
+ version_requirements: *70238444475380
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: i18n
39
- requirement: &70233885786040 !ruby/object:Gem::Requirement
39
+ requirement: &70238444474920 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: '0'
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *70233885786040
47
+ version_requirements: *70238444474920
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: absa-h2h
50
- requirement: &70233885785500 !ruby/object:Gem::Requirement
50
+ requirement: &70238444474300 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ~>
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: 0.1.5
56
56
  type: :runtime
57
57
  prerelease: false
58
- version_requirements: *70233885785500
58
+ version_requirements: *70238444474300
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: absa-esd
61
- requirement: &70233885785000 !ruby/object:Gem::Requirement
61
+ requirement: &70238444473740 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ~>
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: 0.0.3
67
67
  type: :runtime
68
68
  prerelease: false
69
- version_requirements: *70233885785000
69
+ version_requirements: *70238444473740
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: absa-notify-me
72
- requirement: &70233885784540 !ruby/object:Gem::Requirement
72
+ requirement: &70238444473160 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ~>
@@ -77,10 +77,10 @@ dependencies:
77
77
  version: 0.0.7
78
78
  type: :runtime
79
79
  prerelease: false
80
- version_requirements: *70233885784540
80
+ version_requirements: *70238444473160
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: combustion
83
- requirement: &70233885784080 !ruby/object:Gem::Requirement
83
+ requirement: &70238444472580 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ~>
@@ -88,7 +88,7 @@ dependencies:
88
88
  version: 0.3.1
89
89
  type: :development
90
90
  prerelease: false
91
- version_requirements: *70233885784080
91
+ version_requirements: *70238444472580
92
92
  description: ! "This engine allows users to inject requests into a queue to be processed.
93
93
  \n \n The queue handles bank account validations, credit payments,
94
94
  debit orders\n and collecting bank statements/notify me statements. "