feat: payment verification and membership

This commit is contained in:
Jannat Patel
2023-08-11 19:45:12 +05:30
parent ea27acc683
commit 0c14a1ab4c
10 changed files with 327 additions and 51 deletions

View File

@@ -222,9 +222,9 @@
</a>
{% elif course.paid_course %}
<div class="btn btn-primary wide-button" id="buy-course" data-course="{{ course.name | urlencode }}">
<a class="btn btn-primary wide-button" href="/billing/{{ course.name | urlencode }}">
{{ _("Buy This Course") }}
</div>
</a>
{% elif show_start_learing_cta(course, membership) %}
<div class="btn btn-primary wide-button enroll-in-course" data-course="{{ course.name | urlencode }}">
@@ -257,9 +257,6 @@
{% endif %}
</div>
{% endmacro %}
@@ -280,9 +277,4 @@
{{ _("You have exceeded the maximum number of attempts allowed to appear for evaluations of this course.") }}
</p>
{% endif %}
{% endmacro %}
{%- block script %}
{{ super() }}
<script src="https://checkout.razorpay.com/v1/checkout.js"></script>
{% endblock %}
{% endmacro %}

View File

@@ -20,10 +20,6 @@ frappe.ready(() => {
$("#submit-for-review").click((e) => {
submit_for_review(e);
});
$("#buy-course").click((e) => {
generate_checkout_link(e);
});
});
const hide_wrapped_mentor_cards = () => {
@@ -146,24 +142,3 @@ const submit_for_review = (e) => {
},
});
};
generate_checkout_link = (e) => {
e.preventDefault();
let course = decodeURIComponent($(e.currentTarget).attr("data-course"));
if (frappe.session.user == "Guest") {
window.location.href = `/login?redirect-to=/courses/${course}`;
return;
}
frappe.call({
method: "lms.lms.doctype.lms_course.lms_course.get_payment_options",
args: {
course: course,
},
callback: (data) => {
let rzp1 = new Razorpay(data.message);
rzp1.open();
},
});
};