microsoft / Dynamics365Commerce.Solutions

Repository for hosting the Dynamics 365 Commerce end to end sample solutions
Other
54 stars 26 forks source link

[PrePriceOverride stopped working] Issue #193

Open ahgamal-ms opened 12 months ago

ahgamal-ms commented 12 months ago

When upgrading the CPOS from version 10.0.32 to 10.0.35 the code in the PrePriceOverride stopped working. For certain items a price override should not be allowed, so a dialog was shown and the code was completed with:

return Promise.resolve({ canceled: true });

The code has not been changed since 2021. I tried to simplify always execute: return Promise.resolve({ canceled: true }); and nothing else but the code always showed the price change dialog. Show the code was simply:

import * as Triggers from "PosApi/Extend/Triggers/ProductTriggers";
import { ClientEntities } from "PosApi/Entities";
export default class PrePriceOverrideTrigger extends Triggers.PrePriceOverrideTrigger {
    public async execute(options: Triggers.IPrePriceOverrideTriggerOptions): Promise {
        return Promise.resolve({ canceled: true });
    }
}

We have tried below and that's help mitigate the issue Any background story on why this changed in version 10.0.35? Anything else we need to be aware of?

 return Promise.reject(new ClientEntities.ExtensionError("Not allow price overide"));
madyke commented 11 months ago

Hello @ahgamal-ms - thanks for reporting this. It looks like this was a regression that was introduced in 10.0.33. I have filed a bug for the payments team to fix this.

ahgamal-ms commented 8 months ago

Hi @madyke same has reported with PreProductSaleTrigger. the return Promise.reject(new ClientEntities.ExtensionError("")); is not working as expected and didn't prevent adding item to cart. i have adviced the customer to use return Promise.resolve({ canceled: true }); however they loss the error message dialog which require additional work on them.

So is there any reason why the Promise.reject stop working and if this a bug that would require a fix or if this is as designed ?

madyke commented 8 months ago

Hi @ahgamal-ms - I'm not aware of any changes that would affect this, so it sounds like a bug. Is the customer still on 10.0.35?