From ccf4e28f76d6c1c84560ce942b926fa3bb4cbca4 Mon Sep 17 00:00:00 2001 From: phot0n Date: Fri, 29 Jul 2022 12:34:51 +0530 Subject: [PATCH 1/3] docs: update readme about installation & uninstallation about custom fields --- README.md | 2 ++ payments/public/js/razorpay.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1dd3782..7772261 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,8 @@ App has 2 modules - Payments and Payment Gateways. Payment Module contains the Payment Gateway DocType which creates links for the payment gateways and Payment Gateways Module contain all the Payment Gateway (Razorpay, Stripe, Braintree, Paypal, PayTM) DocTypes. +App adds custom fields to Web Form for facilitating payments upon installation and removes them upon uninstallation. + All general utils are stored in [utils](payments/utils) directory. The utils are written in [utils.py](payments/utils/utils.py) and then imported into the [`__init__.py`](payments/utils/__init__.py) file for easier importing/namespacing. [overrides](payments/overrides) directory has all the overrides for overriding standard frappe code. Currently it overrides WebForm DocType controller as well as a WebForm whitelisted method. diff --git a/payments/public/js/razorpay.js b/payments/public/js/razorpay.js index ce48f10..c74d1be 100644 --- a/payments/public/js/razorpay.js +++ b/payments/public/js/razorpay.js @@ -3,7 +3,7 @@ Razorpay Payment 1. Include checkout script in your code - {{ include_script('checkout.bundle.js) }} + {{ include_script('/assets/payments/js/razorpay.js') }} 2. Create the Order controller in your backend def get_razorpay_order(self): From 5720d9530a900f8afeebcbaef7be19a222949bf6 Mon Sep 17 00:00:00 2001 From: phot0n Date: Fri, 29 Jul 2022 12:56:37 +0530 Subject: [PATCH 2/3] chore: add comment for before_install hack --- payments/utils/utils.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/payments/utils/utils.py b/payments/utils/utils.py index a34c16d..07ae5c4 100644 --- a/payments/utils/utils.py +++ b/payments/utils/utils.py @@ -2,7 +2,6 @@ import click import frappe from frappe import _ -from frappe.utils.data import cint from frappe.custom.doctype.custom_field.custom_field import create_custom_fields @@ -164,6 +163,13 @@ def delete_custom_fields(): def before_install(): - # only install for v14 - if cint(frappe.get_module("frappe").__version__[:2]) < 14 or not frappe.get_meta("Module Def").has_field("custom"): + # TODO: remove this + # This is done for erpnext CI patch test + # + # Since we follow a flow like install v14 -> restore v10 site + # -> migrate to v12, v13 and then v14 again + # + # This app fails installing when the site is restored to v10 as + # a lot of apis don;t exist in v10 and this is a (at the moment) required app for erpnext. + if not frappe.get_meta("Module Def").has_field("custom"): return False From 7a325808efc237bd3bdd82252c35f5d18efc07e4 Mon Sep 17 00:00:00 2001 From: phot0n Date: Mon, 1 Aug 2022 11:23:21 +0530 Subject: [PATCH 3/3] ci: start bench after site creation --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3c934ab..42a5064 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -76,6 +76,7 @@ jobs: bench get-app payments $GITHUB_WORKSPACE bench setup requirements --dev bench new-site --db-root-password root --admin-password admin test_site + bench start &> bench_start.log & bench --site test_site install-app payments bench build env: