Example #1
0
        public string OrdersListPaymentMethods(List <OrderTransaction> transactions)
        {
            var found = false;
            var sb    = new StringBuilder();

            foreach (var t in transactions)
            {
                switch (t.Action)
                {
                case ActionType.OfflinePaymentRequest:
                    found = true;
                    sb.AppendFormat("{0:C} | {1}", t.Amount, t.RefNum1);
                    break;

                case ActionType.CreditCardInfo:
                    found = true;
                    sb.AppendFormat("{0:C} | Credit Card {1}", t.Amount, t.CreditCard.CardNumberLast4Digits);
                    break;

                case ActionType.GiftCardInfo:
                    found = true;
                    sb.AppendFormat("{0:C} | Gift Card", t.Amount);
                    break;

                case ActionType.PurchaseOrderInfo:
                    found = true;
                    sb.AppendFormat("{0:C} | PO #{1}", t.Amount, t.PurchaseOrderNumber);
                    break;

                case ActionType.RecurringSubscriptionInfo:
                    found = true;
                    sb.AppendFormat("Credit Card {0}", t.CreditCard.CardNumberLast4Digits);
                    break;

                default:
                    var paymentMethod = PaymentMethods.Find(t.MethodId);

                    if (paymentMethod != null)
                    {
                        found = true;
                        sb.AppendFormat("{0}", paymentMethod.MethodName);
                    }
                    break;
                }
            }

            if (found)
            {
                return(sb.ToString());
            }
            return("No Payment Methods Selected");
        }
        protected override string RenderView()
        {
            var action = "Index";

            if (!string.IsNullOrEmpty(Request.QueryString["action"]))
            {
                action = Request.QueryString["action"];
            }

            var methodId      = CurrentOrder.CustomProperties["MethodId"].Value;
            var paymentMethod = PaymentMethods.Find(methodId);
            var controller    = paymentMethod.MethodName + "Checkout";

            if (paymentMethod.MethodId == PaymentMethods.PaypalExpressId)
            {
                return(MvcRenderingEngine.Render(controller, action, (string)Settings["PayPalView"]));
            }

            return(MvcRenderingEngine.Render(controller, action));
        }
Example #3
0
        private string GetPaymentMethodName(OrderTransaction transaction)
        {
            switch (transaction.Action)
            {
            case ActionType.CashReceived:
            case ActionType.CashReturned:
                return(LocalizationUtils.GetQuickbooksExportString("PayMethCash"));

            case ActionType.CheckReceived:
            case ActionType.CheckReturned:
                return(LocalizationUtils.GetQuickbooksExportString("PayMethCheck"));

            case ActionType.CompanyAccountAccepted:
                return(LocalizationUtils.GetQuickbooksExportString("PayMethCompanyAccount"));

            case ActionType.PurchaseOrderAccepted:
                return(LocalizationUtils.GetQuickbooksExportString("PayMethPurchaseOrder"));

            case ActionType.CreditCardCapture:
            case ActionType.CreditCardCharge:
            case ActionType.CreditCardRefund:
                return(LocalizationUtils.GetQuickbooksExportString("PayMethCreditCard"));

            case ActionType.PayPalCapture:
            case ActionType.PayPalCharge:
            case ActionType.PayPalRefund:
                return(LocalizationUtils.GetQuickbooksExportString("PayMethPayPal"));

            case ActionType.ThirdPartyPayMethodCapture:
            case ActionType.ThirdPartyPayMethodCharge:
            case ActionType.ThirdPartyPayMethodRefund:
                var payMeth = PaymentMethods.Find(transaction.MethodId);
                return(LocalizationUtils.GetPaymentMethodFriendlyName(payMeth.MethodName));

            default:
                return(LocalizationUtils.GetQuickbooksExportString("PayMethUnknown"));
            }
        }
        public void LoadEditor(string methodId)
        {
            Visible = true;
            var method = PaymentMethods.Find(methodId);

            Editor = HccPartController.LoadPaymentMethodEditor(method.MethodName, Page) as HccPaymentMethodPart;

            if (Editor != null)
            {
                ulActions.Visible = !Editor.HasOwnButtons;

                Editor.ID       = "MethodEditor_" + method.MethodName;
                Editor.MethodId = method.MethodId;
                phEditor.Controls.Clear();
                phEditor.Controls.Add(Editor);
                Editor.EditingComplete += Editor_EditingComplete;
                Editor.LoadData();
            }
            else
            {
                msg.ShowError(Localization.GetString("PaymentEditorError"));
            }
        }
