Initial commit
This commit is contained in:
18
app/workers/kyc/local/owner_mobile_worker.rb
Normal file
18
app/workers/kyc/local/owner_mobile_worker.rb
Normal file
@@ -0,0 +1,18 @@
|
||||
require 'sidekiq'
|
||||
module KYC
|
||||
module Local
|
||||
class OwnerMobileWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
def perform(mobile_id)
|
||||
mobile = Phone.find_by(id: mobile_id)
|
||||
return unless mobile.user.verified_profile.present?
|
||||
|
||||
jibit = JibitService.new
|
||||
response = jibit.mobile_info(mobile.national_number, mobile.user.verified_profile.national_code)
|
||||
|
||||
mobile.update(step: 'owner_phone') if JSON.parse(response.body).dig('matched').present?
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
22
app/workers/kyc/local/treasury_worker.rb
Normal file
22
app/workers/kyc/local/treasury_worker.rb
Normal file
@@ -0,0 +1,22 @@
|
||||
require 'sidekiq'
|
||||
module KYC
|
||||
module Local
|
||||
class TreasuryWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
def perform(profile_id)
|
||||
profile = Profile.find_by(id: profile_id)
|
||||
return if profile.blank? || profile.state != 'verified'
|
||||
|
||||
treasuries = profile.user.submitted_treasuries
|
||||
return unless treasuries.present?
|
||||
|
||||
treasuries.each do |treasury|
|
||||
jibit = JibitService.new
|
||||
response = treasury.kind == 'iban' ? jibit.iban_info(treasury.data) : jibit.card_info(treasury.data)
|
||||
treasury.update(result: response&.body, state: 'processing')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user