diff --git a/app/graphql/types/invoices/applied_taxes/object.rb b/app/graphql/types/invoices/applied_taxes/object.rb index 9b29a795407..a76976ba9b7 100644 --- a/app/graphql/types/invoices/applied_taxes/object.rb +++ b/app/graphql/types/invoices/applied_taxes/object.rb @@ -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 diff --git a/app/graphql/types/invoices/applied_taxes/whole_invoice_applicable_tax_code_enum.rb b/app/graphql/types/invoices/applied_taxes/whole_invoice_applicable_tax_code_enum.rb new file mode 100644 index 00000000000..10c77c9200d --- /dev/null +++ b/app/graphql/types/invoices/applied_taxes/whole_invoice_applicable_tax_code_enum.rb @@ -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 diff --git a/schema.graphql b/schema.graphql index 99228d5501b..a37dcadf997 100644 --- a/schema.graphql +++ b/schema.graphql @@ -4071,6 +4071,7 @@ type InvoiceAppliedTax implements AppliedTax { amountCurrency: CurrencyEnum! appliedOnWholeInvoice: Boolean! createdAt: ISO8601DateTime! + enumedTaxCode: InvoiceAppliedTaxOnWholeInvoiceCodeEnum feesAmountCents: BigInt! id: ID! invoice: Invoice! @@ -4082,6 +4083,14 @@ type InvoiceAppliedTax implements AppliedTax { updatedAt: ISO8601DateTime! } +enum InvoiceAppliedTaxOnWholeInvoiceCodeEnum { + customer_exempt + juris_not_taxed + not_collecting + reverse_charge + transaction_exempt +} + """ InvoiceCollection type """ diff --git a/schema.json b/schema.json index 7ae055cdcd7..001bc557d81 100644 --- a/schema.json +++ b/schema.json @@ -19337,6 +19337,20 @@ ] }, + { + "name": "enumedTaxCode", + "description": null, + "type": { + "kind": "ENUM", + "name": "InvoiceAppliedTaxOnWholeInvoiceCodeEnum", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null, + "args": [ + + ] + }, { "name": "feesAmountCents", "description": null, @@ -19499,6 +19513,47 @@ "inputFields": null, "enumValues": null }, + { + "kind": "ENUM", + "name": "InvoiceAppliedTaxOnWholeInvoiceCodeEnum", + "description": null, + "interfaces": null, + "possibleTypes": null, + "fields": null, + "inputFields": null, + "enumValues": [ + { + "name": "not_collecting", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "juris_not_taxed", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "reverse_charge", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "customer_exempt", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "transaction_exempt", + "description": null, + "isDeprecated": false, + "deprecationReason": null + } + ] + }, { "kind": "OBJECT", "name": "InvoiceCollection",