diff --git a/printrov_merch_store/api.py b/printrov_merch_store/api.py new file mode 100644 index 0000000..f41f775 --- /dev/null +++ b/printrov_merch_store/api.py @@ -0,0 +1,24 @@ +import frappe +import razorpay + + +@frappe.whitelist() +def handle_checkout_submit(product_name: str, order_details): + # Get the razorpay client + # razorpay_client = get_razorpay_client() + + # razorpay_order = razorpay_client.order.create({ + # "amount": 100, + # "currency": "INR", + # }) + print(order_details) + + +def get_razorpay_client(): + razorpay_settings = frappe.get_cached_doc( + "Printrove Razorpay Settings" + ) + key_id = razorpay_settings.key_id + key_secret = razorpay_settings.get_password("key_secret") + + return razorpay.Client(auth=(key_id, key_secret)) diff --git a/printrov_merch_store/www/checkout.html b/printrov_merch_store/www/checkout.html index fe6e953..0dc77f8 100644 --- a/printrov_merch_store/www/checkout.html +++ b/printrov_merch_store/www/checkout.html @@ -1 +1,87 @@ +{% extends "templates/web.html" %} + +{% block script %} + + +{% endblock %} + +{% block page_content %}

Check Out with: {{ frappe.form_dict.get("product") }}

+ +
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ + +
+{% endblock %} diff --git a/printrov_merch_store/www/checkout.js b/printrov_merch_store/www/checkout.js new file mode 100644 index 0000000..6245ca6 --- /dev/null +++ b/printrov_merch_store/www/checkout.js @@ -0,0 +1 @@ +alert("script loaded"); \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index e37a2e7..fa8e951 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,6 +9,7 @@ readme = "README.md" dynamic = ["version"] dependencies = [ # "frappe~=15.0.0" # Installed and managed by bench. + "razorpay~=1.2.0", ] [build-system]