Class: Spree::Gateway::CustomPaymentSourceMethod
- Inherits:
-
Gateway
- Object
- Gateway
- Spree::Gateway::CustomPaymentSourceMethod
- Defined in:
- app/models/spree/gateway/custom_payment_source_method.rb
Instance Method Summary collapse
- #confirmation_required? ⇒ Boolean
- #create_profile(payment) ⇒ Object
-
#find_or_create_customer(user) ⇒ Object
simulate a 3rd party payment gateway api to fetch/or create a customer.
- #payment_profiles_supported? ⇒ Boolean
- #payment_source_class ⇒ Object
- #provider_class ⇒ Object
- #show_in_admin? ⇒ Boolean
Instance Method Details
#confirmation_required? ⇒ Boolean
11 12 13 |
# File 'app/models/spree/gateway/custom_payment_source_method.rb', line 11 def confirmation_required? true end |
#create_profile(payment) ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'app/models/spree/gateway/custom_payment_source_method.rb', line 23 def create_profile(payment) return if payment.source.gateway_customer.present? user = payment.source.user || payment.order.user return if user.blank? find_or_create_customer(user) end |
#find_or_create_customer(user) ⇒ Object
simulate a 3rd party payment gateway api to fetch/or create a customer
33 34 35 |
# File 'app/models/spree/gateway/custom_payment_source_method.rb', line 33 def find_or_create_customer(user) gateway_customers.find_or_create_by!(user: user, profile_id: "CUSTOMER-#{user.id}") end |
#payment_profiles_supported? ⇒ Boolean
15 16 17 |
# File 'app/models/spree/gateway/custom_payment_source_method.rb', line 15 def payment_profiles_supported? true end |
#payment_source_class ⇒ Object
7 8 9 |
# File 'app/models/spree/gateway/custom_payment_source_method.rb', line 7 def payment_source_class Spree::PaymentSource end |
#provider_class ⇒ Object
3 4 5 |
# File 'app/models/spree/gateway/custom_payment_source_method.rb', line 3 def provider_class self.class end |
#show_in_admin? ⇒ Boolean
19 20 21 |
# File 'app/models/spree/gateway/custom_payment_source_method.rb', line 19 def show_in_admin? false end |