Exception: Mpp::PaymentError
- Inherits:
-
StandardError
- Object
- StandardError
- Mpp::PaymentError
- Extended by:
- T::Sig
- Defined in:
- lib/mpp/errors.rb
Overview
Base class for all payment-related errors with RFC 9457 support.
Direct Known Subclasses
BadRequestError, InvalidChallengeError, InvalidPayloadError, MalformedCredentialError, PaymentActionRequiredError, PaymentExpiredError, PaymentInsufficientError, PaymentMethodUnsupportedError, PaymentRequiredError, VerificationFailedError
Class Attribute Summary collapse
-
.status ⇒ Object
readonly
Returns the value of attribute status.
-
.title ⇒ Object
readonly
Returns the value of attribute title.
-
.type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
Class Attribute Details
.status ⇒ Object (readonly)
Returns the value of attribute status.
36 37 38 |
# File 'lib/mpp/errors.rb', line 36 def status @status end |
.title ⇒ Object (readonly)
Returns the value of attribute title.
42 43 44 |
# File 'lib/mpp/errors.rb', line 42 def title @title end |
.type ⇒ Object (readonly)
Returns the value of attribute type.
39 40 41 |
# File 'lib/mpp/errors.rb', line 39 def type @type end |
Class Method Details
.inherited(subclass) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/mpp/errors.rb', line 18 def self.inherited(subclass) super return if subclass.instance_variable_defined?(:@_mpp_configured) subclass.instance_variable_set(:@_mpp_configured, true) name = subclass.name&.split("::")&.last || "PaymentError" unless subclass.instance_variable_defined?(:@type) subclass.instance_variable_set(:@type, "#{BASE_URI}/#{to_slug(name)}") end subclass.instance_variable_set(:@title, to_title(name)) unless subclass.instance_variable_defined?(:@title) subclass.instance_variable_set(:@status, 402) unless subclass.instance_variable_defined?(:@status) end |
Instance Method Details
#status ⇒ Object
62 |
# File 'lib/mpp/errors.rb', line 62 def status = self.class.status |
#title ⇒ Object
66 |
# File 'lib/mpp/errors.rb', line 66 def title = self.class.title |
#to_problem_details(challenge_id: nil) ⇒ Object
70 71 72 73 74 75 76 77 78 79 |
# File 'lib/mpp/errors.rb', line 70 def to_problem_details(challenge_id: nil) details = { "type" => type, "title" => title, "status" => status, "detail" => } details["challengeId"] = challenge_id if challenge_id details end |
#type ⇒ Object
64 |
# File 'lib/mpp/errors.rb', line 64 def type = self.class.type |