fix: add null checks for reward object in pos_order_patch to prevent runtime errors
This commit is contained in:
parent
25ef115aa4
commit
3b8a2d8f4b
@ -18,7 +18,7 @@ patch(PosOrder.prototype, {
|
||||
for (const rule of program.rule_ids) {
|
||||
for (const line of rewardLines) {
|
||||
const reward = line.reward_id;
|
||||
if (this._validForPointsCorrection(reward, line, rule)) {
|
||||
if (reward && this._validForPointsCorrection(reward, line, rule)) {
|
||||
if (rule.reward_point_mode === "money") {
|
||||
const priceToUse = rule.money_reward_point_mode === "before_tax"
|
||||
? line.prices.total_excluded
|
||||
@ -124,6 +124,7 @@ patch(PosOrder.prototype, {
|
||||
if (line.is_reward_line) {
|
||||
const reward = line.reward_id;
|
||||
if (
|
||||
!reward ||
|
||||
program.id === reward.program_id?.id ||
|
||||
["gift_card", "ewallet"].includes(reward.program_id?.program_type)
|
||||
) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user