Rules \ Examples

Non-exhaustive list, but a good start!

Rule
Code

Check if customer is from a store (offline) or the MonLeclerc app.

return (!provider.provider || provider.provider == '' || provider.provider == 'Leclerc.Eshop.MonLeclerc');

Gives 1 chance to the TAS per Evolutel code and double them if the customer has a loyalty card.

const { evolutel } = await helper.countProof();
const tas = evolutel * (helper.hasCarteFid() ? 2 : 1);
return { game: 0, tas: tas };

Check if customer comes from an eligible shop (must add a list of shops in the operation).

return (pdvs.length > 0 && helper.get('shopid') && helper.isEligiblePDV());

Check if the order hasn't been played before.

const orderParticipations = await helper.uniqueParticipation({ "selection": [["item_uid"]], "participation_type": ["normal"] });
return orderParticipations.count == 0;

Check if the customer hasn't been played twice on the same day yet.

const totParticipations = await helper.uniqueParticipation({ "selection": [["user_uid", "source_type", "order_at"]], "participation_type": ["normal"] });
return totParticipations.count < 2;

Check customer's info (provider_data).

return (!!helper.get('mail') || !!helper.get('accountId'));

Check order's info (provider_data).

return (!!helper.get('shopid') && !!helper.get('cmd') && !!helper.get('date') && !!helper.get('basket')

Check if the customer has the right segment.

return (poke.segment && poke.segment == 'CIAM');

[TRADE] Check if the customer's ID is in the eligible list.

const isInTheList = await helper.isInBurnList(poke.user_uid);

Have fun! 🎉

Last updated