Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
115 changes: 108 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@ on:
- version-16

concurrency:
group: develop-erpnext_sumup-${{ github.event.number }}
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
tests:
tests_v16:
if: ${{ (github.event_name == 'pull_request' && (github.base_ref == 'develop' || github.base_ref == 'version-16')) || (github.event_name != 'pull_request' && (github.ref_name == 'develop' || github.ref_name == 'version-16')) }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
name: Server
name: Server (v16)

services:
redis-cache:
Expand Down Expand Up @@ -89,14 +88,14 @@ jobs:
- name: Setup
run: |
pip install frappe-bench
bench init --frappe-branch version-16-beta --skip-redis-config-generation --skip-assets --python "$(which python)" ~/frappe-bench
bench init --frappe-branch version-16 --skip-redis-config-generation --skip-assets --python "$(which python)" ~/frappe-bench
mariadb --host 127.0.0.1 --port 3306 -u root -proot -e "SET GLOBAL character_set_server = 'utf8mb4'"
mariadb --host 127.0.0.1 --port 3306 -u root -proot -e "SET GLOBAL collation_server = 'utf8mb4_unicode_ci'"

- name: Install
working-directory: /home/runner/frappe-bench
run: |
bench get-app --branch version-16-beta erpnext
bench get-app --branch version-16 erpnext
bench get-app erpnext_sumup $GITHUB_WORKSPACE
bench setup requirements --dev
bench new-site --db-root-password root --admin-password admin test_site
Expand All @@ -118,3 +117,105 @@ jobs:
bench --site test_site run-tests --app erpnext_sumup --skip-test-records
env:
TYPE: server

tests_v15:
if: ${{ (github.event_name == 'pull_request' && github.base_ref == 'version-15') || (github.event_name != 'pull_request' && github.ref_name == 'version-15') }}
runs-on: ubuntu-latest
name: Server (v15)

services:
redis-cache:
image: redis:alpine
ports:
- 13000:6379
redis-queue:
image: redis:alpine
ports:
- 11000:6379
mariadb:
image: mariadb:10.6
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
options: --health-cmd="mariadb-admin ping" --health-interval=5s --health-timeout=2s --health-retries=3

steps:
- name: Clone
uses: actions/checkout@v3

- name: Find tests
run: |
echo "Finding tests"
grep -rn "def test" > /dev/null

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.14'

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 24
check-latest: true

- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml', '**/setup.py', '**/setup.cfg') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: 'echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT'

- uses: actions/cache@v4
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: Update Package Repository
run: sudo apt update

- name: Install MariaDB Client
run: sudo apt-get install mariadb-client

- name: Setup
run: |
pip install frappe-bench
bench init --frappe-branch version-16-beta --skip-redis-config-generation --skip-assets --python "$(which python)" ~/frappe-bench
mariadb --host 127.0.0.1 --port 3306 -u root -proot -e "SET GLOBAL character_set_server = 'utf8mb4'"
mariadb --host 127.0.0.1 --port 3306 -u root -proot -e "SET GLOBAL collation_server = 'utf8mb4_unicode_ci'"

- name: Install
working-directory: /home/runner/frappe-bench
run: |
bench get-app --branch version-16-beta erpnext
bench get-app erpnext_sumup $GITHUB_WORKSPACE
bench setup requirements --dev
bench new-site --db-root-password root --admin-password admin test_site
bench --site test_site install-app erpnext
bench --site test_site install-app erpnext_sumup
bench build
env:
CI: 'Yes'

- name: Migrate
working-directory: /home/runner/frappe-bench
run: |
bench --site test_site migrate

- name: Run Tests
working-directory: /home/runner/frappe-bench
run: |
bench --site test_site set-config allow_tests true
bench --site test_site run-tests --app erpnext_sumup --skip-test-records
env:
TYPE: server
67 changes: 60 additions & 7 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: Linters

on:
pull_request:
branches:
- develop
- version-16
- version-15
workflow_dispatch:

permissions:
Expand All @@ -13,16 +17,16 @@ concurrency:
cancel-in-progress: true

jobs:
linter:
name: 'Frappe Linter'
linter_v16:
if: ${{ (github.event_name == 'pull_request' && (github.base_ref == 'develop' || github.base_ref == 'version-16')) || (github.event_name != 'pull_request' && (github.ref_name == 'develop' || github.ref_name == 'version-16')) }}
name: 'Frappe Linter (v16)'
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.14'
cache: pip
- uses: pre-commit/action@v3.0.0

Expand All @@ -34,14 +38,36 @@ jobs:
pip install semgrep
semgrep ci --config ./frappe-semgrep-rules/rules --config r/python.lang.correctness

deps-vulnerable-check:
name: 'Vulnerable Dependency Check'
linter_v15:
if: ${{ (github.event_name == 'pull_request' && github.base_ref == 'version-15') || (github.event_name != 'pull_request' && github.ref_name == 'version-15') }}
name: 'Frappe Linter (v15)'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: pip
- uses: pre-commit/action@v3.0.0

- name: Download Semgrep rules
run: git clone --depth 1 https://github.com/frappe/semgrep-rules.git frappe-semgrep-rules

- name: Run Semgrep rules
run: |
pip install semgrep
semgrep ci --config ./frappe-semgrep-rules/rules --config r/python.lang.correctness

deps_v16:
if: ${{ (github.event_name == 'pull_request' && (github.base_ref == 'develop' || github.base_ref == 'version-16')) || (github.event_name != 'pull_request' && (github.ref_name == 'develop' || github.ref_name == 'version-16')) }}
name: 'Vulnerable Dependency Check (v16)'
runs-on: ubuntu-latest

steps:
- uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.14'

- uses: actions/checkout@v4

Expand All @@ -59,3 +85,30 @@ jobs:
pip install pip-audit
cd ${GITHUB_WORKSPACE}
pip-audit --desc on .

deps_v15:
if: ${{ (github.event_name == 'pull_request' && github.base_ref == 'version-15') || (github.event_name != 'pull_request' && github.ref_name == 'version-15') }}
name: 'Vulnerable Dependency Check (v15)'
runs-on: ubuntu-latest

steps:
- uses: actions/setup-python@v5
with:
python-version: '3.12'

- uses: actions/checkout@v4

- name: Cache pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml', '**/setup.py') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-pip-

- name: Install and run pip-audit
run: |
pip install pip-audit
cd ${GITHUB_WORKSPACE}
pip-audit --desc on .
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ In the event of a refund or return, the amount will also be automatically refund

| ERPNext | Frappe | Support Status |
|---------|--------|----------------|
| v16 Beta | v16 Beta | Coming soon |
| v16 Beta | v16 Beta | ✅ Supported |
| v15 | v15 | ✅ Supported |

## Installation (Frappe Cloud)
Expand All @@ -37,7 +37,7 @@ The app can be installed directly via Frappe Cloud:
Once ERPNext is installed, add the app to your bench environment:

```bash
bench get-app https://github.com/Rocket-Quack/erpnext_sumup.git --branch version-15
bench get-app https://github.com/Rocket-Quack/erpnext_sumup.git --branch version-16
```

Install requirements:
Expand Down Expand Up @@ -143,7 +143,7 @@ The name SumUp is used only to describe technical compatibility with the respect

## Third-Party

This app uses the Python package `sumup` v0.0.20 (tag v0.0.20). See `THIRD_PARTY_NOTICE.md`.
This app uses the Python package `sumup` v0.0.22 (tag v0.0.22). See `THIRD_PARTY_NOTICE.md`.

## License

Expand Down
2 changes: 1 addition & 1 deletion THIRD_PARTY_NOTICE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

This project uses the following third-party software:

- sumup (Python package), version 0.0.20 (tag v0.0.20)
- sumup (Python package), version 0.0.22 (tag v0.0.22)
License: Apache License 2.0
Source: https://github.com/sumup/sumup-py
2 changes: 1 addition & 1 deletion erpnext_sumup/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "16.0.0-Beta-1"
__version__ = "16.0.0"
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
],
"row_format": "Dynamic",
"rows_threshold_for_grid_search": 20,
"sort_field": "modified",
"sort_field": "creation",
"sort_order": "DESC",
"states": []
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
],
"row_format": "Dynamic",
"rows_threshold_for_grid_search": 20,
"sort_field": "modified",
"sort_field": "creation",
"sort_order": "DESC",
"states": [],
"title_field": "terminal_name",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,26 @@ const show_recovery_message = (result) => {
});
};

