mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-18 02:21:47 -05:00
Added method to to update customer email address
refs: https://github.com/TryGhost/Ghost/issues/12055 This will be used by the users module when updating a members email address to keep the Stripe Customer email in sync.
This commit is contained in:
parent
feaf73f7d2
commit
b189584f98
1 changed files with 19 additions and 0 deletions
|
@ -418,6 +418,25 @@ module.exports = class StripePaymentProcessor {
|
|||
await this._updateSubscription(subscription);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} customerId - The ID of the Stripe Customer to update
|
||||
* @param {string} email - The email to update
|
||||
*
|
||||
* @returns {Promise<null>}
|
||||
*/
|
||||
async updateStripeCustomerEmail(customerId, email) {
|
||||
try {
|
||||
await update(this._stripe, 'customers', customerId, {
|
||||
email
|
||||
});
|
||||
} catch (err) {
|
||||
this.logging.error(err, {
|
||||
message: 'Failed to update Stripe Customer email'
|
||||
});
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
async _updateCustomer(member, customer) {
|
||||
debug(`Attaching customer to member ${member.get('email')} ${customer.id}`);
|
||||
await this.storage.set({
|
||||
|
|
Loading…
Add table
Reference in a new issue