diff --git a/core/server/api/canary/utils/serializers/input/settings.js b/core/server/api/canary/utils/serializers/input/settings.js index 5f4d496de4..bb3e096ed8 100644 --- a/core/server/api/canary/utils/serializers/input/settings.js +++ b/core/server/api/canary/utils/serializers/input/settings.js @@ -33,11 +33,7 @@ const EDITABLE_SETTINGS = [ 'members_signup_access', 'stripe_secret_key', 'stripe_publishable_key', - 'stripe_connect_secret_key', - 'stripe_connect_publishable_key', - 'stripe_connect_account_id', - 'stripe_connect_display_name', - 'stripe_connect_livemode', + 'stripe_connect_integration_token', 'portal_name', 'portal_button', 'portal_plans', diff --git a/test/e2e-api/admin/__snapshots__/settings.test.js.snap b/test/e2e-api/admin/__snapshots__/settings.test.js.snap index 5ca16ee38d..38c2ce802d 100644 --- a/test/e2e-api/admin/__snapshots__/settings.test.js.snap +++ b/test/e2e-api/admin/__snapshots__/settings.test.js.snap @@ -1452,6 +1452,36 @@ Object { } `; +exports[`Settings API stripe connect Can attempt to connect to stripe 1: [body] 1`] = ` +Object { + "errors": Array [ + Object { + "code": null, + "context": "The Stripe Connect token could not be parsed.", + "details": null, + "ghostErrorCode": null, + "help": null, + "id": StringMatching /\\[a-f0-9\\]\\{8\\}-\\[a-f0-9\\]\\{4\\}-\\[a-f0-9\\]\\{4\\}-\\[a-f0-9\\]\\{4\\}-\\[a-f0-9\\]\\{12\\}/, + "message": "Request not understood error, cannot edit setting.", + "property": null, + "type": "BadRequestError", + }, + ], +} +`; + +exports[`Settings API stripe connect Can attempt to connect to stripe 2: [headers] 1`] = ` +Object { + "access-control-allow-origin": "http://127.0.0.1:2369", + "cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0", + "content-length": "281", + "content-type": "application/json; charset=utf-8", + "etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/, + "vary": "Origin, Accept-Encoding", + "x-powered-by": "Express", +} +`; + exports[`Settings API stripe connect can do disconnectStripeConnectIntegration 1: [headers] 1`] = ` Object { "access-control-allow-origin": "http://127.0.0.1:2369", diff --git a/test/e2e-api/admin/settings.test.js b/test/e2e-api/admin/settings.test.js index 862adf7d5d..ffa2c646f3 100644 --- a/test/e2e-api/admin/settings.test.js +++ b/test/e2e-api/admin/settings.test.js @@ -1,6 +1,6 @@ const assert = require('assert'); const {agentProvider, fixtureManager, mockManager, matchers} = require('../../utils/e2e-framework'); -const {stringMatching, anyEtag} = matchers; +const {stringMatching, anyEtag, anyUuid} = matchers; const CURRENT_SETTINGS_COUNT = 67; @@ -207,6 +207,37 @@ describe('Settings API', function () { }); }); }); + + it('Can attempt to connect to stripe', async function () { + const settingsToChange = [ + { + key: 'stripe_connect_integration_token', + value: JSON.stringify({ + s: 'session_state', + p: 'public_key', + a: 'secret_key', + l: true, + n: 'Display Name', + i: 'account_id' + + }) + } + ]; + + await agent.put('settings/') + .body({ + settings: settingsToChange + }) + .expectStatus(400) + .matchBodySnapshot({ + errors: [{ + id: anyUuid + }] + }) + .matchHeaderSnapshot({ + etag: anyEtag + }); + }); }); // @TODO Fixing https://github.com/TryGhost/Team/issues/584 should result in thes tests changing