0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00
ghost/core/server/api/canary/members-stripe-connect.js
Hannah Wolfe 45de9b0efc
Fixed filename casing in canary API
refs: 0ef5a5c97a

- As per the previous commit, our mixed filename casing inadvertently resulted in a bug
- The casing in the codebase is meant to be kebab-case always, so fixing this everywhere that's relevant to the API whilst there's a good reason
2022-03-24 17:25:53 +00:00

29 lines
952 B
JavaScript

const membersService = require('../../services/members');
module.exports = {
docName: 'members_stripe_connect',
auth: {
permissions: true,
options: [
'mode'
],
validation: {
options: {
mode: {
values: ['live', 'test']
}
}
},
query(frame) {
// This is something you have to do if you want to use the "framework" with access to the raw req/res
frame.response = async function (req, res) {
function setSessionProp(prop, val) {
req.session[prop] = val;
}
const mode = frame.options.mode || 'live';
const stripeConnectAuthURL = await membersService.stripeConnect.getStripeConnectOAuthUrl(setSessionProp, mode);
return res.redirect(stripeConnectAuthURL);
};
}
}
};