diff --git a/frontend/src/pages/Billing.vue b/frontend/src/pages/Billing.vue new file mode 100644 index 00000000..ae05cbae --- /dev/null +++ b/frontend/src/pages/Billing.vue @@ -0,0 +1,182 @@ + + + + + {{ __('Billing Details') }} + + + {{ __('Enter the billing information to complete the payment.') }} + + + + {{ __('Address') }} + + + {{ __('Specify your billing address correctly.') }} + + + + + + {{ __('Billing Name') }} + + + + + + {{ __('Address Line 1') }} + + + + + + {{ __('Address Line 2') }} + + + + + + {{ __('City') }} + + + + + + {{ __('State') }} + + + + + + + + {{ __('Country') }} + + + + + + {{ __('Postal Code') }} + + + + + + {{ __('Phone Number') }} + + + + + + {{ __('Source') }} + + + + + + {{ __('GST Number') }} + + + + + + {{ __('Pan Number') }} + + + + + + + {{ __('Proceed to Payment') }} + + + + + + + + {{ __('Not Permitted') }} + + + + {{ access.data?.message }} + + + {{ __('Login') }} + + + + {{ __('Checkout Courses') }} + + + + + {{ __('Checkout Batches') }} + + + + + + + + diff --git a/frontend/src/router.js b/frontend/src/router.js index 6f3e30c6..2a66db34 100644 --- a/frontend/src/router.js +++ b/frontend/src/router.js @@ -43,6 +43,12 @@ const routes = [ component: () => import('@/pages/Batch.vue'), props: true, }, + { + path: '/billing/:type/:name', + name: 'Billing', + component: () => import('@/pages/Billing.vue'), + props: true, + }, { path: '/statistics', name: 'Statistics', diff --git a/lms/lms/api.py b/lms/lms/api.py index c681c900..e09f0848 100644 --- a/lms/lms/api.py +++ b/lms/lms/api.py @@ -3,6 +3,7 @@ import frappe from frappe.translate import get_all_translations +from frappe import _ @frappe.whitelist() @@ -163,3 +164,39 @@ def get_translations(): else: language = frappe.db.get_single_value("System Settings", "language") return get_all_translations(language) + + +@frappe.whitelist() +def validate_billing_access(type, name): + access = True + message = "" + + if frappe.session.user == "Guest": + access = False + message = _("Please login to continue with payment.") + + if type not in ["course", "batch"]: + access = False + message = _("Module is incorrect.") + + if not frappe.db.exists(type, name): + access = False + message = _("Module Name is incorrect or does not exist.") + + if type == "course": + membership = frappe.db.exists( + "LMS Enrollment", {"member": frappe.session.user, "course": name} + ) + if membership: + access = False + message = _("You are already enrolled for this course.") + + else: + membership = frappe.db.exists( + "Batch Student", {"student": frappe.session.user, "parent": name} + ) + if membership: + access = False + message = _("You are already enrolled for this batch.") + + return {"access": access, "message": message} diff --git a/lms/lms/utils.py b/lms/lms/utils.py index fd4b27e5..92c7e49f 100644 --- a/lms/lms/utils.py +++ b/lms/lms/utils.py @@ -1192,6 +1192,9 @@ def get_course_details(course): "published", "upcoming", "status", + "paid_course", + "course_price", + "currency", ], as_dict=1, )