fix: add optional chaining to reward program property access to prevent potential runtime errors
This commit is contained in:
parent
84288abab9
commit
a8f4095765
@ -48,7 +48,7 @@ patch(PosOrder.prototype, {
|
||||
const isDiscount = reward && reward.reward_type === "discount";
|
||||
const rewardProgram = reward && reward.program_id;
|
||||
// Skip lines for automatic discounts.
|
||||
if (isDiscount && rewardProgram.trigger === "auto") {
|
||||
if (isDiscount && rewardProgram?.trigger === "auto") {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -121,8 +121,8 @@ patch(PosOrder.prototype, {
|
||||
if (line.is_reward_line) {
|
||||
const reward = line.reward_id;
|
||||
if (
|
||||
program.id === reward.program_id.id ||
|
||||
["gift_card", "ewallet"].includes(reward.program_id.program_type)
|
||||
program.id === reward.program_id?.id ||
|
||||
["gift_card", "ewallet"].includes(reward.program_id?.program_type)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user