Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: multiple payment methods #17

Merged
merged 22 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
2cdcab3
feat: multiple payment methods
agritheory Nov 7, 2023
9484692
chore: prettier, black, validate customizations
agritheory Nov 7, 2023
a94e0cd
fix: remove doubly-defined function
agritheory Nov 7, 2023
b338c6a
ci: install missing dateutil types
agritheory Nov 7, 2023
a9f0e3d
fix: accommodate if local file path includes app name
HKuz Nov 20, 2023
9dd1aa0
docs: update example data path
HKuz Nov 20, 2023
4e8ee11
feat: update custom fields for customer ID and PPM table
HKuz Nov 20, 2023
e1a60ed
test: move, add credit limit, update settings
HKuz Nov 21, 2023
57ce46c
fix: remove non-rendering doc.title
HKuz Nov 21, 2023
3cbdb7a
fix: include bypass config in JE credit_limit_check
HKuz Nov 21, 2023
24552b6
feat: pass portal payment method data through dialog
HKuz Nov 21, 2023
6d4e6b4
feat: add multiple payment methods, fees, credit check
HKuz Nov 21, 2023
bc63193
fix: remove extraneous new_doc call
HKuz Nov 21, 2023
0939fd6
feat: init file
HKuz Nov 21, 2023
bcbaccc
test: ignore payment method setup
HKuz Nov 22, 2023
350f370
fix: delete method order of operations
HKuz Nov 22, 2023
fcaadb8
feat: add config to create PPM when EPP is saved
HKuz Nov 22, 2023
df07e79
refactor: use enqueue to process payment
HKuz Nov 22, 2023
07382ba
fix: permission error by running in queue as admin
HKuz Jan 26, 2024
bfc5290
refactor: move fee calc to PPM, hide options as needed
HKuz Jan 31, 2024
744aaed
test: use Authorize keys if present
HKuz Jan 31, 2024
979fc08
chore: update to handle test data
HKuz Jan 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/validate_customizations.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def validate_module(customized_doctypes, set_module=False):
modules = (app_dir / this_app / "modules.txt").read_text().split("\n")
for doctype, customize_files in customized_doctypes.items():
for customize_file in customize_files:
if not this_app in str(customize_file):
if not this_app == customize_file.parent.parent.parent.parent.stem: # Updated to accommodate local folders named same as app
continue
module = customize_file.parent.parent.stem
file_contents = json.loads(customize_file.read_text())
Expand Down Expand Up @@ -106,7 +106,7 @@ def validate_no_custom_perms(customized_doctypes):
this_app = pathlib.Path(__file__).resolve().parent.parent.stem
for doctype, customize_files in customized_doctypes.items():
for customize_file in customize_files:
if not this_app in str(customize_file):
if not this_app == customize_file.parent.parent.parent.parent.stem:
continue
file_contents = json.loads(customize_file.read_text())
if file_contents.get("custom_perms"):
Expand Down Expand Up @@ -171,7 +171,7 @@ def validate_system_generated(customized_doctypes):
this_app = pathlib.Path(__file__).resolve().parent.parent.stem
for doctype, customize_files in customized_doctypes.items():
for customize_file in customize_files:
if not this_app in str(customize_file):
if not this_app == customize_file.parent.parent.parent.parent.stem:
continue
file_contents = json.loads(customize_file.read_text())
if file_contents.get("custom_fields"):
Expand Down Expand Up @@ -209,7 +209,7 @@ def validate_customizations_on_own_doctypes(customized_doctypes):

for doctype, customize_files in customized_doctypes.items():
for customize_file in customize_files:
if not this_app in str(customize_file):
if not this_app == customize_file.parent.parent.parent.parent.stem:
continue
file_contents = json.loads(customize_file.read_text())
if file_contents.get("doctype") in own_doctypes.keys():
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
python-version: '3.10'

- name: Install mypy
run: pip install mypy
run: pip install mypy types-python-dateutil

- name: Run mypy
uses: sasanquaneuf/mypy-github-action@releases/v1
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -194,3 +194,6 @@ cypress/videos

# JetBrains IDEs
.idea/

# payment method test code
test_env_setup.py
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -216,3 +216,6 @@ lib

