diff --git a/functions/routes/galaxpay/webhooks.js b/functions/routes/galaxpay/webhooks.js index 06a7183..8ea940e 100644 --- a/functions/routes/galaxpay/webhooks.js +++ b/functions/routes/galaxpay/webhooks.js @@ -169,9 +169,11 @@ exports.post = async ({ appSdk, admin }, req, res) => { ? plan.discount.type === 'percentage' || plan.discount.percentage : null let notes = `Parcela #${quantity} desconto de ${planPergentage ? '' : 'R$'}` - notes += ` ${plan.discount.value} ${planPergentage ? '%' : ''}` - notes += ` sobre ${plan.discount.apply_at}` - notes += ` referente à ${subscriptionLabel} ${periodicity}` + if (planPergentage) { + notes += ` ${plan?.discount?.value || ''} ${planPergentage ? '%' : ''}` + notes += ` sobre ${plan?.discount?.apply_at || ''}` + notes += ` referente à ${subscriptionLabel} ${periodicity}` + } body = { opened_at: new Date().toISOString(),