Sha256: 2285d3990df19fa827621e4cf12ec34157dd123d689c085c27890048dc672156

Contents?: true

Size: 694 Bytes

Versions: 6

Compression:

Stored size: 694 Bytes

Contents

module Workarea
  if Plugin.installed?(:api)
    module Api
      module Storefront
        class GiftCardsController < Api::Storefront::ApplicationController
          def balance
            email = params.fetch(:email, nil)
            token = params.fetch(:token, nil)

            if email.present? && token.present?
              @gift_card = Payment::GiftCard.find_by_token_and_email(token, email)
            end

            if @gift_card.blank?
              raise Mongoid::Errors::DocumentNotFound.new(
                Payment::GiftCard,
                email: email,
                token: token
              )
            end
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
workarea-gift_cards-3.4.11 app/controllers/workarea/api/storefront/gift_cards_controller.rb
workarea-gift_cards-3.4.10 app/controllers/workarea/api/storefront/gift_cards_controller.rb
workarea-gift_cards-3.4.9 app/controllers/workarea/api/storefront/gift_cards_controller.rb
workarea-gift_cards-3.4.8 app/controllers/workarea/api/storefront/gift_cards_controller.rb
workarea-gift_cards-3.4.7 app/controllers/workarea/api/storefront/gift_cards_controller.rb
workarea-gift_cards-3.4.6 app/controllers/workarea/api/storefront/gift_cards_controller.rb