当前位置: 首页>>代码示例>>C#>>正文


C# PaymentType.ToString方法代码示例

本文整理汇总了C#中PaymentType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# PaymentType.ToString方法的具体用法?C# PaymentType.ToString怎么用?C# PaymentType.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PaymentType的用法示例。


在下文中一共展示了PaymentType.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddEditPaymentModal

        public AddEditPaymentModal(Model.Payment paymentToUpdate, PaymentType paymentType, PaymentControl paymentControl, Model.Bank bank)
		{
			this.InitializeComponent();

            _bank = bank;
            _paymentControl = paymentControl;
            _paymentType = paymentType;
            _paymentToUpdate = paymentToUpdate;
            _isUpdatePayment = _paymentToUpdate != null;

            FillBanks();
            AdjustWindowForPaymentType();

            if (_isUpdatePayment)
            {
                PrepareWindowForUpdates();
            }

            this.Title += " (" + paymentType.ToString() + ")";
        }
开发者ID:EnriqueRivera,项目名称:AgendaProject,代码行数:20,代码来源:AddEditPaymentModal.xaml.cs

示例2: takePayment

        public EzeResult takePayment(PaymentType type, double amount, PaymentOptions options)
        {
            EzeResult result = null;
            Console.WriteLine("...Take Payment <"+type.ToString()+",amount="+amount+","+">");
            TxnInput.Types.TxnType txnType = TxnInput.Types.TxnType.CARD_PRE_AUTH;

            switch(type)
            {
            case PaymentType.CARD:
            {
                txnType = TxnInput.Types.TxnType.CARD_AUTH;
                break;
            }
            case PaymentType.CASH:
            {
                txnType = TxnInput.Types.TxnType.CASH;
                break;
            }
            case PaymentType.CHEQUE:
            {
                txnType = TxnInput.Types.TxnType.CHEQUE;
                break;
            }
            default:
            {
                txnType = TxnInput.Types.TxnType.CARD_PRE_AUTH;
                break;
            }
            }

            if (amount <= 0) throw new EzeException("Amount is 0 or negative");
            if (txnType == TxnInput.Types.TxnType.CHEQUE)
            {
            if ((null == options) ||
                (null == options.getChequeNo()) || (options.getChequeNo().Length == 0) ||
                (null == options.getBankCode()) || (options.getBankCode().Length == 0) ||
                (null == options.getChequeDate()))
            {
                    throw new EzeException("Cheque details not passed for a Cheque transaction");
            }
            }

            TxnInput tInput = TxnInput.CreateBuilder()
                .SetTxnType(txnType)
                .SetAmount(amount)
                .Build();

            if (null != options) {
            if (null != options.getOrderId()) tInput = TxnInput.CreateBuilder(tInput).SetOrderId(options.getOrderId()).Build();
            if (null != options.getReceiptType()) tInput = TxnInput.CreateBuilder(tInput).SetReceiptType(options.getReceiptType()).Build();
            if (null != options.getChequeNo()) tInput = TxnInput.CreateBuilder(tInput).SetChequeNumber(options.getChequeNo()).Build();
            if (null != options.getBankCode()) tInput = TxnInput.CreateBuilder(tInput).SetBankCode(options.getBankCode()).Build();
            if (null != options.getChequeDate()) tInput = TxnInput.CreateBuilder(tInput).SetChequeDate(options.getChequeDate().ToString()).Build();
            }

            ApiInput apiInput = ApiInput.CreateBuilder()
                .SetMsgType(ApiInput.Types.MessageType.TXN)
                .SetMsgData(tInput.ToByteString()).Build();

            this.send(apiInput);

            while (true)
            {
            result = this.getResult(this.receive());

            if (result.getEventName() == EventName.TAKE_PAYMENT)
            {
                if (result.getStatus() == Status.SUCCESS) EzeEvent("Payment Successful", new EventArgs());
                else EzeEvent("Payment Failed", new EventArgs());
                break;
            }
            }
            return result;
        }
开发者ID:adonisk,项目名称:csapi,代码行数:74,代码来源:EzeAPI.cs

