Skip to content

Commit

Permalink
Merge pull request #624 from pateljannat/billing-flow-issues
Browse files Browse the repository at this point in the history
fix: billing flow issues
  • Loading branch information
pateljannat authored Sep 27, 2023
2 parents 5614a62 + 4f97760 commit 3fde923
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"fieldname": "status",
"fieldtype": "Select",
"label": "Status",
"options": "Pass\nFail",
"options": "Pending\nIn Progress\nPass\nFail",
"reqd": 1
},
{
Expand All @@ -106,7 +106,7 @@
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-08-23 14:51:21.947169",
"modified": "2023-09-26 19:44:43.594892",
"modified_by": "Administrator",
"module": "LMS",
"name": "LMS Certificate Evaluation",
Expand Down Expand Up @@ -139,6 +139,23 @@
],
"sort_field": "modified",
"sort_order": "DESC",
"states": [],
"states": [
{
"color": "Green",
"title": "Pass"
},
{
"color": "Red",
"title": "Fail"
},
{
"color": "Blue",
"title": "Pending"
},
{
"color": "Orange",
"title": "In Progress"
}
],
"title_field": "member_name"
}
2 changes: 1 addition & 1 deletion lms/www/billing/billing.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
</div>
</div>
{% if gst_applied %}
<span class="small mt-2">
<span id="gst-message" class="small mt-2">
{{ _("18% GST included") }}
</span>
{% endif %}
Expand Down
12 changes: 8 additions & 4 deletions lms/www/billing/billing.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const setup_billing = () => {
};

const generate_payment_link = (e) => {
address = this.billing.get_values();
let new_address = this.billing.get_values();
let doctype = $(e.currentTarget).attr("data-doctype");
let docname = decodeURIComponent($(e.currentTarget).attr("data-name"));

Expand All @@ -114,16 +114,16 @@ const generate_payment_link = (e) => {
args: {
doctype: doctype,
docname: docname,
phone: address.phone,
country: address.country,
phone: new_address.phone,
country: new_address.country,
},
callback: (data) => {
data.message.handler = (response) => {
handle_success(
response,
doctype,
docname,
address,
new_address,
data.message.order_id
);
};
Expand Down Expand Up @@ -156,6 +156,7 @@ const handle_success = (response, doctype, docname, address, order_id) => {
};

const change_currency = () => {
$("#gst-message").removeClass("hide");
let country = this.billing.get_value("country");
if (exception_country.includes(country)) {
update_price(original_price_formatted);
Expand All @@ -173,6 +174,9 @@ const change_currency = () => {
if (current_price != data.message) {
update_price(data.message);
}
if (!data.message.includes("INR")) {
$("#gst-message").addClass("hide");
}
},
});
};
Expand Down
6 changes: 4 additions & 2 deletions lms/www/billing/billing.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ def get_context(context):

validate_access(doctype, docname, module)
get_billing_details(context)
context.original_amount = context.amount
context.original_currency = context.currency

context.exception_country = frappe.get_all(
"Payment Country", filters={"parent": "LMS Settings"}, pluck="country"
)
Expand All @@ -28,6 +27,9 @@ def get_context(context):
if context.currency == "INR":
context.amount, context.gst_applied = apply_gst(context.amount, None)

context.original_amount = context.amount
context.original_currency = context.currency


def validate_access(doctype, docname, module):
if frappe.session.user == "Guest":
Expand Down

0 comments on commit 3fde923

Please sign in to comment.