2020-05-28 13:40:51 +03:00
|
|
|
const membersService = require('../../services/members');
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
docName: 'members_stripe_connect',
|
|
|
|
auth: {
|
|
|
|
permissions: true,
|
2020-06-10 14:23:04 +03:00
|
|
|
options: [
|
|
|
|
'mode'
|
|
|
|
],
|
|
|
|
validation: {
|
|
|
|
options: {
|
|
|
|
mode: {
|
|
|
|
values: ['live', 'test']
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2020-05-28 13:40:51 +03:00
|
|
|
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;
|
|
|
|
}
|
2020-06-10 14:23:04 +03:00
|
|
|
const mode = frame.options.mode || 'live';
|
|
|
|
const stripeConnectAuthURL = await membersService.stripeConnect.getStripeConnectOAuthUrl(setSessionProp, mode);
|
2020-05-28 13:40:51 +03:00
|
|
|
return res.redirect(stripeConnectAuthURL);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|