summaryrefslogtreecommitdiff
path: root/app/controllers/services/create_address_service.rb
blob: 7b67af297e1f22da18e30939b7f11b9154d0304a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

module Services
  # The service for address creation.
  class CreateAddressService < AddressServicesBase
    attr_reader :address

    def call
      if already_existing_address.nil?
        @address = @user_account.address.new(@params)
        @address.save
      else
        add_address_to_user_addresses
        @address = already_existing_address
      end
    end
  end
end