diff --git a/app/graphql/types/integrations/hubspot.rb b/app/graphql/types/integrations/hubspot.rb index 90d34105faa..20a85cbcfe1 100644 --- a/app/graphql/types/integrations/hubspot.rb +++ b/app/graphql/types/integrations/hubspot.rb @@ -10,7 +10,6 @@ class Hubspot < Types::BaseObject field :default_targeted_object, Types::Integrations::Hubspot::TargetedObjectsEnum, null: false field :id, ID, null: false field :name, String, null: false - field :private_app_token, String, null: false field :sync_invoices, Boolean field :sync_subscriptions, Boolean end diff --git a/app/graphql/types/integrations/hubspot/create_input.rb b/app/graphql/types/integrations/hubspot/create_input.rb index 6a773528b92..7624e0639b3 100644 --- a/app/graphql/types/integrations/hubspot/create_input.rb +++ b/app/graphql/types/integrations/hubspot/create_input.rb @@ -11,7 +11,6 @@ class CreateInput < Types::BaseInputObject argument :connection_id, String, required: true argument :default_targeted_object, Types::Integrations::Hubspot::TargetedObjectsEnum, required: true - argument :private_app_token, String, required: true argument :sync_invoices, Boolean, required: false argument :sync_subscriptions, Boolean, required: false end diff --git a/app/graphql/types/integrations/hubspot/update_input.rb b/app/graphql/types/integrations/hubspot/update_input.rb index 6c9df5a16ad..ea99614b4dd 100644 --- a/app/graphql/types/integrations/hubspot/update_input.rb +++ b/app/graphql/types/integrations/hubspot/update_input.rb @@ -13,7 +13,6 @@ class UpdateInput < Types::BaseInputObject argument :connection_id, String, required: false argument :default_targeted_object, Types::Integrations::Hubspot::TargetedObjectsEnum, required: false - argument :private_app_token, String, required: false argument :sync_invoices, Boolean, required: false argument :sync_subscriptions, Boolean, required: false end diff --git a/app/jobs/integrations/aggregator/send_private_app_token_job.rb b/app/jobs/integrations/aggregator/send_private_app_token_job.rb deleted file mode 100644 index 12963d57720..00000000000 --- a/app/jobs/integrations/aggregator/send_private_app_token_job.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -module Integrations - module Aggregator - class SendPrivateAppTokenJob < ApplicationJob - queue_as 'integrations' - - retry_on LagoHttpClient::HttpError, wait: :polynomially_longer, attempts: 3 - - def perform(integration:) - result = Integrations::Aggregator::SendPrivateAppTokenService.call(integration:) - result.raise_if_error! - end - end - end -end diff --git a/app/models/integrations/hubspot_integration.rb b/app/models/integrations/hubspot_integration.rb index a75bd4af889..42c3d6d1dd7 100644 --- a/app/models/integrations/hubspot_integration.rb +++ b/app/models/integrations/hubspot_integration.rb @@ -2,12 +2,12 @@ module Integrations class HubspotIntegration < BaseIntegration - validates :connection_id, :private_app_token, :default_targeted_object, presence: true + validates :connection_id, :default_targeted_object, presence: true settings_accessors :default_targeted_object, :sync_subscriptions, :sync_invoices, :subscriptions_object_type_id, :invoices_object_type_id, :companies_properties_version, :contacts_properties_version, :subscriptions_properties_version, :invoices_properties_version, :portal_id - secrets_accessors :connection_id, :private_app_token + secrets_accessors :connection_id TARGETED_OBJECTS = %w[companies contacts].freeze diff --git a/app/services/integrations/aggregator/custom_object_service.rb b/app/services/integrations/aggregator/custom_object_service.rb new file mode 100644 index 00000000000..b055ed70cba --- /dev/null +++ b/app/services/integrations/aggregator/custom_object_service.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +module Integrations + module Aggregator + class CustomObjectService < BaseService + def initialize(integration:, name:) + @name = name + super(integration:) + end + + def action_path + "v1/#{provider}/custom-object" + end + + def call + response = http_client.get(headers:, params:) + + result.custom_object = OpenStruct.new(response) + result + end + + private + + attr_reader :name + + def headers + { + 'Connection-Id' => integration.connection_id, + 'Authorization' => "Bearer #{secret_key}", + 'Provider-Config-Key' => provider_key + } + end + + def params + { + 'name' => name + } + end + end + end +end diff --git a/app/services/integrations/aggregator/send_private_app_token_service.rb b/app/services/integrations/aggregator/send_private_app_token_service.rb deleted file mode 100644 index 659390ec348..00000000000 --- a/app/services/integrations/aggregator/send_private_app_token_service.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -module Integrations - module Aggregator - class SendPrivateAppTokenService < BaseService - def action_path - "connection/#{integration.connection_id}/metadata" - end - - def call - return unless integration.type == 'Integrations::HubspotIntegration' - return unless integration.private_app_token - - payload = { - privateAppToken: integration.private_app_token - } - - response = http_client.post_with_response(payload, headers) - result.response = response - - result - end - - private - - def headers - { - 'Provider-Config-Key' => 'hubspot', - 'Authorization' => "Bearer #{secret_key}" - } - end - end - end -end diff --git a/app/services/integrations/hubspot/create_service.rb b/app/services/integrations/hubspot/create_service.rb index 3c17fca1ae8..8b847e1d3e1 100644 --- a/app/services/integrations/hubspot/create_service.rb +++ b/app/services/integrations/hubspot/create_service.rb @@ -22,7 +22,6 @@ def call name: params[:name], code: params[:code], connection_id: params[:connection_id], - private_app_token: params[:private_app_token], default_targeted_object: params[:default_targeted_object], sync_invoices: ActiveModel::Type::Boolean.new.cast(params[:sync_invoices]), sync_subscriptions: ActiveModel::Type::Boolean.new.cast(params[:sync_subscriptions]) @@ -31,7 +30,6 @@ def call integration.save! if integration.type == 'Integrations::HubspotIntegration' - Integrations::Aggregator::SendPrivateAppTokenJob.perform_later(integration:) Integrations::Aggregator::SyncCustomObjectsAndPropertiesJob.perform_later(integration:) Integrations::Hubspot::SavePortalIdJob.perform_later(integration:) end diff --git a/app/services/integrations/hubspot/update_service.rb b/app/services/integrations/hubspot/update_service.rb index a661ed68406..2470281b223 100644 --- a/app/services/integrations/hubspot/update_service.rb +++ b/app/services/integrations/hubspot/update_service.rb @@ -17,21 +17,14 @@ def call return result.not_allowed_failure!(code: 'premium_integration_missing') end - old_private_app_token = integration.private_app_token - integration.name = params[:name] if params.key?(:name) integration.code = params[:code] if params.key?(:code) - integration.private_app_token = params[:private_app_token] if params.key?(:private_app_token) integration.default_targeted_object = params[:default_targeted_object] if params.key?(:default_targeted_object) integration.sync_invoices = params[:sync_invoices] if params.key?(:sync_invoices) integration.sync_subscriptions = params[:sync_subscriptions] if params.key?(:sync_subscriptions) integration.save! - if integration.type == 'Integrations::HubspotIntegration' && integration.private_app_token != old_private_app_token - Integrations::Aggregator::SendPrivateAppTokenJob.perform_later(integration:) - end - result.integration = integration result rescue ActiveRecord::RecordInvalid => e diff --git a/schema.graphql b/schema.graphql index f456262ac94..6e17177f008 100644 --- a/schema.graphql +++ b/schema.graphql @@ -2031,7 +2031,6 @@ input CreateHubspotIntegrationInput { connectionId: String! defaultTargetedObject: TargetedObjectsEnum! name: String! - privateAppToken: String! syncInvoices: Boolean syncSubscriptions: Boolean } @@ -4130,7 +4129,6 @@ type HubspotIntegration { defaultTargetedObject: TargetedObjectsEnum! id: ID! name: String! - privateAppToken: String! syncInvoices: Boolean syncSubscriptions: Boolean } @@ -7856,7 +7854,6 @@ input UpdateHubspotIntegrationInput { defaultTargetedObject: TargetedObjectsEnum id: ID name: String - privateAppToken: String syncInvoices: Boolean syncSubscriptions: Boolean } diff --git a/schema.json b/schema.json index 755019a70cd..d35b9a47b11 100644 --- a/schema.json +++ b/schema.json @@ -8106,22 +8106,6 @@ "isDeprecated": false, "deprecationReason": null }, - { - "name": "privateAppToken", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "defaultValue": null, - "isDeprecated": false, - "deprecationReason": null - }, { "name": "syncInvoices", "description": null, @@ -19858,24 +19842,6 @@ ] }, - { - "name": "privateAppToken", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null, - "args": [ - - ] - }, { "name": "syncInvoices", "description": null, @@ -38694,18 +38660,6 @@ "isDeprecated": false, "deprecationReason": null }, - { - "name": "privateAppToken", - "description": null, - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null, - "isDeprecated": false, - "deprecationReason": null - }, { "name": "syncInvoices", "description": null, diff --git a/spec/factories/integrations.rb b/spec/factories/integrations.rb index 6f01830cbbc..13d3833ed0e 100644 --- a/spec/factories/integrations.rb +++ b/spec/factories/integrations.rb @@ -74,7 +74,7 @@ end secrets do - {connection_id: SecureRandom.uuid, private_app_token: SecureRandom.uuid}.to_json + {connection_id: SecureRandom.uuid}.to_json end end end diff --git a/spec/fixtures/integration_aggregator/custom_object_response.json b/spec/fixtures/integration_aggregator/custom_object_response.json new file mode 100644 index 00000000000..375c25dd68f --- /dev/null +++ b/spec/fixtures/integration_aggregator/custom_object_response.json @@ -0,0 +1,1310 @@ +{ + "labels": { + "singular": "LagoInvoice", + "plural": "LagoInvoices" + }, + "requiredProperties": [ + "lago_invoice_id", + "lago_invoice_number" + ], + "searchableProperties": [ + "lago_invoice_id", + "lago_invoice_number" + ], + "primaryDisplayProperty": "lago_invoice_number", + "secondaryDisplayProperties": [ + "lago_invoice_status", + "lago_invoice_id" + ], + "description": "Invoices issued by Lago billing engine", + "archived": false, + "restorable": true, + "metaType": "PORTAL_SPECIFIC", + "id": "35482707", + "fullyQualifiedName": "p46788684_LagoInvoices", + "createdAt": "2024-10-10T16:44:12.791Z", + "updatedAt": "2024-10-10T16:44:14.736Z", + "createdByUserId": 68744312, + "updatedByUserId": 68744312, + "objectTypeId": "2-35482707", + "properties": [ + { + "name": "hs_all_accessible_team_ids", + "label": "All teams", + "type": "enumeration", + "fieldType": "checkbox", + "description": "The team IDs, including the team hierarchy, of all default and custom owner properties for this record.", + "groupName": "lagoinvoices_information", + "options": [], + "displayOrder": -1, + "calculated": false, + "externalOptions": true, + "hasUniqueValue": false, + "hidden": true, + "hubspotDefined": true, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": true, + "readOnlyValue": true + }, + "formField": false, + "dataSensitivity": "non_sensitive" + }, + { + "name": "hs_all_assigned_business_unit_ids", + "label": "Business units", + "type": "enumeration", + "fieldType": "checkbox", + "description": "The business units this record is assigned to.", + "groupName": "lagoinvoices_information", + "options": [], + "displayOrder": -1, + "calculated": false, + "externalOptions": true, + "hasUniqueValue": false, + "hidden": true, + "hubspotDefined": true, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": true, + "readOnlyValue": false + }, + "formField": false, + "dataSensitivity": "non_sensitive" + }, + { + "name": "hs_all_owner_ids", + "label": "All owner IDs", + "type": "enumeration", + "fieldType": "checkbox", + "description": "Values of all default and custom owner properties for this record.", + "groupName": "lagoinvoices_information", + "options": [], + "displayOrder": -1, + "calculated": false, + "externalOptions": true, + "hasUniqueValue": false, + "hidden": true, + "hubspotDefined": true, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": true, + "readOnlyValue": true + }, + "formField": false, + "dataSensitivity": "non_sensitive" + }, + { + "name": "hs_all_team_ids", + "label": "All team IDs", + "type": "enumeration", + "fieldType": "checkbox", + "description": "The team IDs of all default and custom owner properties for this record.", + "groupName": "lagoinvoices_information", + "options": [], + "displayOrder": -1, + "calculated": false, + "externalOptions": true, + "hasUniqueValue": false, + "hidden": true, + "hubspotDefined": true, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": true, + "readOnlyValue": true + }, + "formField": false, + "dataSensitivity": "non_sensitive" + }, + { + "name": "hs_created_by_user_id", + "label": "Created by user ID", + "type": "number", + "fieldType": "number", + "description": "The user who created this record. This value is set automatically by HubSpot.", + "groupName": "lagoinvoices_information", + "options": [], + "displayOrder": -1, + "calculated": false, + "externalOptions": false, + "hasUniqueValue": false, + "hidden": false, + "hubspotDefined": true, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": true, + "readOnlyValue": true + }, + "formField": false, + "dataSensitivity": "non_sensitive" + }, + { + "name": "hs_createdate", + "label": "Object create date/time", + "type": "datetime", + "fieldType": "date", + "description": "The date and time at which this object was created. This value is automatically set by HubSpot and may not be modified.", + "groupName": "lagoinvoices_information", + "options": [], + "displayOrder": -1, + "calculated": false, + "externalOptions": false, + "hasUniqueValue": false, + "hidden": false, + "hubspotDefined": true, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": true, + "readOnlyValue": true + }, + "formField": false, + "dataSensitivity": "non_sensitive" + }, + { + "name": "hs_lastmodifieddate", + "label": "Object last modified date/time", + "type": "datetime", + "fieldType": "date", + "description": "Most recent timestamp of any property update for this object. This includes HubSpot internal properties, which can be visible or hidden. This property is updated automatically.", + "groupName": "lagoinvoices_information", + "options": [], + "displayOrder": -1, + "calculated": false, + "externalOptions": false, + "hasUniqueValue": false, + "hidden": false, + "hubspotDefined": true, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": true, + "readOnlyValue": true + }, + "formField": false, + "dataSensitivity": "non_sensitive" + }, + { + "name": "hs_merged_object_ids", + "label": "Merged record IDs", + "type": "enumeration", + "fieldType": "checkbox", + "description": "The list of record IDs that have been merged into this record. This value is set automatically by HubSpot.", + "groupName": "lagoinvoices_information", + "options": [], + "displayOrder": -1, + "calculated": false, + "externalOptions": true, + "hasUniqueValue": false, + "hidden": false, + "hubspotDefined": true, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": true, + "readOnlyValue": true + }, + "formField": false, + "dataSensitivity": "non_sensitive" + }, + { + "name": "hs_object_id", + "label": "Record ID", + "type": "number", + "fieldType": "number", + "description": "The unique ID for this record. This value is set automatically by HubSpot.", + "groupName": "lagoinvoices_information", + "options": [], + "displayOrder": -1, + "calculated": false, + "externalOptions": false, + "hasUniqueValue": false, + "hidden": false, + "hubspotDefined": true, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": true, + "readOnlyValue": true + }, + "formField": false, + "dataSensitivity": "non_sensitive" + }, + { + "name": "hs_object_source", + "label": "Record creation source", + "type": "string", + "fieldType": "text", + "description": "Raw internal PropertySource present in the RequestMeta when this record was created.", + "groupName": "lagoinvoices_information", + "options": [], + "displayOrder": -1, + "calculated": false, + "externalOptions": false, + "hasUniqueValue": false, + "hidden": true, + "hubspotDefined": true, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": true, + "readOnlyValue": true + }, + "formField": false, + "dataSensitivity": "non_sensitive" + }, + { + "name": "hs_object_source_detail_1", + "label": "Record source detail 1", + "type": "string", + "fieldType": "text", + "description": "First level of detail on how this record was created.", + "groupName": "lagoinvoices_information", + "options": [], + "displayOrder": -1, + "calculated": false, + "externalOptions": false, + "hasUniqueValue": false, + "hidden": false, + "hubspotDefined": true, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": true, + "readOnlyValue": true + }, + "formField": false, + "dataSensitivity": "non_sensitive" + }, + { + "name": "hs_object_source_detail_2", + "label": "Record source detail 2", + "type": "string", + "fieldType": "text", + "description": "Second level of detail on how this record was created.", + "groupName": "lagoinvoices_information", + "options": [], + "displayOrder": -1, + "calculated": false, + "externalOptions": false, + "hasUniqueValue": false, + "hidden": false, + "hubspotDefined": true, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": true, + "readOnlyValue": true + }, + "formField": false, + "dataSensitivity": "non_sensitive" + }, + { + "name": "hs_object_source_detail_3", + "label": "Record source detail 3", + "type": "string", + "fieldType": "text", + "description": "Third level of detail on how this record was created.", + "groupName": "lagoinvoices_information", + "options": [], + "displayOrder": -1, + "calculated": false, + "externalOptions": false, + "hasUniqueValue": false, + "hidden": false, + "hubspotDefined": true, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": true, + "readOnlyValue": true + }, + "formField": false, + "dataSensitivity": "non_sensitive" + }, + { + "name": "hs_object_source_id", + "label": "Record creation source ID", + "type": "string", + "fieldType": "text", + "description": "Raw internal sourceId present in the RequestMeta when this record was created.", + "groupName": "lagoinvoices_information", + "options": [], + "displayOrder": -1, + "calculated": false, + "externalOptions": false, + "hasUniqueValue": false, + "hidden": true, + "hubspotDefined": true, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": true, + "readOnlyValue": true + }, + "formField": false, + "dataSensitivity": "non_sensitive" + }, + { + "name": "hs_object_source_label", + "label": "Record source", + "type": "enumeration", + "fieldType": "select", + "description": "How this record was created.", + "groupName": "lagoinvoices_information", + "options": [], + "displayOrder": -1, + "calculated": false, + "externalOptions": true, + "hasUniqueValue": false, + "hidden": false, + "hubspotDefined": true, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": true, + "readOnlyValue": true + }, + "formField": false, + "dataSensitivity": "non_sensitive" + }, + { + "name": "hs_object_source_user_id", + "label": "Record creation source user ID", + "type": "number", + "fieldType": "number", + "description": "Raw internal userId present in the RequestMeta when this record was created.", + "groupName": "lagoinvoices_information", + "options": [], + "displayOrder": -1, + "calculated": false, + "externalOptions": false, + "hasUniqueValue": false, + "hidden": true, + "hubspotDefined": true, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": true, + "readOnlyValue": true + }, + "formField": false, + "dataSensitivity": "non_sensitive" + }, + { + "updatedAt": "2024-10-10T16:44:13.352Z", + "createdAt": "2024-10-10T16:44:13.352Z", + "name": "hs_pinned_engagement_id", + "label": "Pinned Engagement ID", + "type": "number", + "fieldType": "number", + "description": "The object ID of the current pinned engagement. This will only be shown in the app if there is already an association to the engagement.", + "groupName": "lagoinvoices_information", + "options": [], + "createdUserId": "68744312", + "updatedUserId": "68744312", + "displayOrder": -1, + "calculated": false, + "externalOptions": false, + "archived": false, + "hasUniqueValue": false, + "hidden": true, + "hubspotDefined": true, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": true, + "readOnlyValue": false + }, + "formField": false, + "dataSensitivity": "non_sensitive" + }, + { + "name": "hs_read_only", + "label": "Read only object", + "type": "bool", + "fieldType": "booleancheckbox", + "description": "Determines whether a record can be edited by a user.", + "groupName": "lagoinvoices_information", + "options": [ + { + "label": "True", + "value": "true", + "displayOrder": 0, + "hidden": false + }, + { + "label": "False", + "value": "false", + "displayOrder": 1, + "hidden": false + } + ], + "displayOrder": -1, + "calculated": false, + "externalOptions": false, + "hasUniqueValue": false, + "hidden": true, + "hubspotDefined": true, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": true, + "readOnlyValue": true + }, + "formField": false, + "dataSensitivity": "non_sensitive" + }, + { + "name": "hs_shared_team_ids", + "label": "Shared teams", + "type": "enumeration", + "fieldType": "checkbox", + "description": "Additional teams whose users can access the record based on their permissions. This can be set manually or through Workflows or APIs.", + "groupName": "lagoinvoices_information", + "options": [], + "displayOrder": -1, + "calculated": false, + "externalOptions": true, + "hasUniqueValue": false, + "hidden": true, + "hubspotDefined": true, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": true, + "readOnlyValue": true + }, + "formField": false, + "dataSensitivity": "non_sensitive" + }, + { + "name": "hs_shared_user_ids", + "label": "Shared users", + "type": "enumeration", + "fieldType": "checkbox", + "description": "Additional users that can access the record based on their permissions. This can be set manually or through Workflows and APIs.", + "groupName": "lagoinvoices_information", + "options": [], + "displayOrder": -1, + "calculated": false, + "externalOptions": true, + "hasUniqueValue": false, + "hidden": true, + "hubspotDefined": true, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": true, + "readOnlyValue": true + }, + "formField": false, + "dataSensitivity": "non_sensitive" + }, + { + "name": "hs_unique_creation_key", + "label": "Unique creation key", + "type": "string", + "fieldType": "text", + "description": "Unique property used for idempotent creates", + "groupName": "lagoinvoices_information", + "options": [], + "displayOrder": -1, + "calculated": false, + "externalOptions": false, + "hasUniqueValue": true, + "hidden": true, + "hubspotDefined": true, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": true, + "readOnlyValue": true + }, + "formField": false, + "dataSensitivity": "non_sensitive" + }, + { + "name": "hs_updated_by_user_id", + "label": "Updated by user ID", + "type": "number", + "fieldType": "number", + "description": "The user who last updated this record. This value is set automatically by HubSpot.", + "groupName": "lagoinvoices_information", + "options": [], + "displayOrder": -1, + "calculated": false, + "externalOptions": false, + "hasUniqueValue": false, + "hidden": false, + "hubspotDefined": true, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": true, + "readOnlyValue": true + }, + "formField": false, + "dataSensitivity": "non_sensitive" + }, + { + "name": "hs_user_ids_of_all_notification_followers", + "label": "User IDs of all notification followers", + "type": "enumeration", + "fieldType": "checkbox", + "description": "The user IDs of all users that have clicked follow within the object to opt-in to getting follow notifications", + "groupName": "lagoinvoices_information", + "options": [], + "displayOrder": -1, + "calculated": false, + "externalOptions": true, + "hasUniqueValue": false, + "hidden": true, + "hubspotDefined": true, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": true, + "readOnlyValue": true + }, + "formField": false, + "dataSensitivity": "non_sensitive" + }, + { + "name": "hs_user_ids_of_all_notification_unfollowers", + "label": "User IDs of all notification unfollowers", + "type": "enumeration", + "fieldType": "checkbox", + "description": "The user IDs of all object owners that have clicked unfollow within the object to opt-out of getting follow notifications", + "groupName": "lagoinvoices_information", + "options": [], + "displayOrder": -1, + "calculated": false, + "externalOptions": true, + "hasUniqueValue": false, + "hidden": true, + "hubspotDefined": true, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": true, + "readOnlyValue": true + }, + "formField": false, + "dataSensitivity": "non_sensitive" + }, + { + "name": "hs_user_ids_of_all_owners", + "label": "User IDs of all owners", + "type": "enumeration", + "fieldType": "checkbox", + "description": "The user IDs of all owners of this record.", + "groupName": "lagoinvoices_information", + "options": [], + "displayOrder": -1, + "calculated": false, + "externalOptions": true, + "hasUniqueValue": false, + "hidden": true, + "hubspotDefined": true, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": true, + "readOnlyValue": true + }, + "formField": false, + "dataSensitivity": "non_sensitive" + }, + { + "name": "hs_was_imported", + "label": "Performed in an import", + "type": "bool", + "fieldType": "booleancheckbox", + "description": "Object is part of an import", + "groupName": "lagoinvoices_information", + "options": [ + { + "label": "True", + "value": "true", + "displayOrder": 0, + "hidden": false + }, + { + "label": "False", + "value": "false", + "displayOrder": 1, + "hidden": false + } + ], + "displayOrder": -1, + "calculated": false, + "externalOptions": false, + "hasUniqueValue": false, + "hidden": true, + "hubspotDefined": true, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": true, + "readOnlyValue": true + }, + "formField": false, + "dataSensitivity": "non_sensitive" + }, + { + "name": "hubspot_owner_assigneddate", + "label": "Owner assigned date", + "type": "datetime", + "fieldType": "date", + "description": "The most recent timestamp of when an owner was assigned to this record. This value is set automatically by HubSpot.", + "groupName": "lagoinvoices_information", + "options": [], + "displayOrder": -1, + "calculated": false, + "externalOptions": false, + "hasUniqueValue": false, + "hidden": false, + "hubspotDefined": true, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": true, + "readOnlyValue": true + }, + "formField": false, + "dataSensitivity": "non_sensitive" + }, + { + "name": "hubspot_owner_id", + "label": "Owner", + "type": "enumeration", + "fieldType": "select", + "description": "The owner of the object.", + "groupName": "lagoinvoices_information", + "options": [], + "referencedObjectType": "OWNER", + "displayOrder": -1, + "calculated": false, + "externalOptions": true, + "hasUniqueValue": false, + "hidden": false, + "hubspotDefined": true, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": true, + "readOnlyValue": false + }, + "formField": false, + "dataSensitivity": "non_sensitive" + }, + { + "name": "hubspot_team_id", + "label": "Owner's main team", + "type": "enumeration", + "fieldType": "select", + "description": "The main team of the record owner. This value is set automatically by HubSpot.", + "groupName": "lagoinvoices_information", + "options": [], + "displayOrder": -1, + "calculated": false, + "externalOptions": true, + "hasUniqueValue": false, + "hidden": false, + "hubspotDefined": true, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": true, + "readOnlyValue": true + }, + "formField": false, + "dataSensitivity": "non_sensitive" + }, + { + "updatedAt": "2024-10-10T16:44:12.996Z", + "createdAt": "2024-10-10T16:44:12.996Z", + "name": "lago_invoice_currency", + "label": "Lago Invoice Currency", + "type": "string", + "fieldType": "text", + "description": "", + "groupName": "lagoinvoices_information", + "options": [], + "createdUserId": "68744312", + "updatedUserId": "68744312", + "displayOrder": -1, + "calculated": false, + "externalOptions": false, + "archived": false, + "hasUniqueValue": false, + "hidden": false, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": false, + "readOnlyValue": false + }, + "formField": false, + "dataSensitivity": "non_sensitive" + }, + { + "updatedAt": "2024-10-10T16:44:12.996Z", + "createdAt": "2024-10-10T16:44:12.996Z", + "name": "lago_invoice_file_url", + "label": "Lago Invoice File URL", + "type": "string", + "fieldType": "file", + "description": "", + "groupName": "lagoinvoices_information", + "options": [], + "createdUserId": "68744312", + "updatedUserId": "68744312", + "displayOrder": -1, + "calculated": false, + "externalOptions": false, + "archived": false, + "hasUniqueValue": false, + "hidden": false, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": false, + "readOnlyValue": false + }, + "formField": false, + "dataSensitivity": "non_sensitive" + }, + { + "updatedAt": "2024-10-10T16:44:12.996Z", + "createdAt": "2024-10-10T16:44:12.996Z", + "name": "lago_invoice_id", + "label": "Lago Invoice Id", + "type": "string", + "fieldType": "text", + "description": "", + "groupName": "lagoinvoices_information", + "options": [], + "createdUserId": "68744312", + "updatedUserId": "68744312", + "displayOrder": -1, + "calculated": false, + "externalOptions": false, + "archived": false, + "hasUniqueValue": true, + "hidden": false, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": false, + "readOnlyValue": false + }, + "formField": false, + "dataSensitivity": "non_sensitive" + }, + { + "updatedAt": "2024-10-10T16:44:12.996Z", + "createdAt": "2024-10-10T16:44:12.996Z", + "name": "lago_invoice_issuing_date", + "label": "Lago Invoice Issuing Date", + "type": "date", + "fieldType": "date", + "description": "", + "groupName": "lagoinvoices_information", + "options": [], + "createdUserId": "68744312", + "updatedUserId": "68744312", + "displayOrder": -1, + "calculated": false, + "externalOptions": false, + "archived": false, + "hasUniqueValue": false, + "hidden": false, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": false, + "readOnlyValue": false + }, + "formField": false, + "dataSensitivity": "non_sensitive" + }, + { + "updatedAt": "2024-10-10T16:44:12.996Z", + "createdAt": "2024-10-10T16:44:12.996Z", + "name": "lago_invoice_number", + "label": "Lago Invoice Number", + "type": "string", + "fieldType": "text", + "description": "", + "groupName": "lagoinvoices_information", + "options": [], + "createdUserId": "68744312", + "updatedUserId": "68744312", + "displayOrder": -1, + "calculated": false, + "externalOptions": false, + "archived": false, + "hasUniqueValue": false, + "hidden": false, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": false, + "readOnlyValue": false + }, + "formField": false, + "dataSensitivity": "non_sensitive" + }, + { + "updatedAt": "2024-10-10T16:44:12.996Z", + "createdAt": "2024-10-10T16:44:12.996Z", + "name": "lago_invoice_payment_due_date", + "label": "Lago Invoice Payment Due Date", + "type": "date", + "fieldType": "date", + "description": "", + "groupName": "lagoinvoices_information", + "options": [], + "createdUserId": "68744312", + "updatedUserId": "68744312", + "displayOrder": -1, + "calculated": false, + "externalOptions": false, + "archived": false, + "hasUniqueValue": false, + "hidden": false, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": false, + "readOnlyValue": false + }, + "formField": false, + "dataSensitivity": "non_sensitive" + }, + { + "updatedAt": "2024-10-10T16:44:12.996Z", + "createdAt": "2024-10-10T16:44:12.996Z", + "name": "lago_invoice_payment_overdue", + "label": "Lago Invoice Payment Overdue", + "type": "bool", + "fieldType": "booleancheckbox", + "description": "", + "groupName": "lagoinvoices", + "options": [ + { + "label": "True", + "value": "true", + "displayOrder": 0, + "hidden": false + }, + { + "label": "False", + "value": "false", + "displayOrder": 1, + "hidden": false + } + ], + "createdUserId": "68744312", + "updatedUserId": "68744312", + "displayOrder": -1, + "calculated": false, + "externalOptions": false, + "archived": false, + "hasUniqueValue": false, + "hidden": false, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": false, + "readOnlyValue": false + }, + "formField": false, + "dataSensitivity": "non_sensitive" + }, + { + "updatedAt": "2024-10-10T16:44:12.996Z", + "createdAt": "2024-10-10T16:44:12.996Z", + "name": "lago_invoice_payment_status", + "label": "Lago Invoice Payment Status", + "type": "string", + "fieldType": "text", + "description": "", + "groupName": "lagoinvoices_information", + "options": [], + "createdUserId": "68744312", + "updatedUserId": "68744312", + "displayOrder": -1, + "calculated": false, + "externalOptions": false, + "archived": false, + "hasUniqueValue": false, + "hidden": false, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": false, + "readOnlyValue": false + }, + "formField": false, + "dataSensitivity": "non_sensitive" + }, + { + "updatedAt": "2024-10-10T16:44:12.996Z", + "createdAt": "2024-10-10T16:44:12.996Z", + "name": "lago_invoice_status", + "label": "Lago Invoice Status", + "type": "string", + "fieldType": "text", + "description": "", + "groupName": "lagoinvoices_information", + "options": [], + "createdUserId": "68744312", + "updatedUserId": "68744312", + "displayOrder": -1, + "calculated": false, + "externalOptions": false, + "archived": false, + "hasUniqueValue": false, + "hidden": false, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": false, + "readOnlyValue": false + }, + "formField": false, + "dataSensitivity": "non_sensitive" + }, + { + "updatedAt": "2024-10-10T16:44:12.996Z", + "createdAt": "2024-10-10T16:44:12.996Z", + "name": "lago_invoice_subtotal_excluding_taxes", + "label": "Lago Invoice Subtotal Excluding Taxes", + "type": "number", + "fieldType": "number", + "description": "", + "groupName": "lagoinvoices_information", + "options": [], + "createdUserId": "68744312", + "updatedUserId": "68744312", + "displayOrder": -1, + "calculated": false, + "externalOptions": false, + "archived": false, + "hasUniqueValue": false, + "hidden": false, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": false, + "readOnlyValue": false + }, + "formField": false, + "dataSensitivity": "non_sensitive" + }, + { + "updatedAt": "2024-10-10T16:44:12.996Z", + "createdAt": "2024-10-10T16:44:12.996Z", + "name": "lago_invoice_total_amount", + "label": "Lago Invoice Total Amount", + "type": "number", + "fieldType": "number", + "description": "", + "groupName": "lagoinvoices_information", + "options": [], + "createdUserId": "68744312", + "updatedUserId": "68744312", + "displayOrder": -1, + "calculated": false, + "externalOptions": false, + "archived": false, + "hasUniqueValue": false, + "hidden": false, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": false, + "readOnlyValue": false + }, + "formField": false, + "dataSensitivity": "non_sensitive" + }, + { + "updatedAt": "2024-10-10T16:44:12.996Z", + "createdAt": "2024-10-10T16:44:12.996Z", + "name": "lago_invoice_type", + "label": "Lago Invoice Type", + "type": "string", + "fieldType": "text", + "description": "", + "groupName": "lagoinvoices_information", + "options": [], + "createdUserId": "68744312", + "updatedUserId": "68744312", + "displayOrder": -1, + "calculated": false, + "externalOptions": false, + "archived": false, + "hasUniqueValue": false, + "hidden": false, + "modificationMetadata": { + "archivable": true, + "readOnlyDefinition": false, + "readOnlyValue": false + }, + "formField": false, + "dataSensitivity": "non_sensitive" + } + ], + "associations": [ + { + "fromObjectTypeId": "2-35482707", + "toObjectTypeId": "0-116", + "name": "lagoinvoices_to_postal_mail", + "cardinality": "ONE_TO_MANY", + "inverseCardinality": "ONE_TO_MANY", + "hasUserEnforcedMaxToObjectIds": false, + "hasUserEnforcedMaxFromObjectIds": false, + "maxToObjectIds": 10000, + "maxFromObjectIds": 10000, + "id": "615", + "createdAt": null, + "updatedAt": null + }, + { + "fromObjectTypeId": "0-116", + "toObjectTypeId": "2-35482707", + "name": "lagoinvoices_to_postal_mail", + "cardinality": "ONE_TO_MANY", + "inverseCardinality": "ONE_TO_MANY", + "hasUserEnforcedMaxToObjectIds": false, + "hasUserEnforcedMaxFromObjectIds": false, + "maxToObjectIds": 10000, + "maxFromObjectIds": 10000, + "id": "616", + "createdAt": null, + "updatedAt": null + }, + { + "fromObjectTypeId": "2-35482707", + "toObjectTypeId": "0-18", + "name": "communication_to_lagoinvoices", + "cardinality": "ONE_TO_MANY", + "inverseCardinality": "ONE_TO_MANY", + "hasUserEnforcedMaxToObjectIds": false, + "hasUserEnforcedMaxFromObjectIds": false, + "maxToObjectIds": 10000, + "maxFromObjectIds": 10000, + "id": "619", + "createdAt": null, + "updatedAt": null + }, + { + "fromObjectTypeId": "0-18", + "toObjectTypeId": "2-35482707", + "name": "communication_to_lagoinvoices", + "cardinality": "ONE_TO_MANY", + "inverseCardinality": "ONE_TO_MANY", + "hasUserEnforcedMaxToObjectIds": false, + "hasUserEnforcedMaxFromObjectIds": false, + "maxToObjectIds": 10000, + "maxFromObjectIds": 10000, + "id": "620", + "createdAt": null, + "updatedAt": null + }, + { + "fromObjectTypeId": "2-35482707", + "toObjectTypeId": "0-27", + "name": "lagoinvoices_to_task", + "cardinality": "ONE_TO_MANY", + "inverseCardinality": "ONE_TO_MANY", + "hasUserEnforcedMaxToObjectIds": false, + "hasUserEnforcedMaxFromObjectIds": false, + "maxToObjectIds": 10000, + "maxFromObjectIds": 10000, + "id": "611", + "createdAt": null, + "updatedAt": null + }, + { + "fromObjectTypeId": "0-27", + "toObjectTypeId": "2-35482707", + "name": "lagoinvoices_to_task", + "cardinality": "ONE_TO_MANY", + "inverseCardinality": "ONE_TO_MANY", + "hasUserEnforcedMaxToObjectIds": false, + "hasUserEnforcedMaxFromObjectIds": false, + "maxToObjectIds": 10000, + "maxFromObjectIds": 10000, + "id": "612", + "createdAt": null, + "updatedAt": null + }, + { + "fromObjectTypeId": "2-35482707", + "toObjectTypeId": "0-2", + "name": "company_to_lagoinvoices", + "cardinality": "ONE_TO_MANY", + "inverseCardinality": "ONE_TO_MANY", + "hasUserEnforcedMaxToObjectIds": false, + "hasUserEnforcedMaxFromObjectIds": false, + "maxToObjectIds": 50000, + "maxFromObjectIds": 50000, + "id": "627", + "createdAt": null, + "updatedAt": null + }, + { + "fromObjectTypeId": "0-2", + "toObjectTypeId": "2-35482707", + "name": "company_to_lagoinvoices", + "cardinality": "ONE_TO_MANY", + "inverseCardinality": "ONE_TO_MANY", + "hasUserEnforcedMaxToObjectIds": false, + "hasUserEnforcedMaxFromObjectIds": false, + "maxToObjectIds": 50000, + "maxFromObjectIds": 50000, + "id": "628", + "createdAt": null, + "updatedAt": null + }, + { + "fromObjectTypeId": "2-35482707", + "toObjectTypeId": "0-47", + "name": "lagoinvoices_to_meeting_event", + "cardinality": "ONE_TO_MANY", + "inverseCardinality": "ONE_TO_MANY", + "hasUserEnforcedMaxToObjectIds": false, + "hasUserEnforcedMaxFromObjectIds": false, + "maxToObjectIds": 10000, + "maxFromObjectIds": 10000, + "id": "617", + "createdAt": null, + "updatedAt": null + }, + { + "fromObjectTypeId": "0-47", + "toObjectTypeId": "2-35482707", + "name": "lagoinvoices_to_meeting_event", + "cardinality": "ONE_TO_MANY", + "inverseCardinality": "ONE_TO_MANY", + "hasUserEnforcedMaxToObjectIds": false, + "hasUserEnforcedMaxFromObjectIds": false, + "maxToObjectIds": 10000, + "maxFromObjectIds": 10000, + "id": "618", + "createdAt": null, + "updatedAt": null + }, + { + "fromObjectTypeId": "2-35482707", + "toObjectTypeId": "0-46", + "name": "lagoinvoices_to_note", + "cardinality": "ONE_TO_MANY", + "inverseCardinality": "ONE_TO_MANY", + "hasUserEnforcedMaxToObjectIds": false, + "hasUserEnforcedMaxFromObjectIds": false, + "maxToObjectIds": 10000, + "maxFromObjectIds": 10000, + "id": "623", + "createdAt": null, + "updatedAt": null + }, + { + "fromObjectTypeId": "0-46", + "toObjectTypeId": "2-35482707", + "name": "lagoinvoices_to_note", + "cardinality": "ONE_TO_MANY", + "inverseCardinality": "ONE_TO_MANY", + "hasUserEnforcedMaxToObjectIds": false, + "hasUserEnforcedMaxFromObjectIds": false, + "maxToObjectIds": 10000, + "maxFromObjectIds": 10000, + "id": "624", + "createdAt": null, + "updatedAt": null + }, + { + "fromObjectTypeId": "2-35482707", + "toObjectTypeId": "0-48", + "name": "call_to_lagoinvoices", + "cardinality": "ONE_TO_MANY", + "inverseCardinality": "ONE_TO_MANY", + "hasUserEnforcedMaxToObjectIds": false, + "hasUserEnforcedMaxFromObjectIds": false, + "maxToObjectIds": 10000, + "maxFromObjectIds": 10000, + "id": "621", + "createdAt": null, + "updatedAt": null + }, + { + "fromObjectTypeId": "0-48", + "toObjectTypeId": "2-35482707", + "name": "call_to_lagoinvoices", + "cardinality": "ONE_TO_MANY", + "inverseCardinality": "ONE_TO_MANY", + "hasUserEnforcedMaxToObjectIds": false, + "hasUserEnforcedMaxFromObjectIds": false, + "maxToObjectIds": 10000, + "maxFromObjectIds": 10000, + "id": "622", + "createdAt": null, + "updatedAt": null + }, + { + "fromObjectTypeId": "2-35482707", + "toObjectTypeId": "0-51", + "name": "conversation_session_to_lagoinvoices", + "cardinality": "ONE_TO_MANY", + "inverseCardinality": "ONE_TO_MANY", + "hasUserEnforcedMaxToObjectIds": false, + "hasUserEnforcedMaxFromObjectIds": false, + "maxToObjectIds": 10000, + "maxFromObjectIds": 10000, + "id": "609", + "createdAt": null, + "updatedAt": null + }, + { + "fromObjectTypeId": "0-51", + "toObjectTypeId": "2-35482707", + "name": "conversation_session_to_lagoinvoices", + "cardinality": "ONE_TO_MANY", + "inverseCardinality": "ONE_TO_MANY", + "hasUserEnforcedMaxToObjectIds": false, + "hasUserEnforcedMaxFromObjectIds": false, + "maxToObjectIds": 10000, + "maxFromObjectIds": 10000, + "id": "610", + "createdAt": null, + "updatedAt": null + }, + { + "fromObjectTypeId": "2-35482707", + "toObjectTypeId": "0-1", + "name": "contact_to_lagoinvoices", + "cardinality": "ONE_TO_MANY", + "inverseCardinality": "ONE_TO_MANY", + "hasUserEnforcedMaxToObjectIds": false, + "hasUserEnforcedMaxFromObjectIds": false, + "maxToObjectIds": 50000, + "maxFromObjectIds": 50000, + "id": "625", + "createdAt": null, + "updatedAt": null + }, + { + "fromObjectTypeId": "0-1", + "toObjectTypeId": "2-35482707", + "name": "contact_to_lagoinvoices", + "cardinality": "ONE_TO_MANY", + "inverseCardinality": "ONE_TO_MANY", + "hasUserEnforcedMaxToObjectIds": false, + "hasUserEnforcedMaxFromObjectIds": false, + "maxToObjectIds": 50000, + "maxFromObjectIds": 50000, + "id": "626", + "createdAt": null, + "updatedAt": null + }, + { + "fromObjectTypeId": "2-35482707", + "toObjectTypeId": "0-49", + "name": "email_to_lagoinvoices", + "cardinality": "ONE_TO_MANY", + "inverseCardinality": "ONE_TO_MANY", + "hasUserEnforcedMaxToObjectIds": false, + "hasUserEnforcedMaxFromObjectIds": false, + "maxToObjectIds": 10000, + "maxFromObjectIds": 10000, + "id": "613", + "createdAt": null, + "updatedAt": null + }, + { + "fromObjectTypeId": "0-49", + "toObjectTypeId": "2-35482707", + "name": "email_to_lagoinvoices", + "cardinality": "ONE_TO_MANY", + "inverseCardinality": "ONE_TO_MANY", + "hasUserEnforcedMaxToObjectIds": false, + "hasUserEnforcedMaxFromObjectIds": false, + "maxToObjectIds": 10000, + "maxFromObjectIds": 10000, + "id": "614", + "createdAt": null, + "updatedAt": null + } + ], + "name": "LagoInvoices" +} diff --git a/spec/graphql/mutations/integrations/hubspot/create_spec.rb b/spec/graphql/mutations/integrations/hubspot/create_spec.rb index aed1d2906fd..23bf15ed90e 100644 --- a/spec/graphql/mutations/integrations/hubspot/create_spec.rb +++ b/spec/graphql/mutations/integrations/hubspot/create_spec.rb @@ -18,7 +18,6 @@ name, connectionId, defaultTargetedObject, - privateAppToken, syncInvoices, syncSubscriptions } @@ -45,8 +44,7 @@ code:, name:, connectionId: 'this-is-random-uuid', - defaultTargetedObject: 'companies', - privateAppToken: 'some-private-app-token' + defaultTargetedObject: 'companies' } } ) diff --git a/spec/graphql/mutations/integrations/hubspot/update_spec.rb b/spec/graphql/mutations/integrations/hubspot/update_spec.rb index 9cfabf01315..ed518d4a852 100644 --- a/spec/graphql/mutations/integrations/hubspot/update_spec.rb +++ b/spec/graphql/mutations/integrations/hubspot/update_spec.rb @@ -19,7 +19,6 @@ name, connectionId, defaultTargetedObject, - privateAppToken, syncInvoices, syncSubscriptions } diff --git a/spec/graphql/types/integrations/hubspot/create_input_spec.rb b/spec/graphql/types/integrations/hubspot/create_input_spec.rb index ec245a88088..2417b393a41 100644 --- a/spec/graphql/types/integrations/hubspot/create_input_spec.rb +++ b/spec/graphql/types/integrations/hubspot/create_input_spec.rb @@ -9,7 +9,6 @@ it { is_expected.to accept_argument(:name).of_type('String!') } it { is_expected.to accept_argument(:connection_id).of_type('String!') } it { is_expected.to accept_argument(:default_targeted_object).of_type('TargetedObjectsEnum!') } - it { is_expected.to accept_argument(:private_app_token).of_type('String!') } it { is_expected.to accept_argument(:sync_invoices).of_type('Boolean') } it { is_expected.to accept_argument(:sync_subscriptions).of_type('Boolean') } end diff --git a/spec/graphql/types/integrations/hubspot/update_input_spec.rb b/spec/graphql/types/integrations/hubspot/update_input_spec.rb index 59b83a2d9b7..6ed27d469cb 100644 --- a/spec/graphql/types/integrations/hubspot/update_input_spec.rb +++ b/spec/graphql/types/integrations/hubspot/update_input_spec.rb @@ -10,7 +10,6 @@ it { is_expected.to accept_argument(:name).of_type('String') } it { is_expected.to accept_argument(:connection_id).of_type('String') } it { is_expected.to accept_argument(:default_targeted_object).of_type('TargetedObjectsEnum') } - it { is_expected.to accept_argument(:private_app_token).of_type('String') } it { is_expected.to accept_argument(:sync_invoices).of_type('Boolean') } it { is_expected.to accept_argument(:sync_subscriptions).of_type('Boolean') } end diff --git a/spec/graphql/types/integrations/hubspot_spec.rb b/spec/graphql/types/integrations/hubspot_spec.rb index ed96f236384..20c2122e3cb 100644 --- a/spec/graphql/types/integrations/hubspot_spec.rb +++ b/spec/graphql/types/integrations/hubspot_spec.rb @@ -11,7 +11,6 @@ it { is_expected.to have_field(:connection_id).of_type('ID!') } it { is_expected.to have_field(:default_targeted_object).of_type('TargetedObjectsEnum!') } it { is_expected.to have_field(:name).of_type('String!') } - it { is_expected.to have_field(:private_app_token).of_type('String!') } it { is_expected.to have_field(:sync_invoices).of_type('Boolean') } it { is_expected.to have_field(:sync_subscriptions).of_type('Boolean') } diff --git a/spec/jobs/integrations/aggregator/send_private_app_token_job_spec.rb b/spec/jobs/integrations/aggregator/send_private_app_token_job_spec.rb deleted file mode 100644 index f0f195ccf39..00000000000 --- a/spec/jobs/integrations/aggregator/send_private_app_token_job_spec.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -require 'rails_helper' - -RSpec.describe Integrations::Aggregator::SendPrivateAppTokenJob, type: :job do - describe '#perform' do - subject(:send_token_job) { described_class } - - let(:send_token_service) { instance_double(Integrations::Aggregator::SendPrivateAppTokenService) } - let(:integration) { create(:hubspot_integration) } - let(:result) { BaseService::Result.new } - - before do - allow(Integrations::Aggregator::SendPrivateAppTokenService).to receive(:new).and_return(send_token_service) - allow(send_token_service).to receive(:call).and_return(result) - end - - it 'sends the private app token the nango' do - described_class.perform_now(integration:) - - expect(Integrations::Aggregator::SendPrivateAppTokenService).to have_received(:new) - expect(send_token_service).to have_received(:call) - end - end -end diff --git a/spec/models/integrations/hubspot_integration_spec.rb b/spec/models/integrations/hubspot_integration_spec.rb index ca008c87a12..9f154c1a22e 100644 --- a/spec/models/integrations/hubspot_integration_spec.rb +++ b/spec/models/integrations/hubspot_integration_spec.rb @@ -7,7 +7,6 @@ it { is_expected.to validate_presence_of(:name) } it { is_expected.to validate_presence_of(:connection_id) } - it { is_expected.to validate_presence_of(:private_app_token) } it { is_expected.to validate_presence_of(:default_targeted_object) } describe 'validations' do @@ -23,13 +22,6 @@ end end - describe '#private_app_token' do - it 'assigns and retrieve a secret pair' do - hubspot_integration.private_app_token = 'secret_token' - expect(hubspot_integration.private_app_token).to eq('secret_token') - end - end - describe '#default_targeted_object' do it 'assigns and retrieve a setting' do hubspot_integration.default_targeted_object = 'companies' diff --git a/spec/services/integrations/aggregator/custom_object_service_spec.rb b/spec/services/integrations/aggregator/custom_object_service_spec.rb new file mode 100644 index 00000000000..39937f20e75 --- /dev/null +++ b/spec/services/integrations/aggregator/custom_object_service_spec.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +require 'rails_helper' + +RSpec.describe Integrations::Aggregator::CustomObjectService do + subject(:custom_object_service) { described_class.new(integration:, name:) } + + let(:integration) { create(:hubspot_integration) } + let(:name) { 'LagoInvoices' } + + describe '.call' do + let(:lago_client) { instance_double(LagoHttpClient::Client) } + let(:endpoint) { 'https://api.nango.dev/v1/hubspot/custom-object' } + + let(:headers) do + { + 'Connection-Id' => integration.connection_id, + 'Authorization' => "Bearer #{ENV["NANGO_SECRET_KEY"]}", + 'Provider-Config-Key' => 'hubspot' + } + end + + let(:params) do + { + 'name' => name + } + end + + let(:aggregator_response) do + path = Rails.root.join('spec/fixtures/integration_aggregator/custom_object_response.json') + JSON.parse(File.read(path)) + end + + before do + allow(LagoHttpClient::Client).to receive(:new).with(endpoint).and_return(lago_client) + allow(lago_client).to receive(:get).with(headers:, params:).and_return(aggregator_response) + end + + it 'successfully fetches custom object' do + result = custom_object_service.call + custom_object = result.custom_object + + aggregate_failures do + expect(LagoHttpClient::Client).to have_received(:new).with(endpoint) + expect(lago_client).to have_received(:get) + expect(custom_object.id).to eq('35482707') + expect(custom_object.objectTypeId).to eq('2-35482707') + end + end + end +end diff --git a/spec/services/integrations/aggregator/send_private_app_token_service_spec.rb b/spec/services/integrations/aggregator/send_private_app_token_service_spec.rb deleted file mode 100644 index 7b67e366ba2..00000000000 --- a/spec/services/integrations/aggregator/send_private_app_token_service_spec.rb +++ /dev/null @@ -1,36 +0,0 @@ -# frozen_string_literal: true - -require 'rails_helper' - -RSpec.describe Integrations::Aggregator::SendPrivateAppTokenService do - subject(:send_private_token_service) { described_class.new(integration:) } - - let(:integration) { create(:hubspot_integration) } - - describe '.call' do - let(:lago_client) { instance_double(LagoHttpClient::Client) } - let(:endpoint) { "https://api.nango.dev/connection/#{integration.connection_id}/metadata" } - - before do - allow(LagoHttpClient::Client).to receive(:new) - .with(endpoint) - .and_return(lago_client) - allow(lago_client).to receive(:post_with_response) - - integration.private_app_token = 'privatetoken' - integration.save! - end - - it 'successfully sends token to nango' do - send_private_token_service.call - - aggregate_failures do - expect(LagoHttpClient::Client).to have_received(:new) - .with(endpoint) - expect(lago_client).to have_received(:post_with_response) do |payload| - expect(payload[:privateAppToken]).to eq('privatetoken') - end - end - end - end -end diff --git a/spec/services/integrations/hubspot/create_service_spec.rb b/spec/services/integrations/hubspot/create_service_spec.rb index 7af58e9d789..c08eda9cb06 100644 --- a/spec/services/integrations/hubspot/create_service_spec.rb +++ b/spec/services/integrations/hubspot/create_service_spec.rb @@ -18,7 +18,6 @@ code: 'hubspot1', organization_id: organization.id, connection_id: 'conn1', - private_app_token: 'token', client_secret: 'secret', default_targeted_object: "test", sync_invoices: false, @@ -58,8 +57,8 @@ context 'with hubspot premium integration present' do before do organization.update!(premium_integrations: ['hubspot']) - allow(Integrations::Aggregator::SendPrivateAppTokenJob).to receive(:perform_later) allow(Integrations::Aggregator::SyncCustomObjectsAndPropertiesJob).to receive(:perform_later) + allow(Integrations::Hubspot::SavePortalIdJob).to receive(:perform_later) end context 'without validation errors' do @@ -70,7 +69,6 @@ expect(integration.name).to eq(name) expect(integration.code).to eq(create_args[:code]) expect(integration.connection_id).to eq(create_args[:connection_id]) - expect(integration.private_app_token).to eq(create_args[:private_app_token]) expect(integration.default_targeted_object).to eq(create_args[:default_targeted_object]) expect(integration.sync_invoices).to eq(create_args[:sync_invoices]) expect(integration.sync_subscriptions).to eq(create_args[:sync_subscriptions]) @@ -87,7 +85,6 @@ service_call integration = Integrations::HubspotIntegration.order(:created_at).last - expect(Integrations::Aggregator::SendPrivateAppTokenJob).to have_received(:perform_later).with(integration:) expect(Integrations::Aggregator::SyncCustomObjectsAndPropertiesJob).to have_received(:perform_later).with(integration:) expect(Integrations::Hubspot::SavePortalIdJob).to have_received(:perform_later).with(integration:) end diff --git a/spec/services/integrations/hubspot/update_service_spec.rb b/spec/services/integrations/hubspot/update_service_spec.rb index b2bf405a1c4..de2d717c4b5 100644 --- a/spec/services/integrations/hubspot/update_service_spec.rb +++ b/spec/services/integrations/hubspot/update_service_spec.rb @@ -16,8 +16,7 @@ let(:update_args) do { name:, - code: 'hubspot1', - private_app_token: 'new_token' + code: 'hubspot1' } end @@ -49,7 +48,6 @@ context 'with hubspot premium integration present' do before do organization.update!(premium_integrations: ['hubspot']) - allow(Integrations::Aggregator::SendPrivateAppTokenJob).to receive(:perform_later) end context 'without validation errors' do @@ -58,7 +56,6 @@ integration = Integrations::HubspotIntegration.order(:updated_at).last expect(integration.name).to eq(name) - expect(integration.private_app_token).to eq(update_args[:private_app_token]) end it 'returns an integration in result object' do @@ -66,12 +63,6 @@ expect(result.integration).to be_a(Integrations::HubspotIntegration) end - - it 'calls Integrations::Aggregator::SendPrivateAppTokenJob' do - service_call - - expect(Integrations::Aggregator::SendPrivateAppTokenJob).to have_received(:perform_later).with(integration:) - end end context 'with validation error' do