Sha256: 686858cc4478bc23166ee4e9dc44a6bed3ba90b9a56c598c152fe664aa4d5fc7

Contents?: true

Size: 506 Bytes

Versions: 3

Compression:

Stored size: 506 Bytes

Contents

module Payture::Cheques
  module Responses
    class ChequeStatus
      attr_reader :sent, :cheque, :error_code, :status

      def initialize(data)
        @sent = data['Sended']
        @cheque = data['Cheque']
        @status = data['Status']
        @error_code = data['ErrCode'] || Status::ERROR_STATES[@status]
      end

      def processed?
        error_code.nil? && @sent == true && @status == 'Created'
      end

      def processing_error?
        !error_code.nil?
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
payture-cheques-0.1.5 lib/payture/cheques/responses/cheque_status.rb
payture-cheques-0.1.4 lib/payture/cheques/responses/cheque_status.rb
payture-cheques-0.1.3 lib/payture/cheques/responses/cheque_status.rb