diff --git a/app/jobs/connect_app_job.rb b/app/jobs/connect_app_job.rb index 9ecfad4cd7..43d273f155 100644 --- a/app/jobs/connect_app_job.rb +++ b/app/jobs/connect_app_job.rb @@ -4,7 +4,7 @@ class ConnectAppJob < ApplicationJob include CableReady::Broadcaster def perform(app, token, channel: nil) - url = "https://n8n.openfoodnetwork.org.uk/webhook/regen/connect-enterprise" + url = I18n.t("connect_app.url") event = "connect-app" enterprise = app.enterprise payload = { diff --git a/config/locales/en.yml b/config/locales/en.yml index efb8d01f37..17adb4de41 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -265,6 +265,8 @@ en: community_forum_url: "Community forum URL" customer_instructions: "Customer instructions" additional_information: "Additional Information" + connect_app: + url: "https://n8n.openfoodnetwork.org/webhook/regen/connect-enterprise" devise: passwords: spree_user: diff --git a/spec/fixtures/vcr_cassettes/ConnectAppJob/stores_connection_data_on_the_app.yml b/spec/fixtures/vcr_cassettes/ConnectAppJob/stores_connection_data_on_the_app.yml index 42a832a80b..8c4981bae7 100644 --- a/spec/fixtures/vcr_cassettes/ConnectAppJob/stores_connection_data_on_the_app.yml +++ b/spec/fixtures/vcr_cassettes/ConnectAppJob/stores_connection_data_on_the_app.yml @@ -2,11 +2,11 @@ http_interactions: - request: method: post - uri: https://n8n.openfoodnetwork.org.uk/webhook/regen/connect-enterprise + uri: https://n8n.openfoodnetwork.org/webhook/regen/connect-enterprise body: encoding: UTF-8 - string: '{"id":"27bc9d0a-d95c-4a36-9b16-01fdd8a82b51","at":"2023-12-21 14:54:28 - +1100","event":"connect-app","data":{"@id":"http://test.host/api/dfc/enterprises/3","access_token":"12345"}}' + string: '{"id":"c9f0e82a-f200-4c1a-9aa2-3a3a63c7acba","at":"2024-04-05 15:30:57 + +1100","event":"connect-app","data":{"@id":"http://test.host/api/dfc/enterprises/3","access_token":""}}' headers: User-Agent: - openfoodnetwork_webhook/1.0 @@ -21,34 +21,24 @@ http_interactions: code: 200 message: OK headers: - Server: - - nginx - Date: - - Thu, 21 Dec 2023 03:54:33 GMT - Content-Type: - - application/json; charset=utf-8 Content-Length: - '141' - Connection: - - keep-alive + Content-Type: + - application/json; charset=utf-8 + Date: + - Fri, 05 Apr 2024 04:30:58 GMT Etag: - W/"8d-Lz10bce6zwT2C429xIkj52OBWyk" + Strict-Transport-Security: + - max-age=315360000; includeSubDomains; preload Vary: - Accept-Encoding - Strict-Transport-Security: - - max-age=63072000 - X-Xss-Protection: - - 1; mode=block - X-Download-Options: - - noopen X-Content-Type-Options: - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - same-origin + X-Xss-Protection: + - 1; mode=block body: encoding: UTF-8 - string: '{"link":"https://example.net/update","destroy":"https://n8n.openfoodnetwork.org.uk/webhook/remove-enterprise?id=recjBXXXXXXXXXXXX&key=12345"}' - recorded_at: Thu, 21 Dec 2023 03:54:33 GMT + string: '{"link":"https://example.net/update","destroy":"https://n8n.openfoodnetwork.org.uk/webhook/remove-enterprise?id=recjBXXXXXXXXXXXX&key="}' + recorded_at: Fri, 05 Apr 2024 04:30:58 GMT recorded_with: VCR 6.2.0 diff --git a/spec/fixtures/vcr_cassettes/Connected_Apps/can_be_enabled_and_disabled.yml b/spec/fixtures/vcr_cassettes/Connected_Apps/can_be_enabled_and_disabled.yml index b968963b7b..c38e0d8fd4 100644 --- a/spec/fixtures/vcr_cassettes/Connected_Apps/can_be_enabled_and_disabled.yml +++ b/spec/fixtures/vcr_cassettes/Connected_Apps/can_be_enabled_and_disabled.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: post - uri: https://n8n.openfoodnetwork.org.uk/webhook/regen/connect-enterprise + uri: https://n8n.openfoodnetwork.org/webhook/regen/connect-enterprise body: encoding: UTF-8 string: '{"id":"4da377c8-0c8f-4aaa-8f85-f2a218a13d6e","at":"2023-12-14 12:52:53 diff --git a/spec/jobs/connect_app_job_spec.rb b/spec/jobs/connect_app_job_spec.rb index 8491a0004d..0dd232d14f 100644 --- a/spec/jobs/connect_app_job_spec.rb +++ b/spec/jobs/connect_app_job_spec.rb @@ -8,7 +8,7 @@ RSpec.describe ConnectAppJob, type: :job do let(:app) { ConnectedApp.new(enterprise: ) } let(:enterprise) { build(:enterprise, id: 3, owner: user) } let(:user) { build(:user, spree_api_key: "12345") } - let(:url) { "https://n8n.openfoodnetwork.org.uk/webhook/regen/connect-enterprise" } + let(:url) { "https://n8n.openfoodnetwork.org/webhook/regen/connect-enterprise" } it "sends a semantic id and access token" do stub_request(:post, url).to_return(body: '{}')