diff --git a/app/graphql/types/integration_customers/anrok.rb b/app/graphql/types/integration_customers/anrok.rb index 35af081d117..898286f8568 100644 --- a/app/graphql/types/integration_customers/anrok.rb +++ b/app/graphql/types/integration_customers/anrok.rb @@ -5,6 +5,7 @@ module IntegrationCustomers class Anrok < Types::BaseObject graphql_name 'AnrokCustomer' + field :external_account_id, String, null: true field :external_customer_id, String, null: true field :id, ID, null: false field :integration_code, String, null: true @@ -23,6 +24,14 @@ def integration_type def integration_code object.integration&.code end + + def external_account_id + api_key = object.integration.api_key + + return nil unless api_key.include?('/') + + api_key.split('/')[0] + end end end end diff --git a/schema.graphql b/schema.graphql index ef00b6a6dfc..99228d5501b 100644 --- a/schema.graphql +++ b/schema.graphql @@ -133,6 +133,7 @@ type AnrokBreakdownObject { } type AnrokCustomer { + externalAccountId: String externalCustomerId: String id: ID! integrationCode: String diff --git a/schema.json b/schema.json index bc6f598f693..7ae055cdcd7 100644 --- a/schema.json +++ b/schema.json @@ -995,6 +995,20 @@ ], "possibleTypes": null, "fields": [ + { + "name": "externalAccountId", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null, + "args": [ + + ] + }, { "name": "externalCustomerId", "description": null, diff --git a/spec/graphql/types/integration_customers/anrok_spec.rb b/spec/graphql/types/integration_customers/anrok_spec.rb index f55a6fb2ab2..e23cb7a6603 100644 --- a/spec/graphql/types/integration_customers/anrok_spec.rb +++ b/spec/graphql/types/integration_customers/anrok_spec.rb @@ -5,6 +5,7 @@ RSpec.describe Types::IntegrationCustomers::Anrok do subject { described_class } + it { is_expected.to have_field(:external_account_id).of_type('String') } it { is_expected.to have_field(:external_customer_id).of_type('String') } it { is_expected.to have_field(:id).of_type('ID!') } it { is_expected.to have_field(:integration_type).of_type('IntegrationTypeEnum') }