示例3: OnPaymentComplete

        public void OnPaymentComplete( PaymentType paymentType, PaymentStatusLevel paymentStatus, BillingInfo billingInfo, DeliveryInfo deliveryInfo, Order order)
        {
            if ( paymentType == PaymentType.CreditCard && paymentStatus == PaymentStatusLevel.WaitingForPayment)
            {
                // payment failed, we won't record it in db
                order.PaymentStatus = paymentStatus.ToString();

            }
            else
            {
                var cart = ShoppingCartHelper.GetCart(HttpContext);
                order.PaymentStatus = paymentStatus.ToString();
                order.TxnId = order.TxnId;
                order.OrderStatusId = (int)OrderStatusLevel.Processing;
                order.PaymentNote = paymentType.ToString() ;
                order.OrderReceivedAt = DateTime.Now;
                db.Orders.AddObject(order);
                db.SaveChanges();
                foreach (var cartItem in cart.ShoppingCartItems)
                {
                    order.OrderItems.Add(new OrderItem()
                    {
                        OrderId = order.OrderId,
                        ItemId = cartItem.ItemId,
                        ItemTypeId = cartItem.ItemTypeId,
                        LineItemCost = cartItem.LineItemCost,
                        Quantity = cartItem.Quantity
                    });
                }
                db.SaveChanges();

                // save payer details
                var payer = (MyLunchBoxMembershipUser)(new MyLunchBoxMembershipProvider().GetUser(User.Identity.Name, true));
                var userDetails = db.UserDetails.Single(i => i.UserId == order.UserId);
                userDetails.FirstName = order.ReceiverFirstName;
                userDetails.LastName = order.ReceiverLastName;
                userDetails.UniversityId = LocationHelper.GetSelectedUniversityId(HttpContext);
                userDetails.UniversityDeliveryId = LocationHelper.GetDeliveryLocationId(HttpContext);
                if (billingInfo != null)
                {
                    if (userDetails.Location == null)
                    {
                        var location = new Location()
                        {
                            LocationName = billingInfo.BillingAddress1,
                            FirstName = billingInfo.BillingFirstName,
                            LastName = billingInfo.BillingLastName,
                            Address1 = billingInfo.BillingAddress1,
                            Address2 = billingInfo.BillingAddress2,
                            City = billingInfo.City,
                            StateOrProvince = billingInfo.State,
                            ZipCode = billingInfo.ZipCode,
                            CountryCode = billingInfo.CountryCode.ToString(),
                            Country = "United States"
                        };
                        db.Locations.AddObject(location);
                        db.SaveChanges();
                        userDetails.LocationId = location.LocationId;
                    }
                    else
                    {
                        userDetails.Location.FirstName = billingInfo.BillingFirstName;
                        userDetails.Location.LastName = billingInfo.BillingLastName;
                        userDetails.Location.Address1 = billingInfo.BillingAddress1;
                        userDetails.Location.Address2 = billingInfo.BillingAddress2;
                        userDetails.Location.City = billingInfo.City;
                        userDetails.Location.StateOrProvince = billingInfo.State;
                        userDetails.Location.ZipCode = billingInfo.ZipCode;
                    }

                }
                db.UserDetails.ApplyCurrentValues(userDetails);
                db.SaveChanges();
                //process reward
                if (order.rewardPoints > 0)
                {
                    var reward = new Reward()
                    {
                        Amount = -order.rewardPoints,
                        RewardTypeId = (int)RewardType.Order,
                        OrderId = order.OrderId,
                        RewardCreatedAt = DateTime.Now,
                        UserId = MembershipHelper.GetUserIdByEmail(payer.UserName),
                        RewardDescription = "Consume reward points"
                    };
                    db.Rewards.AddObject(reward);
                }
                if(order.OrderItems.Count(i=>i.ItemTypeId == (int)ItemType.MembershipCard) > 0) {
                    var rewardCards = order.OrderItems.Where(i=>i.ItemTypeId == (int)ItemType.MembershipCard);
                    var totalPoints = 0.0m;
                    foreach( var rewardCard in rewardCards) {
                        var card = db.RewardCards.Single(i=>i.RewardCardId == rewardCard.ItemId);
                        totalPoints += card.RewardPoints * rewardCard.Quantity;
                    }
                    var reward = new Reward()
                    {
                        Amount = totalPoints,
                        RewardTypeId = (int)RewardType.RewardCard,
                        OrderId = order.OrderId,
                        Txn = order.TxnId,
//.........这里部分代码省略.........
开发者ID:gracianani,项目名称:MyLunchBox,代码行数:101,代码来源:CheckoutController.cs


注:本文中的PaymentType.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。