bankserv 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -35,11 +35,12 @@ module Bankserv
35
35
  end
36
36
 
37
37
  def self.build!(options)
38
- bank_account = BankAccount.new options[:bank_account].filter_attributes(BankAccount)
38
+ bank_account = BankAccount.new(options.delete(:bank_account))
39
39
  is_internal = bank_account.branch_code == self.service.config[:internal_branch_code]
40
- options = options.filter_attributes(self).merge(bank_account: bank_account, internal: is_internal)
41
-
42
- create!(options)
40
+ ahv = new(options)
41
+ ahv.bank_account = bank_account
42
+ ahv.internal = is_internal
43
+ ahv.save!
43
44
  end
44
45
 
45
46
  def internal?
data/lib/bankserv/eft.rb CHANGED
@@ -28,10 +28,19 @@ module Bankserv
28
28
  end
29
29
 
30
30
  def build_contra!(batch_id, options)
31
- ba_options = options.filter_attributes(BankAccount)
32
- options = options.filter_attributes(self).merge(bank_account: BankAccount.new(ba_options), record_type: "contra", batch_id: batch_id, bankserv_request_id: @request_id)
31
+ account_name = options.delete(:account_name)
32
+ account_type = options.delete(:account_type)
33
+ account_number = options.delete(:account_number)
34
+ branch_code = options.delete(:branch_code)
35
+ initials = options.delete(:initials)
36
+ id_number = options.delete(:id_number)
33
37
 
34
- create!(options)
38
+ bank_account = BankAccount.create!(account_name: account_name, account_type: account_type, account_number: account_number,
39
+ branch_code: branch_code, initials: initials)
40
+
41
+ options = options.merge(record_type: "contra", batch_id: batch_id, bankserv_request_id: @request_id, bankserv_bank_account_id: bank_account.id)
42
+ contra = new(options)
43
+ contra.save!
35
44
  end
36
45
 
37
46
  def build_standard!(batch_id, options)
@@ -45,10 +54,19 @@ module Bankserv
45
54
  end
46
55
 
47
56
  def create_standard!(batch_id, options)
48
- ba_options = options.filter_attributes(BankAccount)
49
- options = options.filter_attributes(self).merge(bank_account: BankAccount.new(ba_options), record_type: "standard", batch_id: batch_id, bankserv_request_id: @request_id)
57
+ account_name = options.delete(:account_name)
58
+ account_type = options.delete(:account_type)
59
+ account_number = options.delete(:account_number)
60
+ branch_code = options.delete(:branch_code)
61
+ initials = options.delete(:initials)
62
+ id_number = options.delete(:id_number)
50
63
 
51
- create!(options)
64
+ bank_account = BankAccount.create!(account_name: account_name, account_type: account_type, account_number: account_number,
65
+ branch_code: branch_code, initials: initials)
66
+
67
+ options = options.merge(record_type: "standard", batch_id: batch_id, bankserv_request_id: @request_id, bankserv_bank_account_id: bank_account.id)
68
+ standard = new(options)
69
+ standard.save!
52
70
  end
53
71
 
54
72
  def next_batch_id
@@ -1,3 +1,3 @@
1
1
  module Bankserv
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
@@ -21,6 +21,24 @@ describe Bankserv::AccountHolderVerification do
21
21
  request.type.should == "ahv"
22
22
  request.data.should == @hash[:data]
23
23
  end
24
+
25
+ it "should work" do
26
+ b_a = {
27
+ :account_number=>"2938423984",
28
+ :id_number=>"0394543905",
29
+ :initials=>"P",
30
+ :account_name=>"Hendrik",
31
+ :branch_code=>"250255",
32
+ :account_type=>"savings"
33
+ }
34
+
35
+ info = {data: {user_ref: 83745678, bank_account: b_a}}
36
+ Bankserv::AHVService.last.request(info)
37
+
38
+ puts Bankserv::AccountHolderVerification.where(user_ref: 83745678).first.inspect
39
+ puts Bankserv::AccountHolderVerification.all.inspect
40
+ puts Bankserv::Request.last.inspect
41
+ end
24
42
 
25
43
  end
26
44
 
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.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-04-26 00:00:00.000000000Z
13
+ date: 2012-04-30 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
17
- requirement: &70180810308280 !ruby/object:Gem::Requirement
17
+ requirement: &70162632244500 !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: *70180810308280
25
+ version_requirements: *70162632244500
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: activerecord
28
- requirement: &70180810307760 !ruby/object:Gem::Requirement
28
+ requirement: &70162632243920 !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: *70180810307760
36
+ version_requirements: *70162632243920
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: i18n
39
- requirement: &70180810307320 !ruby/object:Gem::Requirement
39
+ requirement: &70162632243460 !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: *70180810307320
47
+ version_requirements: *70162632243460
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: absa-h2h
50
- requirement: &70180810306760 !ruby/object:Gem::Requirement
50
+ requirement: &70162632242820 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ~>
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: 0.1.1
56
56
  type: :runtime
57
57
  prerelease: false
58
- version_requirements: *70180810306760
58
+ version_requirements: *70162632242820
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: absa-esd
61
- requirement: &70180810306260 !ruby/object:Gem::Requirement
61
+ requirement: &70162632242180 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ~>
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: 0.0.2
67
67
  type: :runtime
68
68
  prerelease: false
69
- version_requirements: *70180810306260
69
+ version_requirements: *70162632242180
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: combustion
72
- requirement: &70180810305800 !ruby/object:Gem::Requirement
72
+ requirement: &70162632241600 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ~>
@@ -77,7 +77,7 @@ dependencies:
77
77
  version: 0.3.1
78
78
  type: :development
79
79
  prerelease: false
80
- version_requirements: *70180810305800
80
+ version_requirements: *70162632241600
81
81
  description: ! "This engine allows users to inject requests into a queue to be processed.
82
82
  \n \n The queue handles bank account validations, credit payments,
83
83
  debit orders\n and collecting bank statements. "