Example #1
0
        /// <summary>
        /// Returns all vouchers created by a merchant regardless of the their type
        /// </summary>
        /// <param name="merchantId">the id of the merchant that created the vouchers</param>
        /// <returns>a list of vouchers</returns>
        public async Task <IEnumerable <Voucher> > GetAllVouchers(string merchantId)
        {
            var vouchers = await _baseRepository.GetAllVouchersFilterByMerchantIdAsync(merchantId);

            foreach (var voucher in vouchers)
            {
                string decryptedCode = CodeGenerator.Decrypt(voucher.Code);
                voucher.Code = decryptedCode;
            }
            return(vouchers);
        }