const ensure_sumup_enabled = (listview) => {
if (listview && typeof listview.sumup_enabled === "boolean") {
if (!listview.sumup_enabled) {
frappe.msgprint(__("SumUp is disabled in settings."));
}
return Promise.resolve(listview.sumup_enabled);
}

return frappe.db.get_value("SumUp Settings", "SumUp Settings", "enabled").then((response) => {
const enabled = !!cint(response.message && response.message.enabled);
if (listview) {
listview.sumup_enabled = enabled;
}
if (!enabled) {
frappe.msgprint(__("SumUp is disabled in settings."));
}
return enabled;
});
};

const run_recovery_sync = (listview) => {
frappe.confirm(__("Fetch readers from SumUp and sync local terminals?"), () => {
frappe.call({
Expand All @@ -297,24 +317,30 @@ const remove_selected_terminals = (listview) => {
return;
}

frappe.confirm(
__("Remove {0} terminal(s) from SumUp and delete locally?", [terminal_names.length]),
() => {
frappe.call({
method: "erpnext_sumup.erpnext_sumup.doctype.sumup_terminal.sumup_terminal.remove_terminals",
args: {
terminal_names,
},
freeze: true,
freeze_message: __("Removing terminals..."),
callback: (response) => {
const result = response.message || {};
listview.refresh();
show_status_message(result);
},
});
ensure_sumup_enabled(listview).then((enabled) => {
if (!enabled) {
return;
}
);

frappe.confirm(
__("Remove {0} terminal(s) from SumUp and delete locally?", [terminal_names.length]),
() => {
frappe.call({
method: "erpnext_sumup.erpnext_sumup.doctype.sumup_terminal.sumup_terminal.remove_terminals",
args: {
terminal_names,
},
freeze: true,
freeze_message: __("Removing terminals..."),
callback: (response) => {
const result = response.message || {};
listview.refresh();
show_status_message(result);
},
});
}
);
});
};

const force_remove_selected_terminals = (listview) => {
Expand Down Expand Up @@ -350,6 +376,7 @@ frappe.listview_settings["SumUp Terminal"] = {
add_fields: ["connection_status", "online_status", "activity_status"],
onload(listview) {
listview.sumup_debug_enabled = false;
listview.sumup_enabled = undefined;
const refresh_action = () => {
const terminal_names = get_selected_terminal_names(listview);
refresh_terminal_statuses(listview, terminal_names.length ? terminal_names : null);
Expand All @@ -376,6 +403,9 @@ frappe.listview_settings["SumUp Terminal"] = {
listview.page.add_actions_menu_item(__("Remove from SumUp"), () => {
remove_selected_terminals(listview);
});
listview.page.add_inner_button(__("Remove from SumUp"), () => {
remove_selected_terminals(listview);
});

frappe.db
.get_value("SumUp Settings", "SumUp Settings", "enable_debug_logging")
Expand Down
Loading