Class: SolidusBolt::Users::SyncPaymentSourcesService

Inherits:
BaseService
  • Object
show all
Defined in:
app/services/solidus_bolt/users/sync_payment_sources_service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseService

call

Constructor Details

#initialize(user:, access_token:) ⇒ SyncPaymentSourcesService

Returns a new instance of SyncPaymentSourcesService.



8
9
10
11
12
13
# File 'app/services/solidus_bolt/users/sync_payment_sources_service.rb', line 8

def initialize(user:, access_token:)
  @user = user
  @access_token = access_token
  @bolt_payment_method = SolidusBolt::PaymentMethod.last
  super
end

Instance Attribute Details

#access_tokenObject (readonly)

Returns the value of attribute access_token.



6
7
8
# File 'app/services/solidus_bolt/users/sync_payment_sources_service.rb', line 6

def access_token
  @access_token
end

#bolt_payment_methodObject (readonly)

Returns the value of attribute bolt_payment_method.



6
7
8
# File 'app/services/solidus_bolt/users/sync_payment_sources_service.rb', line 6

def bolt_payment_method
  @bolt_payment_method
end

#userObject (readonly)

Returns the value of attribute user.



6
7
8
# File 'app/services/solidus_bolt/users/sync_payment_sources_service.rb', line 6

def user
  @user
end

Instance Method Details

#callObject



15
16
17
18
19
20
21
# File 'app/services/solidus_bolt/users/sync_payment_sources_service.rb', line 15

def call
  return if user.nil? || access_token.nil? || bolt_payment_method.nil?

  payment_methods.each do |payment_method|
    add_payment_source(payment_method)
  end
end