Sha256: 6465f631ec2df3912daf30064ddb9e3c3523315b868a9966fe1536a2877604ba

Contents?: true

Size: 906 Bytes

Versions: 1

Compression:

Stored size: 906 Bytes

Contents

module Biro
  module Bvs
    class DebitsResponseBuilder
      def initialize(body)
        @body = build(body)
      end

      def transaction
        @body[0..7]
      end

      def version
        @body[8..9]
      end

      def reserved_applicant
        @body[10..19]
      end

      def reserved_bvs
        @body[20..39]
      end

      def response_type
        @body[56]
      end

      def return_code
        @body[57]
      end

      def response_text_size
        @body[58..61].to_i
      end

      def response_text
        @body[62,response_text_size] || ""
      end

      def error_message
        response_text[8..100] || "general bvs error"
      end

      def debits_info
        response_text[6]
      end

      def build(body)
        body.gsub("\n", '').gsub("\t", '').gsub("\\t", '').gsub("\\n", '').scan(/<PRE>([^<>]*)<\/PRE>/imu).flatten[0]
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
biro-0.6.6 lib/biro/gateways/bvs/builders/debits_response_builder.rb