Class: Payture::Cheques::Responses::ChequeStatus

Inherits:
Object
  • Object
show all
Defined in:
lib/payture/cheques/responses/cheque_status.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ ChequeStatus

Returns a new instance of ChequeStatus.



6
7
8
9
10
11
# File 'lib/payture/cheques/responses/cheque_status.rb', line 6

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

Instance Attribute Details

#chequeObject (readonly)

Returns the value of attribute cheque.



4
5
6
# File 'lib/payture/cheques/responses/cheque_status.rb', line 4

def cheque
  @cheque
end

#error_codeObject (readonly)

Returns the value of attribute error_code.



4
5
6
# File 'lib/payture/cheques/responses/cheque_status.rb', line 4

def error_code
  @error_code
end

#sentObject (readonly)

Returns the value of attribute sent.



4
5
6
# File 'lib/payture/cheques/responses/cheque_status.rb', line 4

def sent
  @sent
end

#statusObject (readonly)

Returns the value of attribute status.



4
5
6
# File 'lib/payture/cheques/responses/cheque_status.rb', line 4

def status
  @status
end

Instance Method Details

#processed?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/payture/cheques/responses/cheque_status.rb', line 13

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

#processing_error?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/payture/cheques/responses/cheque_status.rb', line 17

def processing_error?
  !error_code.nil?
end