0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00

Fixed Stripe Connect (#14857)

refs https://github.com/TryGhost/Team/issues/1637

The `stripe_connect_integration_token` setting is required for the Stripe
Connect flow to work. The existing `stripe_connect_*` settings are also not able
to be edited. So we've updated the allow list to remove those, and add the one
required for the Stripe Connect flow.
This commit is contained in:
Fabien 'egg' O'Carroll 2022-05-18 13:27:50 +01:00 committed by GitHub
parent d90add9cd5
commit 09a516a179
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 63 additions and 6 deletions

View file

@ -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',

View file

@ -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",

View file

@ -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