mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-27 18:52:14 +03:00
Fixed creating stripe subscriptions for complimentary members in data generator
ref PROD-244
This commit is contained in:
parent
58d1412d9b
commit
e1ef7c44d8
@ -10,7 +10,7 @@ class MembersStripeCustomersImporter extends TableImporter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async import(quantity) {
|
async import(quantity) {
|
||||||
const members = await this.transaction.select('id', 'name', 'email', 'created_at').from('members');
|
const members = await this.transaction.select('id', 'name', 'email', 'created_at').from('members').where('status', 'paid');
|
||||||
|
|
||||||
await this.importForEach(members, quantity ? quantity / members.length : 1);
|
await this.importForEach(members, quantity ? quantity / members.length : 1);
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ class SubscriptionsImporter extends TableImporter {
|
|||||||
|
|
||||||
async import() {
|
async import() {
|
||||||
const membersProducts = await this.transaction.select('member_id', 'product_id').from('members_products');
|
const membersProducts = await this.transaction.select('member_id', 'product_id').from('members_products');
|
||||||
this.members = await this.transaction.select('id', 'status', 'created_at').from('members');
|
this.members = await this.transaction.select('id', 'status', 'created_at').from('members').where('status', 'paid');
|
||||||
this.stripeProducts = await this.transaction.select('product_id', 'stripe_product_id').from('stripe_products');
|
this.stripeProducts = await this.transaction.select('product_id', 'stripe_product_id').from('stripe_products');
|
||||||
this.stripePrices = await this.transaction.select('stripe_product_id', 'currency', 'amount', 'interval').from('stripe_prices');
|
this.stripePrices = await this.transaction.select('stripe_product_id', 'currency', 'amount', 'interval').from('stripe_prices');
|
||||||
await this.importForEach(membersProducts, 1);
|
await this.importForEach(membersProducts, 1);
|
||||||
@ -21,6 +21,9 @@ class SubscriptionsImporter extends TableImporter {
|
|||||||
|
|
||||||
generate() {
|
generate() {
|
||||||
const member = this.members.find(m => m.id === this.model.member_id);
|
const member = this.members.find(m => m.id === this.model.member_id);
|
||||||
|
if (!member) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const status = member.status;
|
const status = member.status;
|
||||||
const billingInfo = {};
|
const billingInfo = {};
|
||||||
const isMonthly = faker.datatype.boolean();
|
const isMonthly = faker.datatype.boolean();
|
||||||
|
Loading…
Reference in New Issue
Block a user