mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
Added subscription.price.tier mapping (#14849)
refs https://ghost.slack.com/archives/C02G9E68C/p1652781104970769 refs https://github.com/TryGhost/Team/issues/1145 - subscription.price.product was not mapped yet, but already used in the admin app. - removes products property from members
This commit is contained in:
parent
e258e32f04
commit
8b973dcfaa
5 changed files with 83 additions and 126 deletions
|
@ -127,10 +127,26 @@ function serializeMember(member, options) {
|
|||
};
|
||||
|
||||
if (json.products) {
|
||||
serialized.products = json.products;
|
||||
serialized.tiers = json.products;
|
||||
}
|
||||
|
||||
// Rename subscriptions.price.product to subscriptions.price.tier
|
||||
for (const subscription of serialized.subscriptions) {
|
||||
if (!subscription.price) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!subscription.price.tier && subscription.price.product) {
|
||||
subscription.price.tier = subscription.price.product;
|
||||
|
||||
if (!subscription.price.tier.tier_id) {
|
||||
subscription.price.tier.tier_id = subscription.price.tier.product_id;
|
||||
}
|
||||
delete subscription.price.tier.product_id;
|
||||
}
|
||||
delete subscription.price.product;
|
||||
}
|
||||
|
||||
if (labsService.isSet('multipleNewsletters')) {
|
||||
if (json.newsletters) {
|
||||
serialized.newsletters = json.newsletters
|
||||
|
|
|
@ -281,7 +281,7 @@ exports[`Members API - With Newsletters - compat mode Can fetch members who are
|
|||
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": "2062",
|
||||
"content-length": "2056",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
|
@ -436,7 +436,7 @@ exports[`Members API - With Newsletters - compat mode Can fetch members who are
|
|||
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": "11493",
|
||||
"content-length": "11475",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
|
@ -507,7 +507,7 @@ exports[`Members API - With Newsletters Can fetch members who are NOT subscribed
|
|||
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": "2062",
|
||||
"content-length": "2056",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
|
@ -662,7 +662,7 @@ exports[`Members API - With Newsletters Can fetch members who are subscribed 2:
|
|||
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": "11493",
|
||||
"content-length": "11475",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
|
|
|
@ -48,7 +48,6 @@ Object {
|
|||
"name": "test",
|
||||
"newsletters": Any<Array>,
|
||||
"note": "test note",
|
||||
"products": Array [],
|
||||
"status": "free",
|
||||
"subscribed": false,
|
||||
"subscriptions": Any<Array>,
|
||||
|
@ -64,7 +63,7 @@ exports[`Members API Can add 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": "636",
|
||||
"content-length": "622",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
"location": StringMatching /https\\?:\\\\/\\\\/\\.\\*\\?\\\\/members\\\\/\\[a-f0-9\\]\\{24\\}\\\\//,
|
||||
|
@ -91,7 +90,6 @@ Object {
|
|||
"name": "Send Me Confirmation",
|
||||
"newsletters": Array [],
|
||||
"note": null,
|
||||
"products": Array [],
|
||||
"status": "free",
|
||||
"subscribed": false,
|
||||
"subscriptions": Array [],
|
||||
|
@ -107,7 +105,7 @@ exports[`Members API Can add a member that is not subscribed (old) 2: [headers]
|
|||
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": "512",
|
||||
"content-length": "498",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
"location": Any<String>,
|
||||
|
@ -134,7 +132,6 @@ Object {
|
|||
"name": "Mr Egg",
|
||||
"newsletters": Any<Array>,
|
||||
"note": null,
|
||||
"products": Array [],
|
||||
"status": "paid",
|
||||
"subscribed": true,
|
||||
"subscriptions": Array [
|
||||
|
@ -164,10 +161,10 @@ Object {
|
|||
"interval": "month",
|
||||
"nickname": "Monthly",
|
||||
"price_id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
|
||||
"product": Object {
|
||||
"tier": Object {
|
||||
"id": "109c85c734fb9992e7bc30a26af66c22f5c94d8dc62e0a33cb797be902c06b2d",
|
||||
"name": "Default Product",
|
||||
"product_id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
|
||||
"tier_id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
|
||||
},
|
||||
"type": "recurring",
|
||||
},
|
||||
|
@ -187,7 +184,7 @@ exports[`Members API Can add a subscription 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": "2117",
|
||||
"content-length": "2097",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
|
@ -213,7 +210,6 @@ Object {
|
|||
"name": "Mr Egg",
|
||||
"newsletters": Any<Array>,
|
||||
"note": null,
|
||||
"products": Array [],
|
||||
"status": "paid",
|
||||
"subscribed": true,
|
||||
"subscriptions": Array [
|
||||
|
@ -243,10 +239,10 @@ Object {
|
|||
"interval": "month",
|
||||
"nickname": "Monthly",
|
||||
"price_id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
|
||||
"product": Object {
|
||||
"tier": Object {
|
||||
"id": "109c85c734fb9992e7bc30a26af66c22f5c94d8dc62e0a33cb797be902c06b2d",
|
||||
"name": "Default Product",
|
||||
"product_id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
|
||||
"tier_id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
|
||||
},
|
||||
"type": "recurring",
|
||||
},
|
||||
|
@ -266,7 +262,7 @@ exports[`Members API Can add a subscription 4: [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": "2117",
|
||||
"content-length": "2097",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
|
@ -319,7 +315,6 @@ Object {
|
|||
},
|
||||
],
|
||||
"note": "test note",
|
||||
"products": Array [],
|
||||
"status": "free",
|
||||
"subscribed": true,
|
||||
"subscriptions": Any<Array>,
|
||||
|
@ -335,7 +330,7 @@ exports[`Members API Can add and edit with custom newsletters 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": "1356",
|
||||
"content-length": "1342",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
"location": StringMatching /https\\?:\\\\/\\\\/\\.\\*\\?\\\\/members\\\\/\\[a-f0-9\\]\\{24\\}\\\\//,
|
||||
|
@ -389,7 +384,6 @@ Object {
|
|||
},
|
||||
],
|
||||
"note": "test note",
|
||||
"products": Array [],
|
||||
"status": "free",
|
||||
"subscribed": true,
|
||||
"subscriptions": Any<Array>,
|
||||
|
@ -405,7 +399,7 @@ exports[`Members API Can add and edit with custom newsletters 4: [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": "1355",
|
||||
"content-length": "1341",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
|
@ -484,7 +478,6 @@ Object {
|
|||
},
|
||||
],
|
||||
"note": null,
|
||||
"products": Array [],
|
||||
"status": "free",
|
||||
"subscribed": true,
|
||||
"subscriptions": Array [],
|
||||
|
@ -500,7 +493,7 @@ exports[`Members API Can add and send a signup confirmation email (old) 2: [head
|
|||
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": "1851",
|
||||
"content-length": "1837",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
"location": Any<String>,
|
||||
|
@ -590,7 +583,6 @@ Object {
|
|||
},
|
||||
],
|
||||
"note": null,
|
||||
"products": Array [],
|
||||
"status": "free",
|
||||
"subscribed": true,
|
||||
"subscriptions": Array [],
|
||||
|
@ -606,7 +598,7 @@ exports[`Members API Can add and send a signup confirmation email 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": "1846",
|
||||
"content-length": "1832",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
"location": Any<String>,
|
||||
|
@ -643,7 +635,6 @@ Object {
|
|||
"name": "Name",
|
||||
"newsletters": Any<Array>,
|
||||
"note": null,
|
||||
"products": Array [],
|
||||
"status": "free",
|
||||
"subscribed": true,
|
||||
"subscriptions": Any<Array>,
|
||||
|
@ -659,7 +650,7 @@ exports[`Members API Can add complimentary subscription (out of date) 2: [header
|
|||
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": "1114",
|
||||
"content-length": "1100",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
"location": StringMatching /https\\?:\\\\/\\\\/\\.\\*\\?\\\\/members\\\\/\\[a-f0-9\\]\\{24\\}\\\\//,
|
||||
|
@ -686,7 +677,6 @@ Object {
|
|||
"name": "Name",
|
||||
"newsletters": Any<Array>,
|
||||
"note": null,
|
||||
"products": Array [],
|
||||
"status": "free",
|
||||
"subscribed": true,
|
||||
"subscriptions": Any<Array>,
|
||||
|
@ -702,7 +692,7 @@ exports[`Members API Can add complimentary subscription (out of date) 4: [header
|
|||
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": "1114",
|
||||
"content-length": "1100",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
|
@ -899,7 +889,7 @@ exports[`Members API Can browse 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": "13454",
|
||||
"content-length": "13430",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
|
@ -1052,7 +1042,6 @@ Object {
|
|||
},
|
||||
],
|
||||
"note": null,
|
||||
"products": Any<Array>,
|
||||
"status": "comped",
|
||||
"subscribed": true,
|
||||
"subscriptions": Any<Array>,
|
||||
|
@ -1068,7 +1057,7 @@ exports[`Members API Can create a member with an existing complimentary subscrip
|
|||
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": "2802",
|
||||
"content-length": "2424",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
"location": StringMatching /https\\?:\\\\/\\\\/\\.\\*\\?\\\\/members\\\\/\\[a-f0-9\\]\\{24\\}\\\\//,
|
||||
|
@ -1122,7 +1111,6 @@ Object {
|
|||
},
|
||||
],
|
||||
"note": null,
|
||||
"products": Any<Array>,
|
||||
"status": "paid",
|
||||
"subscribed": true,
|
||||
"subscriptions": Any<Array>,
|
||||
|
@ -1138,7 +1126,7 @@ exports[`Members API Can create a member with an existing paid subscription 2: [
|
|||
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": "2877",
|
||||
"content-length": "2499",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
"location": StringMatching /https\\?:\\\\/\\\\/\\.\\*\\?\\\\/members\\\\/\\[a-f0-9\\]\\{24\\}\\\\//,
|
||||
|
@ -1192,22 +1180,6 @@ Object {
|
|||
},
|
||||
],
|
||||
"note": null,
|
||||
"products": Array [
|
||||
Object {
|
||||
"active": true,
|
||||
"created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"description": null,
|
||||
"id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
|
||||
"monthly_price_id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
|
||||
"name": "Default Product",
|
||||
"slug": "default-product",
|
||||
"type": "paid",
|
||||
"updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/,
|
||||
"visibility": "public",
|
||||
"welcome_page_url": "/welcome-paid",
|
||||
"yearly_price_id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
|
||||
},
|
||||
],
|
||||
"status": "comped",
|
||||
"subscribed": true,
|
||||
"subscriptions": Any<Array>,
|
||||
|
@ -1238,7 +1210,7 @@ exports[`Members API Can create a new member with a product (complementary) 2: [
|
|||
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": "2758",
|
||||
"content-length": "2380",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
"location": StringMatching /https\\?:\\\\/\\\\/\\.\\*\\?\\\\/members\\\\/\\[a-f0-9\\]\\{24\\}\\\\//,
|
||||
|
@ -1275,7 +1247,6 @@ Object {
|
|||
"name": "test",
|
||||
"newsletters": Any<Array>,
|
||||
"note": null,
|
||||
"products": Array [],
|
||||
"status": "free",
|
||||
"subscribed": true,
|
||||
"subscriptions": Any<Array>,
|
||||
|
@ -1291,7 +1262,7 @@ exports[`Members API Can destroy 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": "1821",
|
||||
"content-length": "1807",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
"location": StringMatching /https\\?:\\\\/\\\\/\\.\\*\\?\\\\/members\\\\/\\[a-f0-9\\]\\{24\\}\\\\//,
|
||||
|
@ -1358,7 +1329,6 @@ Object {
|
|||
"name": "change me",
|
||||
"newsletters": Any<Array>,
|
||||
"note": "initial note",
|
||||
"products": Array [],
|
||||
"status": "free",
|
||||
"subscribed": true,
|
||||
"subscriptions": Any<Array>,
|
||||
|
@ -1374,7 +1344,7 @@ exports[`Members API Can edit by id 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": "1132",
|
||||
"content-length": "1118",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
"location": StringMatching /https\\?:\\\\/\\\\/\\.\\*\\?\\\\/members\\\\/\\[a-f0-9\\]\\{24\\}\\\\//,
|
||||
|
@ -1401,7 +1371,6 @@ Object {
|
|||
"name": "changed",
|
||||
"newsletters": Any<Array>,
|
||||
"note": "edited note",
|
||||
"products": Array [],
|
||||
"status": "free",
|
||||
"subscribed": false,
|
||||
"subscriptions": Any<Array>,
|
||||
|
@ -1417,7 +1386,7 @@ exports[`Members API Can edit by id 4: [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": "487",
|
||||
"content-length": "473",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
|
@ -1604,7 +1573,7 @@ exports[`Members API Can filter by paid status 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": "9773",
|
||||
"content-length": "9749",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
|
@ -1717,7 +1686,7 @@ exports[`Members API Can filter on newsletter slug 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": "8540",
|
||||
"content-length": "8528",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
|
@ -1901,7 +1870,7 @@ exports[`Members API Can ignore any unknown includes 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": "9773",
|
||||
"content-length": "9749",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
|
@ -2321,7 +2290,6 @@ Object {
|
|||
"name": "Mr Egg",
|
||||
"newsletters": Any<Array>,
|
||||
"note": null,
|
||||
"products": Array [],
|
||||
"status": "free",
|
||||
"subscribed": true,
|
||||
"subscriptions": Any<Array>,
|
||||
|
@ -2337,7 +2305,7 @@ exports[`Members API Can read 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": "1316",
|
||||
"content-length": "1302",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
|
@ -2364,7 +2332,6 @@ Object {
|
|||
"name": "Mr Egg",
|
||||
"newsletters": Any<Array>,
|
||||
"note": null,
|
||||
"products": Array [],
|
||||
"status": "free",
|
||||
"subscribed": true,
|
||||
"subscriptions": Any<Array>,
|
||||
|
@ -2380,7 +2347,7 @@ exports[`Members API Can read and include email_recipients 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": "1338",
|
||||
"content-length": "1324",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
|
@ -2406,7 +2373,6 @@ Object {
|
|||
"name": "Mr Egg",
|
||||
"newsletters": Any<Array>,
|
||||
"note": null,
|
||||
"products": Array [],
|
||||
"status": "free",
|
||||
"subscribed": true,
|
||||
"subscriptions": Any<Array>,
|
||||
|
@ -2422,7 +2388,7 @@ exports[`Members API Can read and include tiers 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": "1316",
|
||||
"content-length": "1302",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
|
@ -2448,7 +2414,6 @@ Object {
|
|||
"name": "change me",
|
||||
"newsletters": Array [],
|
||||
"note": "initial note",
|
||||
"products": Array [],
|
||||
"status": "free",
|
||||
"subscribed": false,
|
||||
"subscriptions": Any<Array>,
|
||||
|
@ -2464,7 +2429,7 @@ exports[`Members API Can subscribe by setting (old) subscribed property to true
|
|||
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": "494",
|
||||
"content-length": "480",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
"location": StringMatching /https\\?:\\\\/\\\\/\\.\\*\\?\\\\/members\\\\/\\[a-f0-9\\]\\{24\\}\\\\//,
|
||||
|
@ -2544,7 +2509,6 @@ Object {
|
|||
},
|
||||
],
|
||||
"note": "initial note",
|
||||
"products": Array [],
|
||||
"status": "free",
|
||||
"subscribed": true,
|
||||
"subscriptions": Any<Array>,
|
||||
|
@ -2560,7 +2524,7 @@ exports[`Members API Can subscribe by setting (old) subscribed property to true
|
|||
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": "1835",
|
||||
"content-length": "1821",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
|
@ -2586,7 +2550,6 @@ Object {
|
|||
"name": "change me",
|
||||
"newsletters": Any<Array>,
|
||||
"note": null,
|
||||
"products": Array [],
|
||||
"status": "free",
|
||||
"subscribed": true,
|
||||
"subscriptions": Any<Array>,
|
||||
|
@ -2602,7 +2565,7 @@ exports[`Members API Can subscribe to a newsletter 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": "1122",
|
||||
"content-length": "1108",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
"location": StringMatching /https\\?:\\\\/\\\\/\\.\\*\\?\\\\/members\\\\/\\[a-f0-9\\]\\{24\\}\\\\//,
|
||||
|
@ -2629,7 +2592,6 @@ Object {
|
|||
"name": "change me",
|
||||
"newsletters": Any<Array>,
|
||||
"note": null,
|
||||
"products": Array [],
|
||||
"status": "free",
|
||||
"subscribed": true,
|
||||
"subscriptions": Any<Array>,
|
||||
|
@ -2645,7 +2607,7 @@ exports[`Members API Can subscribe to a newsletter 4: [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": "1178",
|
||||
"content-length": "1164",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
|
@ -2840,7 +2802,6 @@ Object {
|
|||
},
|
||||
],
|
||||
"note": "initial note",
|
||||
"products": Array [],
|
||||
"status": "free",
|
||||
"subscribed": true,
|
||||
"subscriptions": Any<Array>,
|
||||
|
@ -2856,7 +2817,7 @@ exports[`Members API Can unsubscribe by setting (old) subscribed property to fal
|
|||
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": "1140",
|
||||
"content-length": "1126",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
"location": StringMatching /https\\?:\\\\/\\\\/\\.\\*\\?\\\\/members\\\\/\\[a-f0-9\\]\\{24\\}\\\\//,
|
||||
|
@ -2883,7 +2844,6 @@ Object {
|
|||
"name": "change me",
|
||||
"newsletters": Array [],
|
||||
"note": "initial note",
|
||||
"products": Array [],
|
||||
"status": "free",
|
||||
"subscribed": false,
|
||||
"subscriptions": Any<Array>,
|
||||
|
@ -2899,7 +2859,7 @@ exports[`Members API Can unsubscribe by setting (old) subscribed property to fal
|
|||
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": "499",
|
||||
"content-length": "485",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
|
@ -3167,7 +3127,7 @@ exports[`Members API Search for paid members retrieves member with email paid@te
|
|||
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": "2435",
|
||||
"content-length": "2429",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
|
@ -3193,7 +3153,6 @@ Object {
|
|||
"name": "create me",
|
||||
"newsletters": Any<Array>,
|
||||
"note": null,
|
||||
"products": Array [],
|
||||
"status": "free",
|
||||
"subscribed": true,
|
||||
"subscriptions": Any<Array>,
|
||||
|
@ -3209,7 +3168,7 @@ exports[`Members API Subscribes to default newsletters 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": "1822",
|
||||
"content-length": "1808",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
"location": StringMatching /https\\?:\\\\/\\\\/\\.\\*\\?\\\\/members\\\\/\\[a-f0-9\\]\\{24\\}\\\\//,
|
||||
|
|
|
@ -45,6 +45,17 @@ const newsletterSnapshot = {
|
|||
updated_at: anyISODateTime
|
||||
};
|
||||
|
||||
const subscriptionSnapshot = {
|
||||
start_date: anyString,
|
||||
current_period_end: anyString,
|
||||
price: {
|
||||
price_id: anyObjectId,
|
||||
tier: {
|
||||
tier_id: anyObjectId
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function buildMemberWithoutIncludesSnapshot(options) {
|
||||
return {
|
||||
id: anyObjectId,
|
||||
|
@ -608,7 +619,6 @@ describe('Members API', function () {
|
|||
|
||||
const updatedMember = body2.members[0];
|
||||
assert.equal(updatedMember.status, 'comped', 'A comped member should have the comped status');
|
||||
assert.equal(updatedMember.products.length, 1, 'The member should have one product');
|
||||
assert.equal(updatedMember.tiers.length, 1, 'The member should have one product');
|
||||
|
||||
await assertMemberEvents({
|
||||
|
@ -679,8 +689,7 @@ describe('Members API', function () {
|
|||
|
||||
const updatedMember = body2.members[0];
|
||||
assert.equal(updatedMember.status, 'free', 'The member should have the free status');
|
||||
assert.equal(updatedMember.products.length, 0, 'The member should have 0 products');
|
||||
assert.equal(updatedMember.tiers.length, 0, 'The member should have 0 products');
|
||||
assert.equal(updatedMember.tiers.length, 0, 'The member should have 0 tiers');
|
||||
|
||||
await assertMemberEvents({
|
||||
eventType: 'MemberStatusEvent',
|
||||
|
@ -742,13 +751,6 @@ describe('Members API', function () {
|
|||
updated_at: anyISODateTime,
|
||||
labels: anyArray,
|
||||
subscriptions: anyArray,
|
||||
products: new Array(1).fill({
|
||||
id: anyObjectId,
|
||||
monthly_price_id: anyObjectId,
|
||||
yearly_price_id: anyObjectId,
|
||||
created_at: anyISODateTime,
|
||||
updated_at: anyISODateTime
|
||||
}),
|
||||
tiers: new Array(1).fill({
|
||||
id: anyObjectId,
|
||||
monthly_price_id: anyObjectId,
|
||||
|
@ -870,7 +872,6 @@ describe('Members API', function () {
|
|||
updated_at: anyISODateTime,
|
||||
labels: anyArray,
|
||||
subscriptions: anyArray,
|
||||
products: anyArray,
|
||||
tiers: anyArray,
|
||||
newsletters: new Array(1).fill(newsletterSnapshot)
|
||||
})
|
||||
|
@ -999,7 +1000,6 @@ describe('Members API', function () {
|
|||
updated_at: anyISODateTime,
|
||||
labels: anyArray,
|
||||
subscriptions: anyArray,
|
||||
products: anyArray,
|
||||
tiers: anyArray,
|
||||
newsletters: new Array(1).fill(newsletterSnapshot)
|
||||
})
|
||||
|
@ -1073,7 +1073,7 @@ describe('Members API', function () {
|
|||
assert.equal(readBody.members.length, 1, 'The member was not found in read');
|
||||
const readMember = readBody.members[0];
|
||||
|
||||
// Note that we explicitly need to ask to include products while browsing
|
||||
// Note that we explicitly need to ask to include tiers while browsing
|
||||
const {body: browseBody} = await agent.get(`/members/?search=${memberWithPaidSubscription.email}&include=tiers`);
|
||||
assert.equal(browseBody.members.length, 1, 'The member was not found in browse');
|
||||
const browseMember = browseBody.members[0];
|
||||
|
@ -1167,7 +1167,7 @@ describe('Members API', function () {
|
|||
});
|
||||
});
|
||||
|
||||
// Internally a different error is thrown for newsletters/products changes
|
||||
// Internally a different error is thrown for newsletters/tiers changes
|
||||
it('Cannot edit a non-existing id with newsletters', async function () {
|
||||
const memberChanged = {
|
||||
name: 'changed',
|
||||
|
@ -1443,16 +1443,7 @@ describe('Members API', function () {
|
|||
created_at: anyISODateTime,
|
||||
updated_at: anyISODateTime,
|
||||
labels: anyArray,
|
||||
subscriptions: [{
|
||||
start_date: anyString,
|
||||
current_period_end: anyString,
|
||||
price: {
|
||||
price_id: anyObjectId,
|
||||
product: {
|
||||
product_id: anyObjectId
|
||||
}
|
||||
}
|
||||
}],
|
||||
subscriptions: [subscriptionSnapshot],
|
||||
newsletters: anyArray
|
||||
})
|
||||
})
|
||||
|
@ -1471,16 +1462,7 @@ describe('Members API', function () {
|
|||
created_at: anyISODateTime,
|
||||
updated_at: anyISODateTime,
|
||||
labels: anyArray,
|
||||
subscriptions: [{
|
||||
start_date: anyString,
|
||||
current_period_end: anyString,
|
||||
price: {
|
||||
price_id: anyObjectId,
|
||||
product: {
|
||||
product_id: anyObjectId
|
||||
}
|
||||
}
|
||||
}],
|
||||
subscriptions: [subscriptionSnapshot],
|
||||
newsletters: anyArray
|
||||
})
|
||||
})
|
||||
|
|
|
@ -242,7 +242,7 @@ describe('Members API', function () {
|
|||
// And all the subscriptions are setup correctly
|
||||
const initialMember = await createMemberFromStripe();
|
||||
assert.equal(initialMember.status, 'paid', 'The member initial status should be paid');
|
||||
assert.equal(initialMember.products.length, 1, 'The member should have one product');
|
||||
assert.equal(initialMember.tiers.length, 1, 'The member should have one tier');
|
||||
should(initialMember.subscriptions).match([
|
||||
{
|
||||
status: 'active'
|
||||
|
@ -277,7 +277,7 @@ describe('Members API', function () {
|
|||
assert.equal(body2.members.length, 1, 'The member does not exist');
|
||||
const updatedMember = body2.members[0];
|
||||
assert.equal(updatedMember.status, 'paid');
|
||||
assert.equal(updatedMember.products.length, 1, 'The member should have products');
|
||||
assert.equal(updatedMember.tiers.length, 1, 'The member should have tiers');
|
||||
should(updatedMember.subscriptions).match([
|
||||
{
|
||||
cancel_at_period_end: true
|
||||
|
@ -365,7 +365,7 @@ describe('Members API', function () {
|
|||
// And all the subscriptions are setup correctly
|
||||
const initialMember = await createMemberFromStripe();
|
||||
assert.equal(initialMember.status, 'paid', 'The member initial status should be paid');
|
||||
assert.equal(initialMember.products.length, 1, 'The member should have one product');
|
||||
assert.equal(initialMember.tiers.length, 1, 'The member should have one tier');
|
||||
should(initialMember.subscriptions).match([
|
||||
{
|
||||
status: 'active'
|
||||
|
@ -400,7 +400,7 @@ describe('Members API', function () {
|
|||
assert.equal(body2.members.length, 1, 'The member does not exist');
|
||||
const updatedMember = body2.members[0];
|
||||
assert.equal(updatedMember.status, 'paid');
|
||||
assert.equal(updatedMember.products.length, 1, 'The member should have products');
|
||||
assert.equal(updatedMember.tiers.length, 1, 'The member should have products');
|
||||
should(updatedMember.subscriptions).match([
|
||||
{
|
||||
cancel_at_period_end: true
|
||||
|
@ -491,7 +491,7 @@ describe('Members API', function () {
|
|||
// And all the subscriptions are setup correctly
|
||||
const initialMember = await createMemberFromStripe();
|
||||
assert.equal(initialMember.status, 'paid', 'The member initial status should be paid');
|
||||
assert.equal(initialMember.products.length, 1, 'The member should have one product');
|
||||
assert.equal(initialMember.tiers.length, 1, 'The member should have one tier');
|
||||
should(initialMember.subscriptions).match([
|
||||
{
|
||||
status: 'active'
|
||||
|
@ -537,7 +537,7 @@ describe('Members API', function () {
|
|||
assert.equal(body2.members.length, 1, 'The member does not exist');
|
||||
const updatedMember = body2.members[0];
|
||||
assert.equal(updatedMember.status, 'free');
|
||||
assert.equal(updatedMember.products.length, 0, 'The member should have no products');
|
||||
assert.equal(updatedMember.tiers.length, 0, 'The member should have no products');
|
||||
should(updatedMember.subscriptions).match([
|
||||
{
|
||||
status: 'canceled'
|
||||
|
@ -598,7 +598,7 @@ describe('Members API', function () {
|
|||
|
||||
const compedPayload = {
|
||||
id: canceledPaidMember.id,
|
||||
products: [
|
||||
tiers: [
|
||||
{
|
||||
id: product.id
|
||||
}
|
||||
|
@ -612,7 +612,7 @@ describe('Members API', function () {
|
|||
|
||||
const updatedMember = body.members[0];
|
||||
assert.equal(updatedMember.status, 'comped', 'A comped member should have the comped status');
|
||||
assert.equal(updatedMember.products.length, 1, 'The member should have one product');
|
||||
assert.equal(updatedMember.tiers.length, 1, 'The member should have one tier');
|
||||
should(updatedMember.subscriptions).match([
|
||||
{
|
||||
status: 'canceled'
|
||||
|
@ -711,7 +711,7 @@ describe('Members API', function () {
|
|||
// And all the subscriptions are setup correctly
|
||||
const initialMember = await createMemberFromStripe();
|
||||
assert.equal(initialMember.status, 'comped', 'The member initial status should be comped');
|
||||
assert.equal(initialMember.products.length, 1, 'The member should have one product');
|
||||
assert.equal(initialMember.tiers.length, 1, 'The member should have one tier');
|
||||
should(initialMember.subscriptions).match([
|
||||
{
|
||||
status: 'active'
|
||||
|
@ -746,7 +746,7 @@ describe('Members API', function () {
|
|||
assert.equal(body2.members.length, 1, 'The member does not exist');
|
||||
const updatedMember = body2.members[0];
|
||||
assert.equal(updatedMember.status, 'free');
|
||||
assert.equal(updatedMember.products.length, 0, 'The member should have no products');
|
||||
assert.equal(updatedMember.tiers.length, 0, 'The member should have no products');
|
||||
should(updatedMember.subscriptions).match([
|
||||
{
|
||||
status: 'canceled'
|
||||
|
@ -1243,7 +1243,7 @@ describe('Members API', function () {
|
|||
assert.equal(body2.members.length, 1, 'The member does not exist');
|
||||
const updatedMember = body2.members[0];
|
||||
assert.equal(updatedMember.status, 'free');
|
||||
assert.equal(updatedMember.products.length, 0, 'The member should have no products');
|
||||
assert.equal(updatedMember.tiers.length, 0, 'The member should have no products');
|
||||
should(updatedMember.subscriptions).match([
|
||||
{
|
||||
status: 'canceled',
|
||||
|
|
Loading…
Add table
Reference in a new issue