Sha256: 2b7a66295013b77a4008df08beed7febc376c56a3d076e0dbf15c24362178eef

Contents?: true

Size: 876 Bytes

Versions: 4

Compression:

Stored size: 876 Bytes

Contents

# frozen_string_literal: true

module SolidusGraphqlApi
  module Types
    module Interfaces
      module Adjustment
        include Types::Base::Interface

        description "Adjustment."

        orphan_types Types::TaxAdjustment, Types::PromotionAdjustment

        field :amount, String, null: false
        field :created_at, GraphQL::Types::ISO8601DateTime, null: true
        field :eligible, Boolean, null: false
        field :label, String, null: false
        field :updated_at, GraphQL::Types::ISO8601DateTime, null: true

        definition_methods do
          def resolve_type(object, _context)
            case object.source_type
            when Spree::TaxRate.to_s
              Types::TaxAdjustment
            when Spree::PromotionAction.to_s
              Types::PromotionAdjustment
            end
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
solidus_graphql_api-0.3.1 lib/solidus_graphql_api/types/interfaces/adjustment.rb
solidus_graphql_api-0.3.0 lib/solidus_graphql_api/types/interfaces/adjustment.rb
solidus_graphql_api-0.2.0 lib/solidus_graphql_api/types/interfaces/adjustment.rb
solidus_graphql_api-0.1.0 lib/solidus_graphql_api/types/interfaces/adjustment.rb