Class: SpreeCmCommissioner::UserFbTokenChecker

Inherits:
BaseInteractor show all
Defined in:
app/interactors/spree_cm_commissioner/user_fb_token_checker.rb

Instance Method Summary collapse

Instance Method Details

#callObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/interactors/spree_cm_commissioner/user_fb_token_checker.rb', line 5

def call
  fb_data = SpreeCmCommissioner::FetchFacebookUserData.call(fb_access_token: fb_access_token)
  context.fail!(message: fb_data.message) if fb_data.failure?

  context.provider = fb_data.provider

  identity_checker = SpreeCmCommissioner::UserIdentityChecker.call(
    identity_type: context.provider[:identity_type],
    sub: context.provider[:sub],
    tenant_id: tenant_id
  )

  context.user = identity_checker.success? ? identity_checker.user : nil
end