Interface VoucherFacade
- All Known Implementing Classes:
DefaultCouponFacade,DefaultVoucherFacade
public interface VoucherFacade
Voucher facade interface. Manages applying vouchers to cart and releasing it.
-
Method Summary
Modifier and TypeMethodDescriptionvoidapplyVoucher(String voucherCode) Apply voucher to current session cartbooleancheckVoucherCode(String voucherCode) Check if voucher code is validgetVoucher(String voucherCode) Get voucher base on its codeGet vouchers applied for current session cartvoidreleaseVoucher(String voucherCode) Remove voucher from current session cart
-
Method Details
-
checkVoucherCode
Check if voucher code is valid- Parameters:
voucherCode- voucher code- Returns:
- true when voucher code is valid, false when voucher code is invalid
-
getVoucher
Get voucher base on its code- Parameters:
voucherCode- voucher identifier- Returns:
- the
VoucherData - Throws:
VoucherOperationException- if no voucher with the specified code is foundIllegalArgumentException- if parameter code isnullor empty
-
applyVoucher
Apply voucher to current session cart- Parameters:
voucherCode- voucher identifier- Throws:
VoucherOperationException- if voucher wasn't applied due to some problemsIllegalArgumentException- if parameter code isnullor empty
-
releaseVoucher
Remove voucher from current session cart- Parameters:
voucherCode- voucher identifier- Throws:
VoucherOperationException- if voucher wasn't released due to some problemsIllegalArgumentException- if parameter code isnullor empty
-
getVouchersForCart
List<VoucherData> getVouchersForCart()Get vouchers applied for current session cart- Returns:
- list of vouchers applied for current session cart
-