1
0
Fork 0
This repository has been archived on 2023-03-27. You can view files and clone it, but cannot push or open issues or pull requests.
lpr-partynest/app/interactors/confirm_passport.rb

26 lines
583 B
Ruby
Raw Normal View History

2018-11-30 19:40:34 -05:00
# frozen_string_literal: true
class ConfirmPassport
include Interactor
def call
create_passport_confirmation
confirm_passport
end
def create_passport_confirmation
2018-12-01 06:05:50 -05:00
passport_confirmation =
2018-11-30 19:40:34 -05:00
context.passport.passport_confirmations.build user: context.user
2018-12-01 06:05:50 -05:00
context.fail! passport_confirmation: nil unless passport_confirmation.save
context.passport_confirmation = passport_confirmation
2018-11-30 19:40:34 -05:00
end
def confirm_passport
return unless context.passport.enough_confirmations?
context.fail! unless context.passport.update confirmed: true
end
end