iso8583 0.1.3 → 0.1.4
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.
- data/AUTHORS +1 -0
- data/README +1 -2
- data/Rakefile +5 -5
- data/lib/8583.rb +2 -9
- data/lib/iso8583.rb +9 -2
- data/lib/{8583 → iso8583}/berlin.rb +0 -0
- data/lib/{8583 → iso8583}/bitmap.rb +0 -0
- data/lib/{8583 → iso8583}/codec.rb +9 -0
- data/lib/{8583 → iso8583}/exception.rb +0 -0
- data/lib/{8583 → iso8583}/field.rb +0 -0
- data/lib/{8583 → iso8583}/fields.rb +17 -0
- data/lib/{8583 → iso8583}/message.rb +0 -0
- data/lib/{8583 → iso8583}/util.rb +0 -0
- data/lib/iso8583/version.rb +4 -0
- data/test/message_test.rb +2 -2
- data/test/test_codec.rb +8 -0
- data/test/test_fields.rb +49 -0
- data/test/test_seperate_msg.rb +2 -2
- metadata +22 -14
data/AUTHORS
CHANGED
data/README
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
= ISO 8583 Financial Messaging for Ruby
|
3
2
|
|
4
3
|
This package currently contains code for coding an decoding ISO 8583
|
@@ -18,7 +17,7 @@ You can install the +iso8583+ package by executing:
|
|
18
17
|
|
19
18
|
== Source
|
20
19
|
|
21
|
-
The source is most readily available on github[http://github.com/
|
20
|
+
The source is most readily available on github[http://github.com/a2800276/8583].
|
22
21
|
|
23
22
|
== Mailing List
|
24
23
|
|
data/Rakefile
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
require "
|
2
|
-
require "
|
1
|
+
require "rdoc/task"
|
2
|
+
require "rubygems/package_task"
|
3
3
|
require "rake/testtask"
|
4
4
|
require "rake/clean"
|
5
5
|
require "rubygems"
|
@@ -9,7 +9,7 @@ require "rubygems"
|
|
9
9
|
|
10
10
|
SHORTNAME = "iso8583" # this should be the rubyforge project name
|
11
11
|
DESC = "Ruby implementation of ISO 8583 financial messaging"
|
12
|
-
PKG_VERSION = "0.1.
|
12
|
+
PKG_VERSION = "0.1.4"
|
13
13
|
LONG_DESC = <<END_DESC
|
14
14
|
Ruby implementation of ISO 8583 financial messaging
|
15
15
|
END_DESC
|
@@ -88,7 +88,7 @@ end
|
|
88
88
|
|
89
89
|
# Adding a new GemPackageTask adds a task named `package`, which generates
|
90
90
|
# packages as gems, tarball and zip archives.
|
91
|
-
|
91
|
+
Gem::PackageTask.new(spec) do |pkg|
|
92
92
|
pkg.need_zip = true
|
93
93
|
pkg.need_tar_gz = true
|
94
94
|
end
|
@@ -120,7 +120,7 @@ end
|
|
120
120
|
|
121
121
|
Rake::TestTask.new do |t|
|
122
122
|
t.libs << "test"
|
123
|
-
t.libs << "
|
123
|
+
t.libs << "."
|
124
124
|
t.ruby_opts = ["-rubygems"]
|
125
125
|
t.test_files = FileList["test/*.rb"]
|
126
126
|
t.verbose = true
|
data/lib/8583.rb
CHANGED
@@ -1,12 +1,5 @@
|
|
1
1
|
$:.unshift(File.dirname(__FILE__)) unless
|
2
2
|
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
require "8583/codec"
|
7
|
-
require "8583/fields"
|
8
|
-
require "8583/exception"
|
9
|
-
require "8583/bitmap"
|
10
|
-
require "8583/message"
|
11
|
-
require "8583/util"
|
12
|
-
end
|
4
|
+
# DEPRECATED
|
5
|
+
require 'iso8583'
|
data/lib/iso8583.rb
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
$:.unshift(File.dirname(__FILE__)) unless
|
2
2
|
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
3
3
|
|
4
|
-
|
5
|
-
require
|
4
|
+
module ISO8583
|
5
|
+
require "iso8583/field"
|
6
|
+
require "iso8583/codec"
|
7
|
+
require "iso8583/fields"
|
8
|
+
require "iso8583/exception"
|
9
|
+
require "iso8583/bitmap"
|
10
|
+
require "iso8583/message"
|
11
|
+
require "iso8583/util"
|
12
|
+
end
|
File without changes
|
File without changes
|
@@ -45,6 +45,8 @@ module ISO8583
|
|
45
45
|
# [+ASCII_Number+] encodes either a Number or String representation of
|
46
46
|
# a number to the ASCII represenation of the number,
|
47
47
|
# decodes ASCII numerals to a number
|
48
|
+
# [+A_Codec+] passes through ASCII string checking they conform to [A-Za-z]
|
49
|
+
# during encoding, no validity check during decoding.
|
48
50
|
# [+AN_Codec+] passes through ASCII string checking they conform to [A-Za-z0-9]
|
49
51
|
# during encoding, no validity check during decoding.
|
50
52
|
# [+ANP_Codec+] passes through ASCII string checking they conform to [A-Za-z0-9 ]
|
@@ -109,6 +111,13 @@ module ISO8583
|
|
109
111
|
d = encoded.unpack("H*")[0].to_i
|
110
112
|
}
|
111
113
|
|
114
|
+
A_Codec = Codec.new
|
115
|
+
A_Codec.encoder = lambda{|str|
|
116
|
+
raise ISO8583Exception.new("Invalid value: #{str} must be [A-Za-z]") unless str =~ /^[A-Za-z]*$/
|
117
|
+
str
|
118
|
+
}
|
119
|
+
A_Codec.decoder = PASS_THROUGH_DECODER
|
120
|
+
|
112
121
|
AN_Codec = Codec.new
|
113
122
|
AN_Codec.encoder = lambda{|str|
|
114
123
|
raise ISO8583Exception.new("Invalid value: #{str} must be [A-Za-y0-9]") unless str =~ /^[A-Za-z0-9]*$/
|
File without changes
|
File without changes
|
@@ -20,10 +20,13 @@ module ISO8583
|
|
20
20
|
# [+LLVAR_N+] two byte variable length ASCII numeral, payload ASCII numerals
|
21
21
|
# [+LLLVAR_N+] three byte variable length ASCII numeral, payload ASCII numerals
|
22
22
|
# [+LLVAR_Z+] two byte variable length ASCII numeral, payload Track2 data
|
23
|
+
# [+LLVAR_AN+] two byte variable length ASCII numeral, payload ASCII
|
23
24
|
# [+LLVAR_ANS+] two byte variable length ASCII numeral, payload ASCII+special
|
25
|
+
# [+LLLVAR_AN+] three byte variable length ASCII numeral, payload ASCII
|
24
26
|
# [+LLLVAR_ANS+] three byte variable length ASCII numeral, payload ASCII+special
|
25
27
|
# [+LLVAR_B+] Two byte variable length binary payload
|
26
28
|
# [+LLLVAR_B+] Three byte variable length binary payload
|
29
|
+
# [+A+] fixed length letters, represented in ASCII
|
27
30
|
# [+N+] fixed lengh numerals, repesented in ASCII, padding right justified using zeros
|
28
31
|
# [+AN+] fixed lengh ASCII [A-Za-z0-9], padding left justified using spaces.
|
29
32
|
# [+ANP+] fixed lengh ASCII [A-Za-z0-9] and space, padding left, spaces
|
@@ -70,11 +73,21 @@ module ISO8583
|
|
70
73
|
LLVAR_Z.length = LL
|
71
74
|
LLVAR_Z.codec = Track2
|
72
75
|
|
76
|
+
# Two byte variable length ASCII numeral, payload ASCII, fixed length, zeropadded (right)
|
77
|
+
LLVAR_AN = Field.new
|
78
|
+
LLVAR_AN.length = LL
|
79
|
+
LLVAR_AN.codec = AN_Codec
|
80
|
+
|
73
81
|
# Two byte variable length ASCII numeral, payload ASCII+special
|
74
82
|
LLVAR_ANS = Field.new
|
75
83
|
LLVAR_ANS.length = LL
|
76
84
|
LLVAR_ANS.codec = ANS_Codec
|
77
85
|
|
86
|
+
# Three byte variable length ASCII numeral, payload ASCII, fixed length, zeropadded (right)
|
87
|
+
LLLVAR_AN = Field.new
|
88
|
+
LLLVAR_AN.length = LLL
|
89
|
+
LLLVAR_AN.codec = AN_Codec
|
90
|
+
|
78
91
|
# Three byte variable length ASCII numeral, payload ASCII+special
|
79
92
|
LLLVAR_ANS = Field.new
|
80
93
|
LLLVAR_ANS.length = LLL
|
@@ -105,6 +118,10 @@ module ISO8583
|
|
105
118
|
sprintf "%-#{len}s", val
|
106
119
|
}
|
107
120
|
|
121
|
+
# Fixed length ASCII letters [A-Za-z]
|
122
|
+
A = Field.new
|
123
|
+
A.codec = A_Codec
|
124
|
+
|
108
125
|
# Fixed lengh ASCII [A-Za-z0-9], padding left justified using spaces.
|
109
126
|
AN = Field.new
|
110
127
|
AN.codec = AN_Codec
|
File without changes
|
File without changes
|
data/test/message_test.rb
CHANGED
data/test/test_codec.rb
CHANGED
@@ -62,6 +62,14 @@ class FieldTest < Test::Unit::TestCase
|
|
62
62
|
assert_equal "0912", YYMMCodec.encode("0912")
|
63
63
|
end
|
64
64
|
|
65
|
+
def test_A_Codec
|
66
|
+
assert_raise(ISO8583Exception) {
|
67
|
+
dt = A_Codec.encode "!!!"
|
68
|
+
}
|
69
|
+
assert_equal "bla", AN_Codec.encode("bla")
|
70
|
+
assert_equal "bla", AN_Codec.decode("bla")
|
71
|
+
end
|
72
|
+
|
65
73
|
def test_AN_Codec
|
66
74
|
assert_raise(ISO8583Exception) {
|
67
75
|
dt = AN_Codec.encode "!!!"
|
data/test/test_fields.rb
CHANGED
@@ -41,6 +41,39 @@ class FieldTest < Test::Unit::TestCase
|
|
41
41
|
assert_equal "3456", rest
|
42
42
|
end
|
43
43
|
|
44
|
+
def test_LLVAR_AN
|
45
|
+
value, rest = LLVAR_AN.parse "03123ABC"
|
46
|
+
assert_equal "123", value
|
47
|
+
assert_equal "ABC", rest
|
48
|
+
|
49
|
+
value, rest = LLLVAR_AN.parse "006123ABC"
|
50
|
+
assert_equal "123ABC", value
|
51
|
+
assert_equal "", rest
|
52
|
+
assert_raise(ISO8583ParseException) {
|
53
|
+
l,rest = LLLVAR_AN.parse "12"
|
54
|
+
}
|
55
|
+
assert_raise(ISO8583ParseException) {
|
56
|
+
l,rest = LLVAR_AN.parse "12123"
|
57
|
+
}
|
58
|
+
|
59
|
+
enc = LLVAR_AN.encode "123A"
|
60
|
+
assert_equal "04123A", enc
|
61
|
+
|
62
|
+
enc = LLVAR_AN.encode "123ABC123ABC"
|
63
|
+
assert_equal "12123ABC123ABC", enc
|
64
|
+
|
65
|
+
assert_raise(ISO8583Exception) {
|
66
|
+
enc = LLVAR_AN.encode "1234 ABCD"
|
67
|
+
}
|
68
|
+
|
69
|
+
enc = LLLVAR_AN.encode "123ABC123ABC"
|
70
|
+
assert_equal "012123ABC123ABC", enc
|
71
|
+
|
72
|
+
assert_raise(ISO8583Exception) {
|
73
|
+
enc = LLLVAR_AN.encode "1234 ABCD"
|
74
|
+
}
|
75
|
+
end
|
76
|
+
|
44
77
|
def test_LLVAR_N
|
45
78
|
value, rest = LLVAR_N.parse "021234"
|
46
79
|
assert_equal 12, value
|
@@ -98,6 +131,22 @@ class FieldTest < Test::Unit::TestCase
|
|
98
131
|
}
|
99
132
|
end
|
100
133
|
|
134
|
+
def test_A
|
135
|
+
fld = A.dup
|
136
|
+
fld.length = 3
|
137
|
+
value, rest = fld.parse "abcd"
|
138
|
+
assert_equal "abc", value
|
139
|
+
assert_equal "d", rest
|
140
|
+
|
141
|
+
assert_raise(ISO8583ParseException) {
|
142
|
+
fld.parse "ab"
|
143
|
+
}
|
144
|
+
|
145
|
+
assert_raise(ISO8583Exception) {
|
146
|
+
fld.encode "abcdef"
|
147
|
+
}
|
148
|
+
end
|
149
|
+
|
101
150
|
def test_AN
|
102
151
|
fld = AN.dup
|
103
152
|
fld.length = 3
|
data/test/test_seperate_msg.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iso8583
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 4
|
9
|
+
version: 0.1.4
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Tim Becker
|
@@ -10,7 +15,7 @@ autorequire:
|
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
17
|
|
13
|
-
date:
|
18
|
+
date: 2012-10-30 00:00:00 +01:00
|
14
19
|
default_executable:
|
15
20
|
dependencies: []
|
16
21
|
|
@@ -27,21 +32,22 @@ extensions: []
|
|
27
32
|
extra_rdoc_files: []
|
28
33
|
|
29
34
|
files:
|
30
|
-
- lib/8583/berlin.rb
|
31
|
-
- lib/8583/bitmap.rb
|
32
|
-
- lib/8583/codec.rb
|
33
|
-
- lib/8583/exception.rb
|
34
|
-
- lib/8583/field.rb
|
35
|
-
- lib/8583/fields.rb
|
36
|
-
- lib/8583/message.rb
|
37
|
-
- lib/8583/util.rb
|
38
35
|
- lib/8583.rb
|
36
|
+
- lib/iso8583/berlin.rb
|
37
|
+
- lib/iso8583/bitmap.rb
|
38
|
+
- lib/iso8583/codec.rb
|
39
|
+
- lib/iso8583/exception.rb
|
40
|
+
- lib/iso8583/field.rb
|
41
|
+
- lib/iso8583/fields.rb
|
42
|
+
- lib/iso8583/message.rb
|
43
|
+
- lib/iso8583/util.rb
|
44
|
+
- lib/iso8583/version.rb
|
39
45
|
- lib/iso8583.rb
|
40
46
|
- AUTHORS
|
41
47
|
- CHANGELOG
|
42
48
|
- LICENSE
|
43
|
-
- Rakefile
|
44
49
|
- README
|
50
|
+
- Rakefile
|
45
51
|
- TODO
|
46
52
|
- test/BitmapTests.rb
|
47
53
|
- test/message_test.rb
|
@@ -62,18 +68,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
62
68
|
requirements:
|
63
69
|
- - ">="
|
64
70
|
- !ruby/object:Gem::Version
|
71
|
+
segments:
|
72
|
+
- 0
|
65
73
|
version: "0"
|
66
|
-
version:
|
67
74
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
75
|
requirements:
|
69
76
|
- - ">="
|
70
77
|
- !ruby/object:Gem::Version
|
78
|
+
segments:
|
79
|
+
- 0
|
71
80
|
version: "0"
|
72
|
-
version:
|
73
81
|
requirements:
|
74
82
|
- none
|
75
83
|
rubyforge_project: iso8583
|
76
|
-
rubygems_version: 1.3.
|
84
|
+
rubygems_version: 1.3.6
|
77
85
|
signing_key:
|
78
86
|
specification_version: 3
|
79
87
|
summary: "iso8583: Ruby implementation of ISO 8583 financial messaging"
|