public PaymentResult MakePayment(Product pProduct)
        {
            PaymentResult paymentResult = new PaymentResult();

            paymentResult.VideoPackingSlip = _packingSlip.GeneratePackingSlip(pProduct);
            return(paymentResult);
        }
Пример #2
0
        public bool OrderPlacing(OrderProcessingModal modal)
        {
            try
            {
                //ToDo: Logic to add the order into table.
                // now check the payment for product category

                switch (modal.PaymentCategory)
                {
                case PaymentFor.PhysicalProduct:
                    _packingSlip.GeneratePackingSlip(new PackingslipForShippingModal());
                    _commisionService.PayCommision();
                    break;

                case PaymentFor.Membership:
                    _membership.AddUpdateMembership(new MembershipModal());
                    break;

                case PaymentFor.Video:
                    // add the logic according to the norms...
                    break;

                default:
                    break;
                }
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
                //ToDo: Handle the exception
            }
        }
        public PaymentResult MakePayment(Product pProduct)
        {
            PaymentResult paymentResult = new PaymentResult();

            paymentResult.ProductPackingSlip = _packingSlip.GeneratePackingSlip(pProduct);
            paymentResult.AgentCommission    = _commissionPayment.GenerateCommission(pProduct);
            return(paymentResult);
        }
Пример #4
0
        public bool ProcessOrder(string productType)
        {
            // Generate Packing Slip
            bool res1 = _packingSlip.GeneratePackingSlip();

            // Generate Commission For Agent
            bool res2 = _commision.GenerateCommission();

            return(res1 && res2);
        }
Пример #5
0
        public IHttpActionResult ProcessPayment([FromBody] PaymentDTO paymentDto)
        {
            if (paymentDto == null)
            {
                return(BadRequest());
            }

            bool isPaymentSuccessful = _payment.ProcessPayment(paymentDto);

            if (isPaymentSuccessful == true)
            {
                // If the Payment got successful, then we need to execute all the Services independently to process the Order.
                int packingSlipId = 0;
                foreach (var product in paymentDto.Order.Products)
                {
                    packingSlipId = _packingSlip.GeneratePackingSlip();
                    if (product.ProductType.Equals("Book"))
                    {
                        _packingSlipRoyaltyDep.CopyOriginalPackingSlipNumberForRoyDep(packingSlipId);
                    }
                }
                // comission payment to Agent
                _agent.DoAgentCommissonPayment(paymentDto);

                if (paymentDto.MembershipDTO.MembershipName.Equals("New Membership"))
                {
                    _membership.ActivateMembership(paymentDto.User);
                }
                else if (paymentDto.MembershipDTO.MembershipName.Equals("Upgrade Membership"))
                {
                    _membershipUpgrade.UpgradeMembership(paymentDto.User);
                }

                // The below code base is to demonstarte how can we send the parms to a service which can utlize another
                // service to do processing and ship the order.
                if (paymentDto.VideoSubscriptionDTO.VideoSubscriptionName.Equals("Learning to Ski"))
                {
                    _videoSubscription.CheckUserVideoSubscriptionPlans(paymentDto.VideoSubscriptionDTO.VideoSubscriptionName);
                }
                _shipping.SaveShippingDetails(paymentDto.PackingSlipDTO);

                // Send Email Notification in all cases , We can also frame the Message body based on the opertion we wanted to do.
                _emailNotification.SendEmailNotification();

                return(Ok(isPaymentSuccessful));
            }
            else
            {
                return(InternalServerError());
            }
        }
 public bool GeneratePackingSlip(Product pProduct)
 {
     packingSlip.GeneratePackingSlip(pProduct);
     Console.WriteLine("Generate Duplicate Packing Slip for Royalty");
     return(true);
 }