/// <summary>
        /// Client method working with instances of concrete creator
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            Console.WriteLine("Physical Product : 1\nBook : 2\nMembership : 3\nUpgrade Membership : 4\nLearning Ski Video : 5");
            Console.WriteLine("**************************************************************");
            ProductFactory productFactory = new ProductInitializer();

            IPaymentMode physicalProduct = productFactory.GetInvoiceDetails(1);

            physicalProduct.InvoiceGenerator();
            Console.WriteLine("*************************");

            IPaymentMode purchaseBook = productFactory.GetInvoiceDetails(2);

            purchaseBook.InvoiceGenerator();
            Console.WriteLine("*************************");

            IPaymentMode membershipActivation = productFactory.GetInvoiceDetails(3);

            membershipActivation.InvoiceGenerator();
            Console.WriteLine("*************************");

            IPaymentMode membershipUpgrade = productFactory.GetInvoiceDetails(4);

            membershipUpgrade.InvoiceGenerator();
            Console.WriteLine("*************************");

            IPaymentMode learningVideo = productFactory.GetInvoiceDetails(5);

            learningVideo.InvoiceGenerator();

            Console.ReadKey();
        }
Пример #2
0
 public TableReservationController(ICustomerReg icustomerReg, IGuestReg iguestReg, IBookingTable ibookingTable, IVenueModel ivenue, IPaymentMode ipayment, IRegAndLogin iregCutsomer)
 {
     _customerReg  = icustomerReg;
     _guestReg     = iguestReg;
     _bookingTable = ibookingTable;
     _venueDetails = ivenue;
     _paymentMode  = ipayment;
     _regcust      = iregCutsomer;
 }
Пример #3
0
        public async Task <Transaction> ProcessPaymentAsync(string EmailId)
        {
            this._paymentMode = new CardPayment()
            {
                PaymentType = PaymentType.Prepaid,
                Card        = new Card()
                {
                    AccountHolderName = EmailId,
                }
            };

            return(await ProcessPaymentAsync());
        }
Пример #4
0
        public async Task <Transaction> ProcessPaymentAsync()
        {
            //await Session.GetTokenIfEmptyAsync(AuthTokenType.SignIn);

            //if (Session.signInToken == null || string.IsNullOrEmpty(Session.signInToken.AccessToken))
            //{
            //    throw new UnauthorizedAccessException("User is not logged to perform this operation");
            //}

            if (this._bill == null || this._paymentMode == null || this._user == null)
            {
                throw new ArgumentException();
            }

            if (!this._bill.IsValid())
            {
                throw new ServiceException("Unable to get bill from server. Please try again.");
            }

            if (!ValidatePaymentMode())
            {
                return(null);
            }

            IPaymentMode paymentMode = null;

            if (this._paymentMode is CardPayment)
            {
                var cardPayment = this._paymentMode as CardPayment;

                if (cardPayment.PaymentType == PaymentType.Card)
                {
                    if (cardPayment.Card.CardScheme.HasValue && cardPayment.Card.CardScheme.Value == CreditCardType.Mtro)
                    {
                        if (string.IsNullOrEmpty(cardPayment.Card.CVV))
                        {
                            cardPayment.Card.CVV = "123";
                        }
                        if (cardPayment.Card.ExpiryDate == null)
                        {
                            cardPayment.Card.ExpiryDate = new CardExpiry()
                            {
                                Month = 11,
                                Year  = 2019 //Dummy value
                            };
                        }
                    }
                }
                else if (cardPayment.PaymentType == PaymentType.Prepaid)
                {
                    cardPayment.Card.CVV        = "000";
                    cardPayment.Card.CardNumber = "1234561234561234";
                    cardPayment.Card.CardScheme = CreditCardType.Prepaid;
                    cardPayment.Card.CardType   = CardType.Prepaid;
                    cardPayment.Card.ExpiryDate = new CardExpiry()
                    {
                        Month = 04,
                        Year  = 2030
                    };

                    cardPayment.PaymentType = PaymentType.Card;
                }

                paymentMode = cardPayment;
            }
            else if (this._paymentMode is TokenPayment)
            {
                paymentMode = this._paymentMode;
            }
            else if (this._paymentMode is TokenBankingPayment)
            {
                paymentMode = this._paymentMode;
            }
            else if (this._paymentMode is NetBankingPayment)
            {
                paymentMode = this._paymentMode;
            }

            if (paymentMode == null)
            {
                throw new ArgumentException();
            }

            var paymentRequest = new PaymentRequest()
            {
                ReturnUrl         = this._bill.ReturnUrl,
                NotifyUrl         = this._bill.NotifyUrl,
                BillAmount        = this._bill.BillAmount,
                MerchantAccessKey = this._bill.MerchantAccessKey,
                PaymentMode       = paymentMode,
                MerchantTxnId     = this._bill.MerchantTxnId,
                RequestSignature  = this._bill.RequestSignature,
                User = this._user
            };

            var rest = new RestWrapper();
            //var result = await rest.Post<Transaction>(Service.LoadMoney, AuthTokenType.SignIn, paymentRequest, true);
            var result = await rest.Post <Transaction>(Service.LoadMoney, AuthTokenType.None, paymentRequest, true);

            if (!(result is Error))
            {
                return((Transaction)result);
            }

            Utility.ParseAndThrowError(((Error)result).Response);
            return(null);
        }
Пример #5
0
 public PaymentGateway(PaymentBill bill, IPaymentMode paymentMode, UserDetails userDetails)
 {
     _paymentMode = paymentMode;
     _bill        = bill;
     _user        = userDetails;
 }
Пример #6
0
 public PaymentManagerLC(IPaymentMode paymentMode)
 {
     this.paymentMode = paymentMode;
 }
Пример #7
0
 public PaymentModeController(IPaymentMode _IPaymentMode)
 {
     this._IPaymentMode = _IPaymentMode;
 }