コード例 #1
0
        protected override async Task <ICommandResult> Handle(ConfirmOrderCommand command)
        {
            ConfirmOrderCommandResult confirmOrderResult = new ConfirmOrderCommandResult();
            var tiqetsTransaction = _tiqetsTransactionRepository.GetByTransactionId(command.TransactionId);

            if (!tiqetsTransaction.IsOrderConfirmed)
            {
                var confirmOrder = await ConfirmOrder(tiqetsTransaction);

                var responseJson = Mapper <ConfirmOrderResponseModel> .MapFromJson(confirmOrder);

                if (responseJson.success)
                {
                    var getTickets = await GetTickets(responseJson.order_reference_id);

                    if (getTickets.success)
                    {
                        tiqetsTransaction.IsOrderConfirmed = true;
                        tiqetsTransaction.TicketPdf        = getTickets.tickets_pdf_url;
                        tiqetsTransaction.PostPurchaseInfo = getTickets.post_purchase_info;
                        tiqetsTransaction.HowToUse         = getTickets.how_to_use_info;
                        switch (getTickets.order_status)
                        {
                        case "new":
                            tiqetsTransaction.OrderStatus = Convert.ToInt16(TiqetOrderStatus.New);
                            break;

                        case "pending":
                            tiqetsTransaction.OrderStatus = Convert.ToInt16(TiqetOrderStatus.Pending);
                            break;

                        case "failed":
                            tiqetsTransaction.OrderStatus = Convert.ToInt16(TiqetOrderStatus.Failed);
                            break;

                        case "done":
                            tiqetsTransaction.OrderStatus = Convert.ToInt16(TiqetOrderStatus.Done);
                            break;

                        default:
                            tiqetsTransaction.OrderStatus = Convert.ToInt16(TiqetOrderStatus.None);
                            break;
                        }
                        _tiqetsTransactionRepository.Save(tiqetsTransaction);
                        confirmOrderResult.Success       = true;
                        confirmOrderResult.TicketPdfLink = getTickets.tickets_pdf_url;
                    }
                }
                else
                {
                    confirmOrderResult.Success = false;
                }
            }
            else
            {
                confirmOrderResult.Success       = true;
                confirmOrderResult.TicketPdfLink = tiqetsTransaction.TicketPdf;
            }
            return(confirmOrderResult);
        }
コード例 #2
0
 protected override async Task Handle(SaveOrderCommand command)
 {
     try
     {
         var tiqetsTransactions = _tiqetsTransactionRepository.Save(new TiqetsTransaction
         {
             TransactionId            = command.TransactionId,
             OrderReferenceId         = command.OrderRefernceId,
             PaymentConfirmationToken = command.PaymentToken,
             IsOrderConfirmed         = false,
             IsEnabled  = true,
             ModifiedBy = command.ModifiedBy
         });
     }
     catch (Exception e)
     {
         _logger.Log(LogCategory.Error, new Exception("Failed to Disable Event HOHO Data", e));
     }
 }