Beispiel #1
0
        //[HttpPost]
        /// <summary>
        ///
        /// </summary>
        /// <param name="courseId"></param>
        /// <param name="id">priceLineId</param>
        /// <param name="trackingId"></param>
        /// <returns></returns>
        public ActionResult PurchaseFreeCourse(int courseId, int?id = null, string trackingId = null)
        {
            var    orderNo = -1;
            string error;
            var    result = false;

            if (CurrentUserId > 0)
            {
                result = _billingServices.CompleteFreeCourseRequest(courseId, CurrentUserId, id ?? -1, trackingId, out orderNo, out error);
            }
            else
            {
                error = "please login first";
            }

            if (!result)
            {
                return(Redirect2PaymentError(error));
            }

            var course = _widgetCourseServices.GetCourseToken(Constants.DEFAULT_CURRENCY_ID, courseId, trackingId);

            var token = new ItemPurchaseDataToken
            {
                ItemId       = courseId
                , Type       = BillingEnums.ePurchaseItemTypes.COURSE
                , ItemName   = course != null ? course.CourseName : "Free course"
                , TrackingID = trackingId
            };

            SavePurchaseCompleteEvent(token);

            return(Redirect2Local("Success", orderNo));
        }
Beispiel #2
0
        public ActionResult PurchaseFreeCourse(int courseId, string trackingId = null, string refferal = null)
        {
            var    orderNo = -1;
            string error;
            var    result = false;

            if (CurrentUserId > 0)
            {
                result = _billingServices.CompleteFreeCourseRequest(courseId, CurrentUserId, trackingId, out orderNo, out error);
            }
            else
            {
                error = "please login first";
            }

            return(result ? ReturnPurchaseSuccess(-1, orderNo, trackingId, refferal) : ErrorResponse(error));
        }