fix: billing flow issues

This commit is contained in:
Jannat Patel
2023-09-26 22:40:00 +05:30
parent 5614a6203f
commit 4f97760e8a
4 changed files with 33 additions and 10 deletions

View File

@@ -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 %}

View File

@@ -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"));
@@ -114,8 +114,8 @@ 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) => {
@@ -123,7 +123,7 @@ const generate_payment_link = (e) => {
response,
doctype,
docname,
address,
new_address,
data.message.order_id
);
};
@@ -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);
@@ -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");
}
},
});
};

View File

@@ -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"
)
@@ -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":