Example #1
0
        /// <summary>
        /// Processes the payment for a given card and returns the reference no for the
        /// payment processed
        /// </summary>
        /// <param name="cardForBooking"></param>
        /// <param name="amount"></param>
        /// <param name="status"></param>
        /// <returns>Returns the payment reference number</returns>
        private string MakePayment(Card cardForBooking, decimal amount, out PaymentStatus status)
        {
            string          referenceNo    = string.Empty;
            IPaymentManager paymentManager = null;

            //Call the Payment Service which will internally call the wcf service payment gateway
            try
            {
                paymentManager = PaymentManagerFactory.GetInstance().Create();

                //referenceNo = paymentManager.MakePayment(cardForBooking, amount, out status);
                referenceNo = Guid.NewGuid().ToString();
                status      = PaymentStatus.Success;
            }
            catch (PaymentNotProcessedFromServiceException ex)
            {
                throw new PaymentProcessException("Unable to Process Payment", ex);
            }
            catch (Exception ex)
            {
                throw new PaymentProcessException("Unable to Process Payment", ex);
            }

            return(referenceNo);
        }
 /// <summary>
 /// Default Constructor
 /// </summary>
 public BookingManager()
 {
     bookingDAO     = BookingDAOFactory.GetInstance().Create(BookingTypes.Flight);
     paymentManager = PaymentManagerFactory.GetInstance().Create();
 }