mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Ensured member is not linked to customer twice
no-issue Edge case but easy to solve - so we dun it
This commit is contained in:
parent
db42b35e9f
commit
6722d3bc8a
1 changed files with 4 additions and 0 deletions
|
@ -115,6 +115,10 @@ module.exports = class StripePaymentProcessor {
|
|||
|
||||
async addCustomerToMember(member, customer) {
|
||||
const metadata = await this.storage.get(member);
|
||||
// Do not add the customer if they are already linked
|
||||
if (metadata.some(data => data.customer_id === customer.id)) {
|
||||
return;
|
||||
}
|
||||
return this.storage.set(member, metadata.concat({
|
||||
customer_id: customer.id
|
||||
}));
|
||||
|
|
Loading…
Add table
Reference in a new issue