File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -343,15 +343,19 @@ def bmp_alias(bmp, aliaz)
343343 # @values[bmp] = bmp_def
344344 }
345345 end
346-
346+
347347 # Parse the bytes `str` returning a message of the defined type.
348+ #
349+ # returns an instance of Message
350+ #
351+ # will raise an ISO8583Exception if the bitmap definition can't be found
348352 def parse ( str )
349353 str = str . force_encoding ( 'ASCII-8BIT' )
350354 message = self . new
351355 message . mti , rest = _mti_format . parse ( str )
352356 bmp , rest = Bitmap . parse ( rest )
353357 bmp . each { |bit |
354- bmp_def = _definitions [ bit ]
358+ bmp_def = message . _get_definition ( bit )
355359 value , rest = bmp_def . field . parse ( rest )
356360 message [ bit ] = value
357361 }
Original file line number Diff line number Diff line change @@ -45,6 +45,12 @@ def test_parse
4545 assert_equal 1430 , mes . mti
4646 end
4747
48+ def test_unknown_field
49+ assert_raises ( ISO8583Exception . new ( "no definition for field: 8" ) ) {
50+ mes = BerlinMessage . parse "1430A\000 \000 \000 \000 \000 \000 \000 12474747474747"
51+ }
52+ end
53+
4854 def test_rescue_standard_error
4955 rescued = false
5056 begin
You can’t perform that action at this time.
0 commit comments