Gift Certificates

In KonaKart, a Gift Certificate is a product of type gift certificate, that can be bought by a customer and delivered as a digital download, through eMail or even regular mail. The gift certificate contains a promotion code which is usable only once to obtain a discount on an order.

Behind the scenes, a gift certificate object needs to be related to a promotion which can only be activated through the use of a coupon code. When an order containing one or more gift certificates is paid for, a coupon code and document must be created for each gift certificate. For example, the document could be a stylish pdf file containing the coupon code which the customer can download. The generation of the actual document is a customization that needs to be carried out, since the example source code just generates a simple txt file containing only the coupon code.

com.konakart.bl.OrderIntegrationMgr and com.konakartadmin.bl.AdminOrderIntegrationMgr are the two files that contain the code that is run when an order changes state after payment is received. The application code is run when the state is changed through the application (i.e. when a customer pays using a credit card) and the admin app code is run when the state is changed through the admin app. The actual method to look at is called manageGiftCertificates() . As you can see from the source code, this method implements the following tasks:

Depending on your requirements, the method can be customized. For example, you may not wish the file to be made available as a digital download or you may wish to generate a more simple coupon code. An almost obligatory customization is the getGiftCertificateFilePath() method which at the moment produces a simple txt file just containing the coupon code. For production usage it should create maybe a pdf or html document that resembles a real gift certificate.