Class: Pay24::Result
Constant Summary collapse
- ERRORS =
назание неточно, тут не только ошибки. MESSAGES_TO_PAYMENT_GATEWAY
{ SUCCESS => { message: 'OK', code: 0, }, TEMPORARY_ERROR => { message: 'Временная ошибка. Повторите запрос позже', code: 1, }, ERROR_INVALID_USER_ID_FORMAT => { message: 'Неверный формат идентификатора абонента', code: 4, }, ERROR_USER_NOT_FOUND => { message: 'Идентификатор абонента не найден (Нет такого пользователя)', code: 5, }, ERROR_PAYMENT_DENIED_BY_PROVIDER => { message: 'Прием платежа запрещен провайдером', code: 7, }, ERROR_PAYMENT_DENIED_FOR_TECHNICAL_REASON => { message: 'Прием платежа запрещен по техническим причинам', code: 8, }, ERROR_INACTIVE_USER => { message: 'Счет абонента не активен', code: 79, }, PAYMENT_PROCESSING_NOT_FINISHED => { message: 'Проведение платежа не окончено (При отмене платежа – отмена еще не подтверждена. Система отправит повторный запрос через некоторое время.)', code: 90, }, ERROR_SUM_IS_TOO_SMALL => { message: 'Сумма слишком мала', code: 241, }, ERROR_SUM_IS_TOO_LARGE => { message: 'Сумма слишком велика', code: 242, }, ERROR_CANNOT_CHECK_USER_ACCOUNT_STATE => { message: 'Невозможно проверить состояние счета', code: 243, }, ERROR_INTERNAL => { message: 'Другая ошибка провайдера', code: 300, }, }.freeze
- NON_FATAL_ERRORS =
i{ ok temporary_error payment_processing_not_finished }.freeze
Constants included from Errors
Errors::ERROR_CANNOT_CHECK_USER_ACCOUNT_STATE, Errors::ERROR_INACTIVE_USER, Errors::ERROR_INTERNAL, Errors::ERROR_INVALID_USER_ID_FORMAT, Errors::ERROR_PAYMENT_DENIED_BY_PROVIDER, Errors::ERROR_PAYMENT_DENIED_FOR_TECHNICAL_REASON, Errors::ERROR_SUM_IS_TOO_LARGE, Errors::ERROR_SUM_IS_TOO_SMALL, Errors::ERROR_USER_NOT_FOUND, Errors::PAYMENT_PROCESSING_NOT_FINISHED, Errors::SUCCESS, Errors::TEMPORARY_ERROR
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#result_code ⇒ Object
readonly
Returns the value of attribute result_code.
Instance Method Summary collapse
- #failure? ⇒ Boolean
-
#initialize(result_code) ⇒ Result
constructor
A new instance of Result.
- #success? ⇒ Boolean
Constructor Details
#initialize(result_code) ⇒ Result
Returns a new instance of Result.
69 70 71 72 73 |
# File 'lib/pay24/result.rb', line 69 def initialize(result_code) @result_code = result_code = ERRORS.try(:[], result_code).try(:[], :message) @code = ERRORS.try(:[], result_code).try(:[], :code) end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
13 14 15 |
# File 'lib/pay24/result.rb', line 13 def code @code end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
13 14 15 |
# File 'lib/pay24/result.rb', line 13 def end |
#result_code ⇒ Object (readonly)
Returns the value of attribute result_code.
13 14 15 |
# File 'lib/pay24/result.rb', line 13 def result_code @result_code end |
Instance Method Details
#failure? ⇒ Boolean
75 76 77 |
# File 'lib/pay24/result.rb', line 75 def failure? !success? end |
#success? ⇒ Boolean
79 80 81 |
# File 'lib/pay24/result.rb', line 79 def success? @result_code.to_sym.in? NON_FATAL_ERRORS end |