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
-
.hint ⇒ Object
readonly
Returns the value of attribute hint.
-
.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
- #hint ⇒ Object
- #status ⇒ Object
- #title ⇒ Object
- #to_problem_details(challenge_id: nil) ⇒ Object
- #type ⇒ Object
Class Attribute Details
.hint ⇒ Object (readonly)
Returns the value of attribute hint.
49 50 51 |
# File 'lib/mpp/errors.rb', line 49 def hint @hint end |
.status ⇒ Object (readonly)
Returns the value of attribute status.
40 41 42 |
# File 'lib/mpp/errors.rb', line 40 def status @status end |
.title ⇒ Object (readonly)
Returns the value of attribute title.
46 47 48 |
# File 'lib/mpp/errors.rb', line 46 def title @title end |
.type ⇒ Object (readonly)
Returns the value of attribute type.
43 44 45 |
# File 'lib/mpp/errors.rb', line 43 def type @type end |
Class Method Details
.inherited(subclass) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/mpp/errors.rb', line 21 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) subclass.instance_variable_set(:@hint, nil) unless subclass.instance_variable_defined?(:@hint) end |
Instance Method Details
#hint ⇒ Object
76 |
# File 'lib/mpp/errors.rb', line 76 def hint = self.class.hint |
#status ⇒ Object
70 |
# File 'lib/mpp/errors.rb', line 70 def status = self.class.status |
#title ⇒ Object
74 |
# File 'lib/mpp/errors.rb', line 74 def title = self.class.title |
#to_problem_details(challenge_id: nil) ⇒ Object
80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/mpp/errors.rb', line 80 def to_problem_details(challenge_id: nil) details = { "type" => type, "title" => title, "status" => status, "detail" => } details["hint"] = hint if hint details["challengeId"] = challenge_id if challenge_id details end |
#type ⇒ Object
72 |
# File 'lib/mpp/errors.rb', line 72 def type = self.class.type |