User Tools

Site Tools


en:redeeming_coupons

This is an old revision of the document!


Redeeming Coupons

When a coupon number is typed or a coupon QR Tag scanned, SambaPOS will find related coupon entity and assign it to the ticket. That will automatically create a gift order for the product associated with coupon. As ticket submitted we’ll mark coupon as Redeemed to prevent multiple uses of coupons.

We’ll also solve another security issue by updating coupon redeem status as In Ticket as soon as it scanned. So multiple scans will not generate multiple gift lines. In fact we can do the same thing by directly updating coupon status as redeemed but we want to allow operators to cancel a coupon scan before submitting it.

Finding Coupons

We need an action to find and assign coupons to ticket. Since coupons are entities we can use “Change Ticket Entity” action to assign a coupon to the ticket.

Can Create Ticket parameter is useful for Fast Food screens. If there is no active ticket displayed when this action is called it creates a new ticket. While using this action we’ll generally find entities by their name. We can use both Entity Search Value or Entity Name parameters but they have different effects. Searching by Entity Name will retrieve entity from cache so you won’t have latest changes on entity data. It is useful to load rarely changing entities like Tables. Since we always need updated entity data we’ll use Entity Search Value.

We’ll use number pad editor to type or scan coupon numbers. When we enter a number there Number Pad Value Entered Event executes so we can create a rule for that event to read which coupon is scanned.

We can read scanned numbers with “NumberpadValue” parameter but at first we should check if it is a valid coupon code. We’ll create two custom constraints to check if scanned number starts with CP prefix and length equals to 11 digits. Notice how we changed Execute If setting to Matches All to force rule to validate all constraints. Don’t forget adding default mapping before saving the rule.

Now when we scan a valid coupon number it should create a new ticket with Coupon number displayed on header.

On previous chapter we’ve created a Coupon numbered as CP8GS-DZC-38S. We’ll type it manually for testing if our rule works or not. Normally we’ll scan it from a barcode or QR Tag.

This is a Fast Food screen so there is no active ticket. Change Ticket Entity action should create a ticket before assigning coupon to the ticket. Now you can hit Enter.

New ticket created with Coupon Number displayed on header. That means our action and rule works fine.

Don’t worry if Coupon number not appeared on header. Because of an optimization to avoid unnecessary refreshes sometimes that happens. We can execute “Display Ticket” action to force itself to refresh but on next steps we’ll copy coupon number to order and remove it from ticket header. So it is not needed. If you want to see updated header just add an order and cancel it.

Close this ticket without adding any item in it. On next step we’ll create another action to add Free Coffee into Ticket when a coupon scanned.

en/redeeming_coupons.1379259385.txt.gz · Last modified: 2013/09/15 23:36 (external edit)