Sha256: 6d4de86be0d3f119f8f6649abfd9f61637397a181f4d2014db589bf2c2164b84
Contents?: true
Size: 794 Bytes
Versions: 2
Compression:
Stored size: 794 Bytes
Contents
# frozen_string_literal: true module Payture::Cheques module Responses class Status < Base ERROR_STATES = { 'Unauthorized' => 'CANNOT_AUTHORIZE_TERMINAL', 'NotFound' => 'NOT_FOUND', 'Timeout' => 'TIMEOUT', 'Unknown' => 'UNKNOWN', }.freeze def cheques @cheques ||= body['Cheques'].map { |c| ChequeStatus.new(c) } end def success? body['Success'] == true end def processed? error_code.nil? && cheques.all?(&:processed?) end def processing_error? !error_code.nil? || cheques.any?(&:processing_error?) end def error_code body['ErrCode'] || ERROR_STATES[body['Status']] end def status body['Status'] end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
payture-cheques-0.1.4 | lib/payture/cheques/responses/status.rb |
payture-cheques-0.1.3 | lib/payture/cheques/responses/status.rb |