Skip to content

Instantly share code, notes, and snippets.

@NilsonLima
Last active July 3, 2020 17:26
Show Gist options
  • Save NilsonLima/f46207fdd7289ef2befcc0de875f90bb to your computer and use it in GitHub Desktop.
Save NilsonLima/f46207fdd7289ef2befcc0de875f90bb to your computer and use it in GitHub Desktop.
class Smartphone::Contract::ChangeDevice < BaseInteraction
def call
return unless valid_interaction?
persist_models!
return unless changed_certificate.success?
check_imei_async
notify_user
end
def valid_interaction?
not_suspended?
&& invoices_settled?
&& current_device_misatch_previous?
&& previous_attributes_valid?
&& new_attributes_valid?
&& suspended_subscription.success?
end
def not_suspended?
#
end
def invoices_settled?
#
end
def current_device_misatch_previous?
#
end
def previous_attributes_valid?
#
end
def new_attributes_valid?
#
end
def suspended_subscription
#
end
def changed_certificate
#
end
def check_imei_async
#
end
def notify_user
#
end
def persist_models!
#
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment