absa-notify-me 0.0.5 → 0.0.6

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.
@@ -1,5 +1,5 @@
1
1
  module Absa
2
2
  module NotifyMe
3
- VERSION = "0.0.5"
3
+ VERSION = "0.0.6"
4
4
  end
5
5
  end
@@ -58,6 +58,7 @@ module Absa
58
58
  end
59
59
  if (key == :details) && (!value.blank?)
60
60
  transactions = value[:transaction].blank? ? value["TRANSACTION"] : value[:transaction]
61
+ transactions = [transactions] if transactions.is_a? Hash
61
62
  transactions.each do |transaction|
62
63
  amount = (transaction[:amt].to_f * 100).to_i.to_s
63
64
  account_balance = (transaction[:acc_bal].to_f * 100).to_i.to_s
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <ns0:TransactionRequest xmlns:ns0="http://ABSA.DTM.NMB">
3
+ <NOTIF-HEADER><SEQUENCE-NO>1</SEQUENCE-NO><CREATION-DATE>20120620</CREATION-DATE><CREATION-TIME>00102778</CREATION-TIME><CLIENT-ID>NMB00246</CLIENT-ID><CLIENT-ACN>4079188514</CLIENT-ACN><SNAME>RENTAL</SNAME></NOTIF-HEADER>
4
+ <DETAILS>
5
+ </DETAILS>
6
+ <NOTIF-TRAILER><TOTAL-CR> 0.00</TOTAL-CR><TOTAL-DT> 0.00</TOTAL-DT><TOTAL-RECS> 0</TOTAL-RECS><CHECK-SUM>81B78A0FDE5C0B6A83AEC7A7BB325E09</CHECK-SUM></NOTIF-TRAILER>
7
+ </ns0:TransactionRequest>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <ns0:TransactionRequest xmlns:ns0="http://ABSA.DTM.NMB">
3
+ <NOTIF-HEADER><SEQUENCE-NO>736</SEQUENCE-NO><CREATION-DATE>20120627</CREATION-DATE><CREATION-TIME>17102306</CREATION-TIME><CLIENT-ID>NMB00246</CLIENT-ID><CLIENT-ACN>4079189120</CLIENT-ACN><SNAME>RENTAL</SNAME></NOTIF-HEADER>
4
+ <DETAILS>
5
+ <TRANSACTION><TRG-ACC>0000004079189120</TRG-ACC><EVENT-NO>000000060</EVENT-NO><CLREF>ABSA BANK RC000000001</CLREF><CURR>ZAR</CURR><AMT> 500.00</AMT><ACC-BAL> 500.00+</ACC-BAL><TRAN-TYPE>C</TRAN-TYPE><PDATE>20120627</PDATE><PTIME>17035390</PTIME><CLR-PAYM-IND>N</CLR-PAYM-IND><PAYM-DESC>ACB CREDIT</PAYM-DESC><CHECKSUM>2CED0B2E33DA43AA1819A246076659E7</CHECKSUM></TRANSACTION>
6
+ </DETAILS>
7
+ <NOTIF-TRAILER><TOTAL-CR> 500.00</TOTAL-CR><TOTAL-DT> 0.00</TOTAL-DT><TOTAL-RECS> 1</TOTAL-RECS><CHECK-SUM>AD70FD8FE0117F7961B7CC217902CE4E</CHECK-SUM></NOTIF-TRAILER>
8
+ </ns0:TransactionRequest>
@@ -31,10 +31,15 @@ describe Absa::NotifyMe::XmlStatement do
31
31
  context "Cater for an empty xml document" do
32
32
  before(:each) do
33
33
  @hash = Absa::NotifyMe::XmlStatement.file_to_hash("./spec/examples/empty_test.xml")
34
+ @hash2 = Absa::NotifyMe::XmlStatement.file_to_hash("./spec/examples/test_with_one_record.xml")
34
35
  end
35
36
 
36
37
  it "should not contain a detail record" do
37
38
  @hash[:data][:data].select {|record| record[:type] == "detail"}.should be_blank
38
39
  end
40
+
41
+ it "should contain a detail record" do
42
+ @hash2[:data][:data].select {|record| record[:type] == "detail"}.count.should == 1
43
+ end
39
44
  end
40
45
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: absa-notify-me
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-25 00:00:00.000000000Z
12
+ date: 2012-07-03 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nori
16
- requirement: &70241943610500 !ruby/object:Gem::Requirement
16
+ requirement: &70162276063060 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70241943610500
24
+ version_requirements: *70162276063060
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: nokogiri
27
- requirement: &70241943610080 !ruby/object:Gem::Requirement
27
+ requirement: &70162276062640 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70241943610080
35
+ version_requirements: *70162276062640
36
36
  description: ! "\n This is just a rapidly prototyped proof of concept gem for \n
37
37
  \ bankserv gem and those who can afford to use the ABSA NotifyMe \n Platform.
38
38
  \n \n For a production ready gem please rather use absa-esd with the \n bankserv
@@ -57,7 +57,9 @@ files:
57
57
  - lib/absa-notify-me/version.rb
58
58
  - lib/absa-notify-me/xml_statement.rb
59
59
  - spec/.DS_Store
60
+ - spec/examples/empty_test.xml
60
61
  - spec/examples/test.xml
62
+ - spec/examples/test_with_one_record.xml
61
63
  - spec/lib/xml_statement_spec.rb
62
64
  - spec/spec_helper.rb
63
65
  homepage: ''
@@ -86,6 +88,8 @@ specification_version: 3
86
88
  summary: A ruby interface to commumicate with the ABSA Notify Me Statement Delivery
87
89
  platform.
88
90
  test_files:
91
+ - spec/examples/empty_test.xml
89
92
  - spec/examples/test.xml
93
+ - spec/examples/test_with_one_record.xml
90
94
  - spec/lib/xml_statement_spec.rb
91
95
  - spec/spec_helper.rb