class SbrfMerchant::Api::Response::AppendSuccessFlagToHash

Public Instance Methods

call(hash) click to toggle source
# File lib/sbrf_merchant/api/response/append_success_flag_to_hash.rb, line 7
def call(hash)
  hash.merge(success?: success?(hash))
end

Private Instance Methods

success?(hash) click to toggle source

Ответ считается успешным когда errorCode == '0' но есть ньюанс, В успешном ответе на запрос register errorCode отсутствует, поэтому проверяем по параметру formUrl

# File lib/sbrf_merchant/api/response/append_success_flag_to_hash.rb, line 16
def success?(hash)
  !hash[:form_url].nil? || hash[:error_code] == '0'
end