# Prettier reformats code blocks inside Markdown, which affects rendered output
*.md

# In a Frappe context HTML files are either Jinja or Resig's microtemplate format and should not be checked
*.html
4 changes: 2 additions & 2 deletions docs/exampledata.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Using the Example Data to Experiment with Electronic Payments

The Electronic Payments application comes with a `test_setup.py` script that is completely optional to use. If you execute the script, it populates your ERPNext site with demo business data for a fictitious company called Chelsea Fruit Co. The data enable you to experiment with and test the Electronic Payments application's functionality before installing the app into your ERPNext site.
The Electronic Payments application comes with a `setup.py` script that is completely optional to use. If you execute the script, it populates your ERPNext site with demo business data for a fictitious company called Chelsea Fruit Co. The data enable you to experiment with and test the Electronic Payments application's functionality before installing the app into your ERPNext site.

It's recommended to install the demo data into its own site to avoid potential interference with the configuration or data in your organization's ERPNext site.

With `bench start` running in the background, run the following command to install the demo data:

```shell
bench execute 'electronic_payments.test_setup.before_test'
bench execute 'electronic_payments.tests.setup.before_test'
```

Refer to the [installation guide](../README.md) for detailed instructions for how to set up a bench, a new site, and installing ERPNext and the Electronic Payments application.
310 changes: 191 additions & 119 deletions electronic_payments/electronic_payments/custom/customer.json
Original file line number Diff line number Diff line change
@@ -1,120 +1,192 @@
{
"custom_fields": [
{
"_assign": null,
"_comments": null,
"_liked_by": null,
"_user_tags": null,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"collapsible_depends_on": null,
"columns": 0,
"creation": "2023-03-08 14:50:10.085129",
"default": null,
"depends_on": null,
"description": null,
"docstatus": 0,
"dt": "Customer",
"fetch_from": null,
"fetch_if_empty": 0,
"fieldname": "electronic_payment_profile",
"fieldtype": "Data",
"hidden": 1,
"hide_border": 0,
"hide_days": 0,
"hide_seconds": 0,
"idx": 63,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_preview": 0,
"in_standard_filter": 0,
"insert_after": "customer_pos_id",
"label": "Electronic Payment Profile",
"length": 0,
"mandatory_depends_on": null,
"modified": "2023-03-08 14:50:10.085129",
"modified_by": "Administrator",
"module": "Electronic Payments",
"name": "Customer-electronic_payment_profile",
"no_copy": 1,
"non_negative": 0,
"options": null,
"owner": "Administrator",
"parent": null,
"parentfield": null,
"parenttype": null,
"permlevel": 0,
"precision": "",
"print_hide": 1,
"print_hide_if_no_value": 0,
"print_width": null,
"read_only": 0,
"read_only_depends_on": null,
"report_hide": 1,
"reqd": 0,
"search_index": 0,
"translatable": 0,
"unique": 0,
"width": null
}
],
"custom_perms": [],
"doctype": "Customer",
"property_setters": [
{
"_assign": null,
"_comments": null,
"_liked_by": null,
"_user_tags": null,
"creation": "2023-03-08 14:16:04.935290",
"default_value": null,
"doc_type": "Customer",
"docstatus": 0,
"doctype_or_field": "DocField",
"field_name": "naming_series",
"idx": 0,
"modified": "2023-03-08 14:16:04.935290",
"modified_by": "Administrator",
"module": "Electronic Payments",
"name": "Customer-naming_series-hidden",
"owner": "Administrator",
"parent": null,
"parentfield": null,
"parenttype": null,
"property": "hidden",
"property_type": "Check",
"row_name": null,
"value": "1"
},
{
"_assign": null,
"_comments": null,
"_liked_by": null,
"_user_tags": null,
"creation": "2023-03-08 14:16:04.901427",
"default_value": null,
"doc_type": "Customer",
"docstatus": 0,
"doctype_or_field": "DocField",
"field_name": "naming_series",
"idx": 0,
"modified": "2023-03-08 14:16:04.901427",
"modified_by": "Administrator",
"module": "Electronic Payments",
"name": "Customer-naming_series-reqd",
"owner": "Administrator",
"parent": null,
"parentfield": null,
"parenttype": null,
"property": "reqd",
"property_type": "Check",
"row_name": null,
"value": "0"
}
],
"sync_on_migrate": 1
}
"custom_fields": [
{
"_assign": null,
"_comments": null,
"_liked_by": null,
"_user_tags": null,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"collapsible_depends_on": null,
"columns": 0,
"creation": "2023-11-07 12:51:03.404638",
"default": null,
"depends_on": null,
"description": null,
"docstatus": 0,
"dt": "Customer",
"fetch_from": null,
"fetch_if_empty": 0,
"fieldname": "electronic_payments_tab",
"fieldtype": "Tab Break",
"hidden": 0,
"hide_border": 0,
"hide_days": 0,
"hide_seconds": 0,
"idx": 75,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_preview": 0,
"in_standard_filter": 0,
"insert_after": "disabled",
"is_system_generated": 0,
"is_virtual": 0,
"label": "Electronic Payments",
"length": 0,
"mandatory_depends_on": null,
"modified": "2023-11-07 12:52:38.301377",
"modified_by": "Administrator",
"module": "Electronic Payments",
"name": "Customer-custom_electronic_payments_tab",
"no_copy": 0,
"non_negative": 0,
"options": null,
"owner": "Administrator",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"print_width": null,
"read_only": 0,
"read_only_depends_on": null,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"sort_options": 0,
"translatable": 0,
"unique": 0,
"width": null
},
{
"_assign": null,
"_comments": null,
"_liked_by": null,
"_user_tags": null,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"collapsible_depends_on": null,
"columns": 0,
"creation": "2023-11-07 12:51:03.560396",
"default": null,
"depends_on": null,
"description": null,
"docstatus": 0,
"dt": "Customer",
"fetch_from": null,
"fetch_if_empty": 0,
"fieldname": "portal_payment_method",
"fieldtype": "Table",
"hidden": 0,
"hide_border": 0,
"hide_days": 0,
"hide_seconds": 0,
"idx": 76,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_preview": 0,
"in_standard_filter": 0,
"insert_after": "electronic_payments_tab",
"is_system_generated": 0,
"is_virtual": 0,
"label": "",
"length": 0,
"mandatory_depends_on": null,
"modified": "2023-11-07 12:53:00.690310",
"modified_by": "Administrator",
"module": "Electronic Payments",
"name": "Customer-custom_portal_payment_method",
"no_copy": 0,
"non_negative": 0,
"options": "Portal Payment Method",
"owner": "Administrator",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"print_width": null,
"read_only": 0,
"read_only_depends_on": null,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"sort_options": 0,
"translatable": 0,
"unique": 0,
"width": null
},
{
"_assign": null,
"_comments": null,
"_liked_by": null,
"_user_tags": null,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"collapsible_depends_on": null,
"columns": 0,
"creation": "2023-11-09 13:23:22.451837",
"default": null,
"depends_on": null,
"description": null,
"docstatus": 0,
"dt": "Customer",
"fetch_from": null,
"fetch_if_empty": 0,
"fieldname": "electronic_payment_profile",
"fieldtype": "Data",
"hidden": 1,
"hide_border": 0,
"hide_days": 0,
"hide_seconds": 0,
"idx": 77,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_preview": 0,
"in_standard_filter": 0,
"insert_after": "portal_payment_method",
"is_system_generated": 0,
"is_virtual": 0,
"label": "Electronic Payment Profile",
"length": 0,
"mandatory_depends_on": null,
"modified": "2023-11-09 13:53:44.528246",
"modified_by": "Administrator",
"module": "Electronic Payments",
"name": "Customer-electronic_payment_profile",
"no_copy": 1,
"non_negative": 0,
"options": null,
"owner": "Administrator",
"permlevel": 0,
"precision": "",
"print_hide": 1,
"print_hide_if_no_value": 0,
"print_width": null,
"read_only": 0,
"read_only_depends_on": null,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"sort_options": 0,
"translatable": 0,
"unique": 0,
"width": null
}
],
"custom_perms": [],
"doctype": "Customer",
"links": [],
"property_setters": [],
"sync_on_migrate": 1
}
Loading
Loading