Class: Payture::Cheques::Responses::Create

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

Constant Summary collapse

ERROR_STATES =
{
  'Conflict' => 'DUPLICATE_ID',
  'BadRequest' => 'BAD_REQUEST_FORMAT',
}.freeze

Instance Attribute Summary

Attributes inherited from Base

#body

Instance Method Summary collapse

Methods inherited from Base

#error?, #error_messages, #initialize

Constructor Details

This class inherits a constructor from Payture::Cheques::Responses::Base

Instance Method Details

#error_codeObject



15
16
17
# File 'lib/payture/cheques/responses/create.rb', line 15

def error_code
  body['ErrCode'] || ERROR_STATES[body['Status']]
end

#success?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/payture/cheques/responses/create.rb', line 11

def success?
  body['Success'] == true && body['Status'] == 'Accepted'
end