Exception: Mpp::Extensions::MCP::PaymentVerificationError
- Inherits:
-
StandardError
- Object
- StandardError
- Mpp::Extensions::MCP::PaymentVerificationError
- Extended by:
- T::Sig
- Defined in:
- lib/mpp/extensions/mcp/errors.rb
Instance Attribute Summary collapse
-
#challenges ⇒ Object
readonly
Returns the value of attribute challenges.
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#detail ⇒ Object
readonly
Returns the value of attribute detail.
-
#reason ⇒ Object
readonly
Returns the value of attribute reason.
Instance Method Summary collapse
-
#initialize(challenges:, reason: nil, detail: nil, message: "Payment Verification Failed") ⇒ PaymentVerificationError
constructor
A new instance of PaymentVerificationError.
- #to_jsonrpc_error ⇒ Object
Constructor Details
#initialize(challenges:, reason: nil, detail: nil, message: "Payment Verification Failed") ⇒ PaymentVerificationError
Returns a new instance of PaymentVerificationError.
52 53 54 55 56 57 58 |
# File 'lib/mpp/extensions/mcp/errors.rb', line 52 def initialize(challenges:, reason: nil, detail: nil, message: "Payment Verification Failed") @challenges = T.let(challenges, T.untyped) @reason = T.let(reason, T.untyped) @detail = T.let(detail, T.untyped) @code = T.let(CODE_PAYMENT_VERIFICATION_FAILED, Integer) super() end |
Instance Attribute Details
#challenges ⇒ Object (readonly)
Returns the value of attribute challenges.
40 41 42 |
# File 'lib/mpp/extensions/mcp/errors.rb', line 40 def challenges @challenges end |
#code ⇒ Object (readonly)
Returns the value of attribute code.
49 50 51 |
# File 'lib/mpp/extensions/mcp/errors.rb', line 49 def code @code end |
#detail ⇒ Object (readonly)
Returns the value of attribute detail.
46 47 48 |
# File 'lib/mpp/extensions/mcp/errors.rb', line 46 def detail @detail end |
#reason ⇒ Object (readonly)
Returns the value of attribute reason.
43 44 45 |
# File 'lib/mpp/extensions/mcp/errors.rb', line 43 def reason @reason end |
Instance Method Details
#to_jsonrpc_error ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/mpp/extensions/mcp/errors.rb', line 61 def to_jsonrpc_error data = { "httpStatus" => HTTP_STATUS_PAYMENT_REQUIRED, "challenges" => @challenges.map(&:to_dict) } if @reason || @detail failure = {} failure["reason"] = @reason if @reason failure["detail"] = @detail if @detail data["failure"] = failure end { "code" => CODE_PAYMENT_VERIFICATION_FAILED, "message" => , "data" => data } end |