Class: Mpp::Methods::Stripe::StripeMethod
- Inherits:
-
Object
- Object
- Mpp::Methods::Stripe::StripeMethod
- Defined in:
- lib/mpp/methods/stripe/stripe_method.rb
Overview
Stripe payment method implementation. Handles SPT-based payments through Stripe’s Business Network.
Instance Attribute Summary collapse
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#decimals ⇒ Object
readonly
Returns the value of attribute decimals.
-
#intents ⇒ Object
Returns the value of attribute intents.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#recipient ⇒ Object
readonly
Returns the value of attribute recipient.
Instance Method Summary collapse
-
#initialize(secret_key:, network_id:, payment_methods: nil, metadata: nil, currency: Defaults::DEFAULT_CURRENCY, decimals: Defaults::DEFAULT_DECIMALS) ⇒ StripeMethod
constructor
A new instance of StripeMethod.
-
#transform_request(request, _credential) ⇒ Object
Transform request - injects Stripe-specific methodDetails.
Constructor Details
#initialize(secret_key:, network_id:, payment_methods: nil, metadata: nil, currency: Defaults::DEFAULT_CURRENCY, decimals: Defaults::DEFAULT_DECIMALS) ⇒ StripeMethod
Returns a new instance of StripeMethod.
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/mpp/methods/stripe/stripe_method.rb', line 15 def initialize(secret_key:, network_id:, payment_methods: nil, metadata: nil, currency: Defaults::DEFAULT_CURRENCY, decimals: Defaults::DEFAULT_DECIMALS) @name = "stripe" @secret_key = secret_key @network_id = network_id @payment_methods = payment_methods @metadata = @currency = currency @recipient = network_id @decimals = decimals @intents = {} end |
Instance Attribute Details
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
12 13 14 |
# File 'lib/mpp/methods/stripe/stripe_method.rb', line 12 def currency @currency end |
#decimals ⇒ Object (readonly)
Returns the value of attribute decimals.
12 13 14 |
# File 'lib/mpp/methods/stripe/stripe_method.rb', line 12 def decimals @decimals end |
#intents ⇒ Object
Returns the value of attribute intents.
13 14 15 |
# File 'lib/mpp/methods/stripe/stripe_method.rb', line 13 def intents @intents end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
12 13 14 |
# File 'lib/mpp/methods/stripe/stripe_method.rb', line 12 def name @name end |
#recipient ⇒ Object (readonly)
Returns the value of attribute recipient.
12 13 14 |
# File 'lib/mpp/methods/stripe/stripe_method.rb', line 12 def recipient @recipient end |
Instance Method Details
#transform_request(request, _credential) ⇒ Object
Transform request - injects Stripe-specific methodDetails.
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/mpp/methods/stripe/stripe_method.rb', line 30 def transform_request(request, _credential) method_details = request.fetch("methodDetails", {}) method_details = {} unless method_details.is_a?(Hash) method_details["networkId"] = @network_id method_details["paymentMethods"] = @payment_methods if @payment_methods method_details["metadata"] = @metadata if @metadata request.merge("methodDetails" => method_details) end |