Skip to content

Commit 248f0db

Browse files
authored
Merge pull request #5 from resilient-tech/converting-to-app
revert: update folder structure as frappe APP
2 parents 83c25f7 + cd38f56 commit 248f0db

37 files changed

+228
-70
lines changed

constants/__init__.py

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = "15.0.0"

payment_integration_utils/config/__init__.py

Whitespace-only changes.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
BUG_REPORT_URL = (
2+
"https://github.com/resilient-tech/payment-integration-utils/issues/new"
3+
)
4+
5+
SECONDS_IN_A_DAY = 86400 # use for to get day's end epoch time

payment_integration_utils/hooks.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
app_name = "payment_integration_utils"
2+
app_title = "Payment Integration Utils"
3+
app_publisher = "Resilient Tech"
4+
app_description = "Base for integrate online payment integrations"
5+
app_email = "info@resilient.tech"
6+
app_license = "GNU General Public License (v3)"
7+
required_apps = ["frappe/erpnext"]
8+
9+
after_install = "payment_integration_utils.install.after_install"
10+
before_uninstall = "payment_integration_utils.uninstall.before_uninstall"
11+
12+
app_include_js = "payment_integration_utils.bundle.js"
13+
14+
export_python_type_annotations = True
15+
16+
doctype_js = {
17+
"Payment Entry": "payment_integration_utils/client_overrides/form/payment_entry.js",
18+
"Bank Account": "payment_integration_utils/client_overrides/form/bank_account.js",
19+
"User": "payment_integration_utils/client_overrides/form/user.js",
20+
}
21+
22+
doctype_list_js = {
23+
"Payment Entry": "payment_integration_utils/client_overrides/list/payment_entry_list.js",
24+
}
25+
26+
27+
doc_events = {
28+
"Payment Entry": {
29+
"onload": "payment_integration_utils.payment_integration_utils.server_overrides.doctype.payment_entry.onload",
30+
"validate": "payment_integration_utils.payment_integration_utils.server_overrides.doctype.payment_entry.validate",
31+
},
32+
"Bank Account": {
33+
"validate": "payment_integration_utils.payment_integration_utils.server_overrides.doctype.bank_account.validate",
34+
},
35+
}
36+
37+
before_payment_authentication = "payment_integration_utils.payment_integration_utils.utils.permission.has_payment_permissions"
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import click
2+
import frappe
3+
4+
from payment_integration_utils.constants import BUG_REPORT_URL
5+
from payment_integration_utils.hooks import app_title as APP_NAME
6+
from payment_integration_utils.setup import setup_customizations
7+
8+
POST_INSTALL_PATCHES = []
9+
10+
11+
def after_install():
12+
try:
13+
setup_customizations()
14+
run_post_install_patches()
15+
16+
except Exception as e:
17+
click.secho(
18+
(
19+
f"Installation of {APP_NAME} failed due to an error. "
20+
"Please try re-installing the app or "
21+
f"report the issue on {BUG_REPORT_URL} if not resolved."
22+
),
23+
fg="bright_red",
24+
)
25+
raise e
26+
27+
click.secho(f"Thank you for installing {APP_NAME}!!\n", fg="green")
28+
29+
30+
def run_post_install_patches():
31+
if not POST_INSTALL_PATCHES:
32+
return
33+
34+
click.secho("Running post-install patches...", fg="yellow")
35+
36+
frappe.flags.in_patch = True
37+
38+
try:
39+
for patch in POST_INSTALL_PATCHES:
40+
patch_module = (
41+
f"payment_integration_utils.patches.post_install.{patch}.execute"
42+
)
43+
frappe.get_attr(patch_module)()
44+
45+
finally:
46+
frappe.flags.in_patch = False
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Payment Integration Utils
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[pre_model_sync]
2+
# Patches added in this section will be executed before doctypes are migrated
3+
# Read docs to understand patches: https://frappeframework.com/docs/v14/user/en/database-migrations
4+
5+
[post_model_sync]
6+
# Patches added in this section will be executed after doctypes are migrated

payment_integration_utils/patches/post_install/__init__.py

Whitespace-only changes.

payment_integration_utils/payment_integration_utils/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)