2022-11-01 17:48:43 +03:00
|
|
|
const querystring = require('querystring');
|
2022-06-01 17:53:05 +03:00
|
|
|
const {agentProvider, mockManager, fixtureManager, matchers} = require('../../utils/e2e-framework');
|
|
|
|
const nock = require('nock');
|
2022-08-18 18:38:42 +03:00
|
|
|
const should = require('should');
|
|
|
|
const models = require('../../../core/server/models');
|
|
|
|
const urlService = require('../../../core/server/services/url');
|
2022-06-01 17:53:05 +03:00
|
|
|
|
2023-03-10 14:53:35 +03:00
|
|
|
let membersAgent, adminAgent;
|
2022-06-01 17:53:05 +03:00
|
|
|
|
2022-08-18 18:38:42 +03:00
|
|
|
async function getPost(id) {
|
|
|
|
// eslint-disable-next-line dot-notation
|
|
|
|
return await models['Post'].where('id', id).fetch({require: true});
|
|
|
|
}
|
|
|
|
|
2022-06-01 17:53:05 +03:00
|
|
|
describe('Create Stripe Checkout Session', function () {
|
|
|
|
before(async function () {
|
|
|
|
const agents = await agentProvider.getAgentsForMembers();
|
|
|
|
membersAgent = agents.membersAgent;
|
|
|
|
adminAgent = agents.adminAgent;
|
|
|
|
|
2022-08-18 18:38:42 +03:00
|
|
|
await fixtureManager.init('posts', 'members');
|
2022-06-01 17:53:05 +03:00
|
|
|
await adminAgent.loginAsOwner();
|
|
|
|
});
|
|
|
|
|
|
|
|
beforeEach(function () {
|
|
|
|
mockManager.mockMail();
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(function () {
|
|
|
|
mockManager.restore();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('Does not allow to create a checkout session if the customerEmail is associated with a paid member', async function () {
|
|
|
|
const {body: {tiers}} = await adminAgent.get('/tiers/?include=monthly_price&yearly_price');
|
|
|
|
|
|
|
|
const paidTier = tiers.find(tier => tier.type === 'paid');
|
|
|
|
|
|
|
|
await membersAgent.post('/api/create-stripe-checkout-session/')
|
|
|
|
.body({
|
|
|
|
customerEmail: 'paid@test.com',
|
|
|
|
tierId: paidTier.id,
|
|
|
|
cadence: 'month'
|
|
|
|
})
|
|
|
|
.expectStatus(403)
|
|
|
|
.matchBodySnapshot({
|
|
|
|
errors: [{
|
|
|
|
id: matchers.anyUuid,
|
|
|
|
code: 'CANNOT_CHECKOUT_WITH_EXISTING_SUBSCRIPTION'
|
|
|
|
}]
|
|
|
|
})
|
|
|
|
.matchHeaderSnapshot({
|
|
|
|
etag: matchers.anyEtag
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2022-11-01 17:47:49 +03:00
|
|
|
it('Can create a checkout session when using offers', async function () {
|
|
|
|
const {body: {tiers}} = await adminAgent.get('/tiers/?include=monthly_price&yearly_price');
|
|
|
|
const paidTier = tiers.find(tier => tier.type === 'paid');
|
|
|
|
const {body: {offers: [offer]}} = await adminAgent.post('/offers/').body({
|
|
|
|
offers: [{
|
|
|
|
name: 'Test Offer',
|
|
|
|
code: 'test-offer',
|
|
|
|
cadence: 'month',
|
|
|
|
status: 'active',
|
|
|
|
currency: 'usd',
|
|
|
|
type: 'percent',
|
|
|
|
amount: 20,
|
|
|
|
duration: 'once',
|
|
|
|
duration_in_months: null,
|
|
|
|
display_title: 'Test Offer',
|
|
|
|
display_description: null,
|
|
|
|
tier: {
|
|
|
|
id: paidTier.id
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
});
|
|
|
|
|
|
|
|
nock('https://api.stripe.com')
|
|
|
|
.persist()
|
|
|
|
.get(/v1\/.*/)
|
2023-03-10 14:53:35 +03:00
|
|
|
.reply((uri) => {
|
2022-11-01 17:47:49 +03:00
|
|
|
const [match, resource, id] = uri.match(/\/v1\/(\w+)\/(.+)\/?/) || [null];
|
|
|
|
if (match) {
|
|
|
|
if (resource === 'products') {
|
|
|
|
return [200, {
|
|
|
|
id: id,
|
|
|
|
active: true
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
if (resource === 'prices') {
|
|
|
|
return [200, {
|
|
|
|
id: id,
|
|
|
|
active: true,
|
|
|
|
currency: 'usd',
|
2022-11-08 08:37:13 +03:00
|
|
|
unit_amount: 500,
|
|
|
|
recurring: {
|
|
|
|
interval: 'month'
|
|
|
|
}
|
2022-11-01 17:47:49 +03:00
|
|
|
}];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return [500];
|
|
|
|
});
|
|
|
|
|
|
|
|
nock('https://api.stripe.com')
|
|
|
|
.persist()
|
|
|
|
.post(/v1\/.*/)
|
2023-03-10 14:53:35 +03:00
|
|
|
.reply((uri) => {
|
2022-11-01 17:47:49 +03:00
|
|
|
if (uri === '/v1/checkout/sessions') {
|
|
|
|
return [200, {id: 'cs_123', url: 'https://site.com'}];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (uri === '/v1/coupons') {
|
2022-11-08 08:37:13 +03:00
|
|
|
return [200, {id: 'coupon_123'}];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (uri === '/v1/prices') {
|
|
|
|
return [200, {
|
|
|
|
id: 'price_1',
|
|
|
|
active: true,
|
|
|
|
currency: 'usd',
|
|
|
|
unit_amount: 500,
|
|
|
|
recurring: {
|
|
|
|
interval: 'month'
|
|
|
|
}
|
|
|
|
}];
|
2022-11-01 17:47:49 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return [500];
|
|
|
|
});
|
|
|
|
|
|
|
|
await membersAgent.post('/api/create-stripe-checkout-session/')
|
|
|
|
.body({
|
|
|
|
customerEmail: 'free@test.com',
|
|
|
|
offerId: offer.id
|
|
|
|
})
|
|
|
|
.expectStatus(200)
|
|
|
|
.matchBodySnapshot()
|
|
|
|
.matchHeaderSnapshot();
|
|
|
|
});
|
|
|
|
|
2022-11-01 17:48:43 +03:00
|
|
|
it('Can create a checkout session without passing a customerEmail', async function () {
|
|
|
|
const {body: {tiers}} = await adminAgent.get('/tiers/?include=monthly_price&yearly_price');
|
|
|
|
|
|
|
|
const paidTier = tiers.find(tier => tier.type === 'paid');
|
|
|
|
|
|
|
|
nock('https://api.stripe.com')
|
|
|
|
.persist()
|
|
|
|
.get(/v1\/.*/)
|
2023-03-10 14:53:35 +03:00
|
|
|
.reply((uri) => {
|
2022-11-01 17:48:43 +03:00
|
|
|
const [match, resource, id] = uri.match(/\/v1\/(\w+)\/(.+)\/?/) || [null];
|
|
|
|
if (match) {
|
|
|
|
if (resource === 'products') {
|
|
|
|
return [200, {
|
|
|
|
id: id,
|
|
|
|
active: true
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
if (resource === 'prices') {
|
|
|
|
return [200, {
|
|
|
|
id: id,
|
|
|
|
active: true,
|
|
|
|
currency: 'usd',
|
2022-11-08 08:37:13 +03:00
|
|
|
unit_amount: 500,
|
|
|
|
recurring: {
|
|
|
|
interval: 'month'
|
|
|
|
}
|
2022-11-01 17:48:43 +03:00
|
|
|
}];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return [500];
|
|
|
|
});
|
|
|
|
|
|
|
|
nock('https://api.stripe.com')
|
|
|
|
.persist()
|
|
|
|
.post(/v1\/.*/)
|
|
|
|
.reply((uri, body) => {
|
|
|
|
if (uri === '/v1/checkout/sessions') {
|
|
|
|
const bodyJSON = querystring.parse(body);
|
|
|
|
// TODO: Actually work out what Stripe checks and when/how it errors
|
2022-11-01 22:18:30 +03:00
|
|
|
if (Reflect.has(bodyJSON, 'customerEmail')) {
|
2022-11-01 17:48:43 +03:00
|
|
|
return [400, {error: 'Invalid Email'}];
|
|
|
|
}
|
|
|
|
return [200, {id: 'cs_123', url: 'https://site.com'}];
|
|
|
|
}
|
|
|
|
|
2022-11-08 08:37:13 +03:00
|
|
|
if (uri === '/v1/prices') {
|
|
|
|
return [200, {
|
|
|
|
id: 'price_2',
|
|
|
|
active: true,
|
|
|
|
currency: 'usd',
|
|
|
|
unit_amount: 500,
|
|
|
|
recurring: {
|
|
|
|
interval: 'month'
|
|
|
|
}
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
|
2022-11-01 17:48:43 +03:00
|
|
|
return [500];
|
|
|
|
});
|
|
|
|
|
|
|
|
await membersAgent.post('/api/create-stripe-checkout-session/')
|
|
|
|
.body({
|
|
|
|
tierId: paidTier.id,
|
|
|
|
cadence: 'month'
|
|
|
|
})
|
|
|
|
.expectStatus(200)
|
|
|
|
.matchBodySnapshot()
|
|
|
|
.matchHeaderSnapshot();
|
|
|
|
});
|
2022-06-01 17:53:05 +03:00
|
|
|
it('Does allow to create a checkout session if the customerEmail is not associated with a paid member', async function () {
|
|
|
|
const {body: {tiers}} = await adminAgent.get('/tiers/?include=monthly_price&yearly_price');
|
|
|
|
|
|
|
|
const paidTier = tiers.find(tier => tier.type === 'paid');
|
|
|
|
|
2022-10-21 12:28:09 +03:00
|
|
|
nock('https://api.stripe.com')
|
|
|
|
.persist()
|
|
|
|
.get(/v1\/.*/)
|
2023-03-10 14:53:35 +03:00
|
|
|
.reply((uri) => {
|
2022-10-21 12:28:09 +03:00
|
|
|
const [match, resource, id] = uri.match(/\/v1\/(\w+)\/(.+)\/?/) || [null];
|
|
|
|
if (match) {
|
|
|
|
if (resource === 'products') {
|
|
|
|
return [200, {
|
|
|
|
id: id,
|
|
|
|
active: true
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
if (resource === 'prices') {
|
|
|
|
return [200, {
|
|
|
|
id: id,
|
|
|
|
active: true,
|
|
|
|
currency: 'usd',
|
2022-11-08 08:37:13 +03:00
|
|
|
unit_amount: 500,
|
|
|
|
recurring: {
|
|
|
|
interval: 'month'
|
|
|
|
}
|
2022-10-21 12:28:09 +03:00
|
|
|
}];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return [500];
|
|
|
|
});
|
|
|
|
|
2022-06-01 17:53:05 +03:00
|
|
|
nock('https://api.stripe.com')
|
|
|
|
.persist()
|
|
|
|
.post(/v1\/.*/)
|
2023-03-10 14:53:35 +03:00
|
|
|
.reply((uri) => {
|
2022-06-01 17:53:05 +03:00
|
|
|
if (uri === '/v1/checkout/sessions') {
|
2022-10-21 12:28:09 +03:00
|
|
|
return [200, {id: 'cs_123', url: 'https://site.com'}];
|
2022-06-01 17:53:05 +03:00
|
|
|
}
|
2022-11-08 08:37:13 +03:00
|
|
|
if (uri === '/v1/prices') {
|
|
|
|
return [200, {
|
|
|
|
id: 'price_3',
|
|
|
|
active: true,
|
|
|
|
currency: 'usd',
|
|
|
|
unit_amount: 500,
|
|
|
|
recurring: {
|
|
|
|
interval: 'month'
|
|
|
|
}
|
|
|
|
}];
|
|
|
|
}
|
2022-06-01 17:53:05 +03:00
|
|
|
|
|
|
|
return [500];
|
|
|
|
});
|
|
|
|
|
|
|
|
await membersAgent.post('/api/create-stripe-checkout-session/')
|
|
|
|
.body({
|
|
|
|
customerEmail: 'free@test.com',
|
|
|
|
tierId: paidTier.id,
|
|
|
|
cadence: 'month'
|
|
|
|
})
|
|
|
|
.expectStatus(200)
|
|
|
|
.matchBodySnapshot()
|
|
|
|
.matchHeaderSnapshot();
|
|
|
|
});
|
2022-08-18 18:38:42 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* When a checkout session is created with an urlHistory, we should convert it to an
|
|
|
|
* attribution and check if that is set in the metadata of the stripe session
|
|
|
|
*/
|
|
|
|
describe('Member attribution', function () {
|
|
|
|
it('Does pass url attribution source to session metadata', async function () {
|
|
|
|
const {body: {tiers}} = await adminAgent.get('/tiers/?include=monthly_price&yearly_price');
|
|
|
|
|
|
|
|
const paidTier = tiers.find(tier => tier.type === 'paid');
|
|
|
|
|
2022-10-21 12:28:09 +03:00
|
|
|
nock('https://api.stripe.com')
|
|
|
|
.persist()
|
|
|
|
.get(/v1\/.*/)
|
2023-03-10 14:53:35 +03:00
|
|
|
.reply((uri) => {
|
2022-10-21 12:28:09 +03:00
|
|
|
const [match, resource, id] = uri.match(/\/v1\/(\w+)\/(.+)\/?/) || [null];
|
|
|
|
if (match) {
|
|
|
|
if (resource === 'products') {
|
|
|
|
return [200, {
|
|
|
|
id: id,
|
|
|
|
active: true
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
if (resource === 'prices') {
|
|
|
|
return [200, {
|
|
|
|
id: id,
|
|
|
|
active: true,
|
|
|
|
currency: 'usd',
|
2022-11-08 08:37:13 +03:00
|
|
|
unit_amount: 500,
|
|
|
|
recurring: {
|
|
|
|
interval: 'month'
|
|
|
|
}
|
2022-10-21 12:28:09 +03:00
|
|
|
}];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return [500];
|
|
|
|
});
|
|
|
|
|
2022-08-18 18:38:42 +03:00
|
|
|
const scope = nock('https://api.stripe.com')
|
|
|
|
.persist()
|
|
|
|
.post(/v1\/.*/)
|
|
|
|
.reply((uri, body) => {
|
|
|
|
if (uri === '/v1/checkout/sessions') {
|
|
|
|
const parsed = new URLSearchParams(body);
|
|
|
|
should(parsed.get('metadata[attribution_url]')).eql('/test');
|
|
|
|
should(parsed.get('metadata[attribution_type]')).eql('url');
|
|
|
|
should(parsed.get('metadata[attribution_id]')).be.null();
|
2022-10-21 12:28:09 +03:00
|
|
|
|
|
|
|
return [200, {id: 'cs_123', url: 'https://site.com'}];
|
2022-08-18 18:38:42 +03:00
|
|
|
}
|
2022-11-08 08:37:13 +03:00
|
|
|
if (uri === '/v1/prices') {
|
|
|
|
return [200, {
|
|
|
|
id: 'price_4',
|
|
|
|
active: true,
|
|
|
|
currency: 'usd',
|
|
|
|
unit_amount: 500,
|
|
|
|
recurring: {
|
|
|
|
interval: 'month'
|
|
|
|
}
|
|
|
|
}];
|
|
|
|
}
|
2022-08-18 18:38:42 +03:00
|
|
|
|
2022-10-21 12:28:09 +03:00
|
|
|
return [500];
|
2022-08-18 18:38:42 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
await membersAgent.post('/api/create-stripe-checkout-session/')
|
|
|
|
.body({
|
|
|
|
customerEmail: 'attribution@test.com',
|
|
|
|
tierId: paidTier.id,
|
|
|
|
cadence: 'month',
|
|
|
|
metadata: {
|
|
|
|
urlHistory: [
|
|
|
|
{
|
|
|
|
path: '/test',
|
2022-08-25 19:21:41 +03:00
|
|
|
time: Date.now()
|
2022-08-18 18:38:42 +03:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.expectStatus(200)
|
|
|
|
.matchBodySnapshot()
|
|
|
|
.matchHeaderSnapshot();
|
|
|
|
|
|
|
|
should(scope.isDone()).eql(true);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('Does pass post attribution source to session metadata', async function () {
|
|
|
|
const post = await getPost(fixtureManager.get('posts', 0).id);
|
|
|
|
const url = urlService.getUrlByResourceId(post.id, {absolute: false});
|
|
|
|
|
|
|
|
const {body: {tiers}} = await adminAgent.get('/tiers/?include=monthly_price&yearly_price');
|
|
|
|
|
|
|
|
const paidTier = tiers.find(tier => tier.type === 'paid');
|
|
|
|
|
2022-10-21 12:28:09 +03:00
|
|
|
nock('https://api.stripe.com')
|
|
|
|
.persist()
|
|
|
|
.get(/v1\/.*/)
|
2023-03-10 14:53:35 +03:00
|
|
|
.reply((uri) => {
|
2022-10-21 12:28:09 +03:00
|
|
|
const [match, resource, id] = uri.match(/\/v1\/(\w+)\/(.+)\/?/) || [null];
|
|
|
|
if (match) {
|
|
|
|
if (resource === 'products') {
|
|
|
|
return [200, {
|
|
|
|
id: id,
|
|
|
|
active: true
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
if (resource === 'prices') {
|
|
|
|
return [200, {
|
|
|
|
id: id,
|
|
|
|
active: true,
|
|
|
|
currency: 'usd',
|
2022-11-08 08:37:13 +03:00
|
|
|
unit_amount: 50,
|
|
|
|
recurring: {
|
|
|
|
interval: 'month'
|
|
|
|
}
|
2022-10-21 12:28:09 +03:00
|
|
|
}];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return [500];
|
|
|
|
});
|
|
|
|
|
2022-08-18 18:38:42 +03:00
|
|
|
const scope = nock('https://api.stripe.com')
|
|
|
|
.persist()
|
|
|
|
.post(/v1\/.*/)
|
|
|
|
.reply((uri, body) => {
|
|
|
|
if (uri === '/v1/checkout/sessions') {
|
|
|
|
const parsed = new URLSearchParams(body);
|
|
|
|
should(parsed.get('metadata[attribution_url]')).eql(url);
|
|
|
|
should(parsed.get('metadata[attribution_type]')).eql('post');
|
|
|
|
should(parsed.get('metadata[attribution_id]')).eql(post.id);
|
2022-10-21 12:28:09 +03:00
|
|
|
|
|
|
|
return [200, {id: 'cs_123', url: 'https://site.com'}];
|
2022-08-18 18:38:42 +03:00
|
|
|
}
|
2022-11-08 08:37:13 +03:00
|
|
|
if (uri === '/v1/prices') {
|
|
|
|
return [200, {
|
|
|
|
id: 'price_5',
|
|
|
|
active: true,
|
|
|
|
currency: 'usd',
|
|
|
|
unit_amount: 500,
|
|
|
|
recurring: {
|
|
|
|
interval: 'month'
|
|
|
|
}
|
|
|
|
}];
|
|
|
|
}
|
2022-08-18 18:38:42 +03:00
|
|
|
|
2022-10-21 12:28:09 +03:00
|
|
|
return [500];
|
2022-08-18 18:38:42 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
await membersAgent.post('/api/create-stripe-checkout-session/')
|
|
|
|
.body({
|
|
|
|
customerEmail: 'attribution-post@test.com',
|
|
|
|
tierId: paidTier.id,
|
|
|
|
cadence: 'month',
|
|
|
|
metadata: {
|
|
|
|
urlHistory: [
|
|
|
|
{
|
|
|
|
path: url,
|
2022-08-25 19:21:41 +03:00
|
|
|
time: Date.now()
|
2022-08-18 18:38:42 +03:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.expectStatus(200)
|
|
|
|
.matchBodySnapshot()
|
|
|
|
.matchHeaderSnapshot();
|
|
|
|
|
|
|
|
should(scope.isDone()).eql(true);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('Ignores attribution_* values in metadata', async function () {
|
|
|
|
const {body: {tiers}} = await adminAgent.get('/tiers/?include=monthly_price&yearly_price');
|
|
|
|
|
|
|
|
const paidTier = tiers.find(tier => tier.type === 'paid');
|
|
|
|
|
2022-10-21 12:28:09 +03:00
|
|
|
nock('https://api.stripe.com')
|
|
|
|
.persist()
|
|
|
|
.get(/v1\/.*/)
|
2023-03-10 14:53:35 +03:00
|
|
|
.reply((uri) => {
|
2022-10-21 12:28:09 +03:00
|
|
|
const [match, resource, id] = uri.match(/\/v1\/(\w+)\/(.+)\/?/) || [null];
|
|
|
|
if (match) {
|
|
|
|
if (resource === 'products') {
|
|
|
|
return [200, {
|
|
|
|
id: id,
|
|
|
|
active: true
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
if (resource === 'prices') {
|
|
|
|
return [200, {
|
|
|
|
id: id,
|
|
|
|
active: true,
|
|
|
|
currency: 'usd',
|
2022-11-08 08:37:13 +03:00
|
|
|
unit_amount: 500,
|
|
|
|
recurring: {
|
|
|
|
interval: 'month'
|
|
|
|
}
|
2022-10-21 12:28:09 +03:00
|
|
|
}];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return [500];
|
|
|
|
});
|
|
|
|
|
2022-08-18 18:38:42 +03:00
|
|
|
const scope = nock('https://api.stripe.com')
|
|
|
|
.persist()
|
|
|
|
.post(/v1\/.*/)
|
|
|
|
.reply((uri, body) => {
|
|
|
|
if (uri === '/v1/checkout/sessions') {
|
|
|
|
const parsed = new URLSearchParams(body);
|
|
|
|
should(parsed.get('metadata[attribution_url]')).be.null();
|
|
|
|
should(parsed.get('metadata[attribution_type]')).be.null();
|
|
|
|
should(parsed.get('metadata[attribution_id]')).be.null();
|
2022-10-21 12:28:09 +03:00
|
|
|
|
|
|
|
return [200, {id: 'cs_123', url: 'https://site.com'}];
|
2022-08-18 18:38:42 +03:00
|
|
|
}
|
2022-11-08 08:37:13 +03:00
|
|
|
if (uri === '/v1/prices') {
|
|
|
|
return [200, {
|
|
|
|
id: 'price_6',
|
|
|
|
active: true,
|
|
|
|
currency: 'usd',
|
|
|
|
unit_amount: 500,
|
|
|
|
recurring: {
|
|
|
|
interval: 'month'
|
|
|
|
}
|
|
|
|
}];
|
|
|
|
}
|
2022-08-18 18:38:42 +03:00
|
|
|
|
2022-10-21 12:28:09 +03:00
|
|
|
return [500];
|
2022-08-18 18:38:42 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
await membersAgent.post('/api/create-stripe-checkout-session/')
|
|
|
|
.body({
|
|
|
|
customerEmail: 'attribution-2@test.com',
|
|
|
|
tierId: paidTier.id,
|
|
|
|
cadence: 'month',
|
|
|
|
metadata: {
|
|
|
|
attribution_type: 'url',
|
|
|
|
attribution_url: '/',
|
|
|
|
attribution_id: null
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.expectStatus(200)
|
|
|
|
.matchBodySnapshot()
|
|
|
|
.matchHeaderSnapshot();
|
|
|
|
|
|
|
|
should(scope.isDone()).eql(true);
|
|
|
|
});
|
|
|
|
});
|
2022-06-01 17:53:05 +03:00
|
|
|
});
|