mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-27 18:52:14 +03:00
Made complimentary_plan & stripe_customer_id exclusive
no-issue When importing Members it is possible to have both the complimentary_plan and the stripe_customer_id columns set, this can result in unusual outcomes, for example when importing a customer with a zero-amount subscription, they would end up with two "comped" subscriptions, and there would be two "comped" prices in the database. As we are deprecating the use of "comped" in favour of creating a subscription with a specific price, we're updating the import to prefer `stripe_customer_id` column, only using the `complimentary_plan` column when it is the only of the two columns passed.
This commit is contained in:
parent
a6d8f408b3
commit
6a1d69c471
@ -136,16 +136,15 @@ module.exports = class MembersCSVImporter {
|
||||
member = await membersApi.members.create(row, options);
|
||||
}
|
||||
|
||||
if (row.complimentary_plan) {
|
||||
await membersApi.members.setComplimentarySubscription(member, options);
|
||||
}
|
||||
|
||||
if (row.stripe_customer_id) {
|
||||
await membersApi.members.linkStripeCustomer({
|
||||
customer_id: row.stripe_customer_id,
|
||||
member_id: member.id
|
||||
}, options);
|
||||
} else if (row.complimentary_plan) {
|
||||
await membersApi.members.setComplimentarySubscription(member, options);
|
||||
}
|
||||
|
||||
await trx.commit();
|
||||
return {
|
||||
...resultAccumulator,
|
||||
|
Loading…
Reference in New Issue
Block a user