Class: SpreePaypalCheckout::CreateSource
- Inherits:
-
Object
- Object
- SpreePaypalCheckout::CreateSource
- Defined in:
- app/services/spree_paypal_checkout/create_source.rb
Instance Method Summary collapse
-
#call ⇒ Object
TODO: add support for venmo and other providers.
-
#initialize(paypal_payment_source:, gateway:, order: nil, user: nil) ⇒ CreateSource
constructor
A new instance of CreateSource.
Constructor Details
#initialize(paypal_payment_source:, gateway:, order: nil, user: nil) ⇒ CreateSource
Returns a new instance of CreateSource.
3 4 5 6 7 8 |
# File 'app/services/spree_paypal_checkout/create_source.rb', line 3 def initialize(paypal_payment_source:, gateway:, order: nil, user: nil) @paypal_payment_source = paypal_payment_source @gateway = gateway @user = user || order&.user @order = order end |
Instance Method Details
#call ⇒ Object
TODO: add support for venmo and other providers
11 12 13 14 15 16 17 |
# File 'app/services/spree_paypal_checkout/create_source.rb', line 11 def call if paypal_payment_source['paypal'].present? create_paypal_source else raise 'Invalid payment source', paypal_payment_source end end |