mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-04-08 02:52:39 -05:00
Updated members api and gateway to pass coupo
no-issue This will allow the auth pages and members sdk to pass coupons through to the api.
This commit is contained in:
parent
cdc3971ed8
commit
88368d0d94
2 changed files with 7 additions and 5 deletions
|
@ -118,7 +118,7 @@ module.exports = function MembersApi({
|
|||
}
|
||||
|
||||
/* subscriptions */
|
||||
apiRouter.post('/subscription', getData('adapter', 'plan', 'stripeToken'), ssoOriginCheck, (req, res) => {
|
||||
apiRouter.post('/subscription', getData('adapter', 'plan', 'stripeToken', 'coupon'), ssoOriginCheck, (req, res) => {
|
||||
const {signedin} = getCookie(req);
|
||||
if (!signedin) {
|
||||
res.writeHead(401, {
|
||||
|
@ -127,7 +127,7 @@ module.exports = function MembersApi({
|
|||
return res.end();
|
||||
}
|
||||
|
||||
const {plan, adapter, stripeToken} = req.data;
|
||||
const {plan, adapter, stripeToken, coupon} = req.data;
|
||||
|
||||
subscriptions.getAdapters()
|
||||
.then((adapters) => {
|
||||
|
@ -140,7 +140,8 @@ module.exports = function MembersApi({
|
|||
return subscriptions.createSubscription(member, {
|
||||
adapter,
|
||||
plan,
|
||||
stripeToken
|
||||
stripeToken,
|
||||
coupon
|
||||
});
|
||||
})
|
||||
.then(() => {
|
||||
|
|
|
@ -141,7 +141,7 @@
|
|||
|
||||
addMethod('getToken', getToken);
|
||||
|
||||
addMethod('createSubscription', function createSubscription({adapter, plan, stripeToken}) {
|
||||
addMethod('createSubscription', function createSubscription({adapter, plan, stripeToken, coupon}) {
|
||||
return fetch(`${membersApiUrl}subscription`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
|
@ -151,7 +151,8 @@
|
|||
origin,
|
||||
adapter,
|
||||
plan,
|
||||
stripeToken
|
||||
stripeToken,
|
||||
coupon
|
||||
})
|
||||
}).then((res) => {
|
||||
if (res.ok) {
|
||||
|
|
Loading…
Add table
Reference in a new issue