public TransactionInfo GetTransactionData(string refId)
        {
            ValidateCaller();
            var transactionInfo = new TransactionInfo();

            if (string.IsNullOrEmpty(refId))
            {
                LoggerHelper.Error("PagoSeguro.GetTransactionData called with empty Order Number");
                transactionInfo.RefID = "Invalid RefId";
                return(transactionInfo);
            }

            LoggerHelper.Info(string.Format(TransactionInitiated, refId));
            SerializedOrderHolder order = OrderProvider.GetPaymentGatewayOrder(refId);

            if (null != order && null != order.Order)
            {
                PaymentGatewayInvoker.LogMessage(PaymentGatewayLogEntryType.Request, refId, order.DistributorId,
                                                 "PagoSeguroPaymentGateway", PaymentGatewayRecordStatusType.Unknown,
                                                 string.Format(TransactionInitiated, refId));
                var totals = (order.Order as Order_V01).Pricing as OrderTotals_V01;
                if (null != totals)
                {
                    transactionInfo.Monto = Convert.ToDouble(totals.AmountDue);
                    transactionInfo.RefID = refId;
                }
                else
                {
                    LoggerHelper.Error(string.Format(InvalidOrMissingOrderData, refId));
                    transactionInfo.RefID = "Invalid Data for RefId";
                }
            }
            else
            {
                LoggerHelper.Error(string.Format(InvalidOrMissingOrderNumber, refId));
                transactionInfo.RefID = "Invalid RefId";
            }

            return(transactionInfo);
        }
        private void SubmitOrder(string orderNumber)
        {
            string           distributorId = string.Empty;
            string           locale        = string.Empty;
            string           error         = string.Empty;
            MyHLShoppingCart shoppingCart  = null;
            var holder   = new SerializedOrderHolder();
            var response = new PagoSeguroPaymentGatewayResponse();

            response.OrderNumber = orderNumber;
            response.IsApproved  = true;

            if (OrderProvider.deSerializeAndSubmitOrder(response, out error, out holder))
            {
                locale = holder.Locale;
                if (!String.IsNullOrEmpty(holder.Email))
                {
                    //DistributorProvider.LoadDistributor(holder.DistributorId, holder.Token);
                    shoppingCart = ShoppingCartProvider.GetBasicShoppingCartFromService(holder.ShoppingCartId,
                                                                                        holder.DistributorId, locale);
                    shoppingCart.EmailAddress = holder.Email;
                    shoppingCart.Totals       = (holder.Order as Order_V01).Pricing as OrderTotals_V01;
                    EmailHelper.SendEmail(shoppingCart, holder.Order as Order_V01);
                }
                if (null != shoppingCart)
                {
                    ShoppingCartProvider.UpdateInventory(shoppingCart, shoppingCart.CountryCode, shoppingCart.Locale,
                                                         true);
                    shoppingCart.CloseCart();
                }
            }
            else
            {
                PaymentGatewayInvoker.LogMessage(PaymentGatewayLogEntryType.Error, orderNumber, distributorId,
                                                 "PagoSeguroPaymentGateway", PaymentGatewayRecordStatusType.InError,
                                                 error);
            }
        }