Example #5
0
        protected void dgList_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
            {
                var t = (OrderTransaction)e.Item.DataItem;
                if (t == null)
                {
                    return;
                }

                var litTimeStamp    = e.Item.FindControl("litTimeStamp") as Literal;
                var litOrderNumber  = e.Item.FindControl("litOrderNumber") as Literal;
                var litDescription  = e.Item.FindControl("litDescription") as Literal;
                var litAmount       = e.Item.FindControl("litAmount") as Literal;
                var litCustomerName = e.Item.FindControl("litCustomerName") as Literal;

                if (litTimeStamp != null)
                {
                    litTimeStamp.Text =
                        TimeZoneInfo.ConvertTimeFromUtc(t.TimeStampUtc, HccApp.CurrentStore.Settings.TimeZone)
                        .ToShortTimeString();
                }

                if (litOrderNumber != null)
                {
                    litOrderNumber.Text = t.OrderNumber;
                }

                if (litDescription != null)
                {
                    var paymentMethod = PaymentMethods.Find(t.MethodId);
                    var methodName    = paymentMethod != null ? paymentMethod.MethodName : string.Empty;
                    litDescription.Text = LocalizationUtils.GetActionType(t.Action, methodName);
                }

                if (litAmount != null)
                {
                    litAmount.Text = t.AmountAppliedToOrder.ToString("C");
                }

                if (litCustomerName != null)
                {
                    litCustomerName.Text = "<strong>" + t.TempCustomerName + "</strong><br /><span class=\"tiny\">" +
                                           t.TempCustomerEmail + "</span>";
                }
                TotalSub           += t.TempEstimatedItemPortion;
                TotalDiscounts     += t.TempEstimatedItemDiscount;
                TotalShip          += t.TempEstimatedShippingPortion;
                TotalShipDiscounts += t.TempEstimatedShippingDiscount;
                TotalTax           += t.TempEstimatedTaxPortion;
                TotalGrand         += t.AmountAppliedToOrder;
            }
            else
            {
                if (e.Item.ItemType == ListItemType.Footer)
                {
                    e.Item.Cells[1].Text = Localization.GetString("Totals");

                    e.Item.Cells[2].Text = string.Format("{0:C}", TotalSub);
                    e.Item.Cells[3].Text = string.Format("{0:C}", TotalDiscounts);
                    e.Item.Cells[4].Text = string.Format("{0:C}", TotalShip);
                    e.Item.Cells[5].Text = string.Format("{0:C}", TotalShipDiscounts);
                    e.Item.Cells[6].Text = string.Format("{0:C}", TotalTax);
                    e.Item.Cells[7].Text = string.Format("{0:C}", TotalGrand);
                }
            }
        }
        private void RenderTransaction(OrderTransaction t, StringBuilder sb, TimeZoneInfo timezone, bool showCardNumbers)
        {
            sb.Append("<div class=\"controlarea1");
            if (t.Voided)
            {
                sb.Append(" transactionvoided");
            }
            else
            {
                if (t.Success)
                {
                    sb.Append(" transactionsuccess");
                }
                else
                {
                    sb.Append(" transactionfailed");
                }
            }
            sb.Append("\"><div style=\"overflow:auto;width:100%;\">");

            if (t.Voided)
            {
                sb.Append("VOIDED<br />");
            }
            sb.Append(t.Amount.ToString("c") + " - ");

            var paymentMethod = PaymentMethods.Find(t.MethodId);
            var methodName    = paymentMethod != null ? paymentMethod.MethodName : string.Empty;
            var methodInfo    = LocalizationUtils.GetActionType(t.Action, methodName);

            sb.Append(methodInfo + "<br />");
            sb.Append(TimeZoneInfo.ConvertTimeFromUtc(t.TimeStampUtc, timezone) + "<br />");
            if (t.Success)
            {
                sb.Append("OK<br />");
            }
            else
            {
                sb.Append("FAILED<br />");
            }
            if (t.Action == ActionType.PurchaseOrderInfo || t.Action == ActionType.PurchaseOrderAccepted)
            {
                sb.Append("PO # " + t.PurchaseOrderNumber + "<br />");
            }
            if (t.Action == ActionType.CheckReceived || t.Action == ActionType.CheckReturned)
            {
                sb.Append("Check # " + t.CheckNumber + "<br />");
            }
            if (ActionTypeUtils.IsCreditCardTransaction(t.Action))
            {
                if (t.CreditCard.IsCardNumberValid())
                {
                    if (showCardNumbers)
                    {
                        sb.Append(t.CreditCard.CardTypeName + " " + t.CreditCard.CardNumber + "<br />");
                    }
                    else
                    {
                        sb.Append(t.CreditCard.CardTypeName + " xxxx-xxxx-xxxx-" + t.CreditCard.CardNumberLast4Digits +
                                  "<br />");
                    }
                    sb.Append("exp: " + t.CreditCard.ExpirationMonth + "/" + t.CreditCard.ExpirationYear + "<br />");
                }
                else
                {
                    sb.Append("Unknown or Invalid Card Number Entered" + "<br/>");
                }
            }
            if (ActionTypeUtils.IsGiftCardTransaction(t.Action))
            {
                sb.Append("Gift Card " + t.GiftCard.CardNumber + "<br />");
            }
            if (!string.IsNullOrEmpty(t.RefNum1))
            {
                sb.Append("Ref#: " + t.RefNum1 + "<br />");
            }
            if (!string.IsNullOrEmpty(t.RefNum2))
            {
                sb.Append("Ref2#: " + t.RefNum2 + "<br />");
            }
            if (!string.IsNullOrEmpty(t.RMABvin))
            {
                sb.Append("RMA: " + t.RMABvin + "<br />");
            }
            sb.Append(t.Messages);
            sb.Append("</div></div>");
        }
        public string OrdersListPaymentMethods(List <OrderTransaction> transactions)
        {
            var found = false;
            var sb    = new StringBuilder();

            foreach (var t in transactions)
            {
                var statusClass = (t.Success) ? " transaction-success" : " transaction-failure";
                switch (t.Action)
                {
                case ActionType.OfflinePaymentRequest:
                    found = true;
                    sb.AppendFormat("<span id=\"{2}\" class=\"hc-transaction-label offline-payment{3}\">{0:C} | {1}</span>", t.Amount, t.RefNum1, t.IdAsString, statusClass);
                    break;

                //case ActionType.CreditCardInfo:
                //    found = true;
                //    sb.AppendFormat("<span id=\"{2}\" class=\"hc-transaction-label credit-card-info{3}\">{0:C} | Credit Card {1}</span>", t.Amount, t.CreditCard.CardNumberLast4Digits, t.IdAsString, statusClass);
                //    break;
                case ActionType.CreditCardCapture:
                    found = true;
                    sb.AppendFormat("<span id=\"{2}\" class=\"hc-transaction-label credit-card-capture{3}\">{0:C} | Credit Card {1}</span>", t.Amount, t.CreditCard.CardNumberLast4Digits, t.IdAsString, statusClass);
                    break;

                case ActionType.CreditCardCharge:
                    found = true;
                    sb.AppendFormat("<span id=\"{2}\" class=\"hc-transaction-label credit-card-charge{3}\">{0:C} | Credit Card {1}</span>", t.Amount, t.CreditCard.CardNumberLast4Digits, t.IdAsString, statusClass);
                    break;

                case ActionType.CreditCardRefund:
                    found = true;
                    sb.AppendFormat("<span id=\"{2}\" class=\"hc-transaction-label credit-card-refund{3}\">{0:C} | Credit Card {1}</span>", t.Amount, t.CreditCard.CardNumberLast4Digits, t.IdAsString, statusClass);
                    break;

                case ActionType.CreditCardVoid:
                    found = true;
                    sb.AppendFormat("<span id=\"{2}\" class=\"hc-transaction-label credit-card-void{3}\">{0:C} | Credit Card {1}</span>", t.Amount, t.CreditCard.CardNumberLast4Digits, t.IdAsString, statusClass);
                    break;

                case ActionType.GiftCardInfo:
                    found = true;
                    sb.AppendFormat("<span id=\"{1}\" class=\"hc-transaction-label gift-card-info{2}\">{0:C} | Gift Card</span>", t.Amount, t.IdAsString, statusClass);
                    break;

                case ActionType.GiftCardCapture:
                    found = true;
                    sb.AppendFormat("<span id=\"{1}\" class=\"hc-transaction-label gift-card-capture{2}\">{0:C} | Gift Card</span>", t.Amount, t.IdAsString, statusClass);
                    break;

                case ActionType.GiftCardHold:
                    found = true;
                    sb.AppendFormat("<span id=\"{1}\" class=\"hc-transaction-label gift-card-hold{2}\">{0:C} | Gift Card</span>", t.Amount, t.IdAsString, statusClass);
                    break;

                case ActionType.PurchaseOrderInfo:
                    found = true;
                    sb.AppendFormat("<span id=\"{2}\" class=\"hc-transaction-label purchase-order{3}\">{0:C} | PO #{1}</span>", t.Amount, t.PurchaseOrderNumber, t.IdAsString, statusClass);
                    break;

                case ActionType.RecurringSubscriptionInfo:
                    found = true;
                    sb.AppendFormat("<span id=\"{1}\" class=\"hc-transaction-label credit-card-recurring{2}\">Credit Card {0}</span>", t.CreditCard.CardNumberLast4Digits, t.IdAsString, statusClass);
                    break;

                default:
                    var paymentMethod = PaymentMethods.Find(t.MethodId);

                    if (paymentMethod != null)
                    {
                        found = true;
                        sb.AppendFormat("<span id=\"{1}\" class=\"hc-transaction-label default{2}\">{0}</span>", paymentMethod.MethodName, t.IdAsString, statusClass);
                    }
                    break;
                }
            }

            if (found)
            {
                return(sb.ToString());
            }
            return("No Payment Methods Selected");
        }