diff --git a/lib/models/account.js b/lib/models/account.js index ba4abc58..beb38343 100644 --- a/lib/models/account.js +++ b/lib/models/account.js @@ -34,7 +34,7 @@ AND effective_end_date IS NULL AND pending=0`; const updatePaymentInfoSql = `UPDATE account_subscriptions -SET last4 = ?, exp_month = ?, exp_year = ?, card_type = ? +SET last4 = ?, stripe_payment_method_id=?, exp_month = ?, exp_year = ?, card_type = ? WHERE account_sid = ? AND effective_end_date IS NULL`; @@ -206,10 +206,10 @@ class Account extends Model { } static async updatePaymentInfo(logger, account_sid, pm) { - const {card} = pm; + const {id, card} = pm; const last4_encrypted = encrypt(card.last4); await promisePool.execute(updatePaymentInfoSql, - [last4_encrypted, card.exp_month, card.exp_year, card.brand, account_sid]); + [last4_encrypted, id, card.exp_month, card.exp_year, card.brand, account_sid]); } static async provisionPendingSubscription(logger, account_sid, products, payment_method, subscription_id) {