/// <summary>
        /// Call CommitCart to bLoyal
        /// </summary>
        /// <param name="ticketId"></param>
        /// <returns></returns>
        public async Task CommitCartAsync(int ticketId, Dinerware.Ticket ticket = null)
        {
            try
            {
                if (ticketId > 0 && TicketDictionary.CartDictionary != null && TicketDictionary.CartDictionary.ContainsKey(ticketId) && TicketDictionary.CartDictionary[ticketId] != Guid.Empty)
                {
                    IList <CartPayment> payments = new List <CartPayment>();

                    GetCartPayments(ticketId, ticket, payments);

                    var commitCommand = new CommitCartCommand {
                        CartUid = TicketDictionary.CartDictionary[ticketId], CartSourceExternalId = ticketId.ToString(), ReferenceNumber = ticketId.ToString(), Payments = payments
                    };

                    var cartCommitment = await _services.CommitAsync(commitCommand);

                    TicketDictionary.Dictionary.Remove(ticketId);
                    TicketDictionary.CartDictionary.Remove(ticketId);
                }
            }
            catch (Exception ex)
            {
                _logger.WriteLogError(ex, "CalculateTransaction CommitCartAsync");
            }
        }
 /// <summary>
 /// CommitAsync
 /// </summary>
 /// <param name="commitCommand"></param>
 /// <returns></returns>
 public async Task <CartCommitment> CommitAsync(CommitCartCommand commitCommand)
 {
     try
     {
         return(await service.CartResource.CommitAsync(commitCommand));
     }
     catch (ApiException ex)
     {
         apiException = new APIExceptions {
             ErrorCode = ex.Code, ErrorDescription = ex.Message, ErrorApi = "ApproveAsync"
         };
         return(null);
     }
     catch (Exception ex)
     {
         logger.WriteLogError("**** LoyaltyEngineServices FAILURE: CommitAsync Exception Error= " + ex.Message);
         if (ex.InnerException != null)
         {
             logger.WriteLogError("**** InnerException  = " + ex.InnerException.Message);
         }
         return(null);
     }
 }
 /// <summary>
 /// CommitAsync
 /// </summary>
 /// <param name="commitCommand"></param>
 /// <returns></returns>
 public async Task <CartCommitment> CommitAsync(CommitCartCommand commitCommand)
 {
     try
     {
         return(await _service.CartResource.CommitAsync(commitCommand));
     }
     catch (ApiException ex)
     {
         if (ex != null && !string.IsNullOrWhiteSpace(ex.Code) && ex.Code == "ServiceRedirect")
         {
             ServiceURLHelper.IsbLoyalServiceUrlDown = true;
             apiException = new APIExceptions {
                 ErrorCode = ex.Code, ErrorDescription = "A bLoyal error occurred. Please restart your Workstation and try again.", ErrorApi = "CommitAsync"
             };
         }
         _logger.WriteLogError(ex, "LoyaltyEngineServices CommitAsync");
         return(null);
     }
     catch (Exception ex)
     {
         _logger.WriteLogError(ex, "LoyaltyEngineServices CommitAsync");
         return(null);
     }
 }