Exception: DPay::CardPaymentError

Inherits:
ApiError
  • Object
show all
Defined in:
lib/dpay/errors.rb,
sig/dpay/errors.rbs

Instance Attribute Summary

Attributes inherited from ApiError

#error_code, #field_errors, #http_status, #raw_body

Class Method Summary collapse

Methods inherited from ApiError

#initialize

Constructor Details

This class inherits a constructor from DPay::ApiError

Class Method Details

.from_api(data) ⇒ CardPaymentError

Parameters:

  • data (Hash[String, untyped])

Returns:



71
72
73
74
75
# File 'lib/dpay/errors.rb', line 71

def self.from_api(data)
  message = data["message"].is_a?(String) && !data["message"].empty? ? data["message"] : "Card payment rejected"

  new(message, 200, message, {}, Internal::PHP.json_encode(data))
end