Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat(anrok): GraphQL add enum type for tax codes that are applicable on whole invoice #2499

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/graphql/types/invoices/applied_taxes/object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ class Object < Types::BaseObject
implements Types::Taxes::AppliedTax

field :applied_on_whole_invoice, GraphQL::Types::Boolean, null: false, method: :applied_on_whole_invoice?
field :enumed_tax_code, Types::Invoices::AppliedTaxes::WholeInvoiceApplicableTaxCodeEnum, null: true
field :fees_amount_cents, GraphQL::Types::BigInt, null: false
field :invoice, Types::Invoices::Object, null: false

def enumed_tax_code
object.tax_code if object.applied_on_whole_invoice?
end
end
end
end
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# frozen_string_literal: true

module Types
module Invoices
module AppliedTaxes
class WholeInvoiceApplicableTaxCodeEnum < Types::BaseEnum
graphql_name 'InvoiceAppliedTaxOnWholeInvoiceCodeEnum'

Invoice::AppliedTax::TAX_CODES_APPLICABLE_ON_WHOLE_INVOICE.each do |type|
value type
end
end
end
end
end
9 changes: 9 additions & 0 deletions schema.graphql

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 55 additions & 0 deletions schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.