diff --git a/lib/loyalty.js b/lib/loyalty.js index d4f9480d..9ac9e0b6 100644 --- a/lib/loyalty.js +++ b/lib/loyalty.js @@ -37,7 +37,7 @@ function getAvailableIndividualDiscounts () { }), res)) } -function getCustomerIndividualDiscounts (customerId) { +function getCustomerActiveIndividualDiscount (customerId) { const sql = `SELECT * FROM individual_discounts WHERE customer_id=$1 AND soft_deleted=false LIMIT 1` return db.oneOrNone(sql, [customerId]).then(res => { if (!_.isNil(res)) { @@ -68,7 +68,7 @@ module.exports = { deletePromoCode, getNumberOfAvailablePromoCodes, getAvailableIndividualDiscounts, - getCustomerIndividualDiscounts, + getCustomerActiveIndividualDiscount, createIndividualDiscount, deleteIndividualDiscount } diff --git a/lib/routes/phoneCodeRoutes.js b/lib/routes/phoneCodeRoutes.js index 4a4905bc..25fa3795 100644 --- a/lib/routes/phoneCodeRoutes.js +++ b/lib/routes/phoneCodeRoutes.js @@ -48,7 +48,7 @@ function addOrUpdateCustomer (req) { }) }) .then(customer => { - return loyalty.getCustomerIndividualDiscounts(customer.id) + return loyalty.getCustomerActiveIndividualDiscount(customer.id) .then(discount => ({ ...customer, discount })) }) }