class CreateLndhubAccountJob < ApplicationJob
  queue_as :default

  def perform(user)
    return if user.ln_account.present? && user.ln_password.present?

    lndhub = LndhubV2.new
    credentials = lndhub.create_account

    user.update! ln_account: credentials["login"],
                 ln_password: credentials["password"]
  end
end
