Skip to content

Commit 76e0bf1

Browse files
authored
Merge pull request #215 from aerele/payments-develop
chore: align payments with develop
2 parents 3cebd94 + 2b01a09 commit 76e0bf1

9 files changed

Lines changed: 129 additions & 166 deletions

File tree

.github/helper/flake8.conf

Lines changed: 0 additions & 74 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313
- cron: "0 0 * * *"
1414

1515
concurrency:
16-
group: develop-${{ github.event.number }}
16+
group: payments-ci-${{ github.event_name }}-${{ github.event.number || github.run_id }}
1717
cancel-in-progress: true
1818

1919
jobs:
@@ -43,12 +43,12 @@ jobs:
4343

4444
steps:
4545
- name: Clone
46-
uses: actions/checkout@v4
46+
uses: actions/checkout@v6
4747

4848
- name: Setup Python
49-
uses: actions/setup-python@v5
49+
uses: actions/setup-python@v6
5050
with:
51-
python-version: '3.10'
51+
python-version: '3.14'
5252

5353
- name: Check for valid Python & Merge Conflicts
5454
run: |
@@ -59,9 +59,9 @@ jobs:
5959
fi
6060
6161
- name: Setup Node
62-
uses: actions/setup-node@v4
62+
uses: actions/setup-node@v6
6363
with:
64-
node-version: 18
64+
node-version: 24
6565
check-latest: true
6666

6767
- name: Add to Hosts
@@ -90,7 +90,7 @@ jobs:
9090
9191
- name: Get yarn cache directory path
9292
id: yarn-cache-dir-path
93-
run: echo "::set-output name=dir::$(yarn cache dir)"
93+
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
9494

9595
- uses: actions/cache@v4
9696
id: yarn-cache
@@ -127,7 +127,7 @@ jobs:
127127
if: ${{ github.event_name != 'pull_request' }}
128128
steps:
129129
- name: Clone
130-
uses: actions/checkout@v4
130+
uses: actions/checkout@v6
131131

132132
- name: Download artifacts
133133
uses: actions/download-artifact@v4

.github/workflows/linter.yml

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ permissions:
1010
contents: read
1111

1212
concurrency:
13-
group: commitcheck-frappe-${{ github.event.number }}
13+
group: payments-linter-${{ github.event_name }}-${{ github.event.number || github.run_id }}
1414
cancel-in-progress: true
1515

1616
jobs:
@@ -20,12 +20,12 @@ jobs:
2020
if: github.event_name == 'pull_request'
2121

2222
steps:
23-
- uses: actions/checkout@v4
23+
- uses: actions/checkout@v6
2424
with:
2525
fetch-depth: 200
26-
- uses: actions/setup-node@v4
26+
- uses: actions/setup-node@v6
2727
with:
28-
node-version: 16
28+
node-version: 24
2929
check-latest: true
3030

3131
- name: Check commit titles
@@ -39,16 +39,24 @@ jobs:
3939
if: github.event_name == 'pull_request'
4040

4141
steps:
42-
- uses: actions/checkout@v4
43-
- uses: actions/setup-python@v5
42+
- uses: actions/checkout@v6
43+
44+
- name: Set up Python 3.14
45+
uses: actions/setup-python@v6
4446
with:
45-
python-version: '3.10'
46-
- uses: pre-commit/action@v3.0.0
47+
python-version: '3.14'
48+
49+
- name: Install and Run Pre-commit
50+
uses: pre-commit/action@v3.0.0
4751

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

55+
- name: Download semgrep
56+
run: pip install semgrep
57+
5158
- name: Run Semgrep rules
52-
run: |
53-
pip install semgrep==1.90.0
54-
semgrep ci --config ./frappe-semgrep-rules/rules --config r/python.lang.correctness
59+
run: semgrep ci --config ./frappe-semgrep-rules/rules --config r/python.lang.correctness
60+
61+
- name: Semgrep for Test Correctness
62+
run: semgrep ci --include=**/test_*.py --config ./semgrep/test-correctness.yml

payments/hooks.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,6 @@
120120
# Testing
121121
# -------
122122

123-
before_tests = "erpnext.setup.utils.before_tests" # To setup company and accounts
124-
125123
# Overriding Methods
126124
# ------------------------------
127125
#

payments/payment_gateways/doctype/mpesa_settings/mpesa_settings.py

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,7 @@ def request_for_payment(self, **kwargs):
5353

5454
for _i, amount in enumerate(request_amounts):
5555
args.request_amount = amount
56-
if frappe.flags.in_test:
57-
from payments.payment_gateways.doctype.mpesa_settings.test_mpesa_settings import (
58-
get_payment_request_response_payload,
59-
)
60-
61-
response = frappe._dict(get_payment_request_response_payload(amount))
62-
else:
63-
response = frappe._dict(generate_stk_push(**args))
64-
56+
response = frappe._dict(generate_stk_push(**args))
6557
self.handle_api_response("CheckoutRequestID", args, response)
6658

6759
def split_request_amount_according_to_transaction_limit(self, args):
@@ -90,15 +82,7 @@ def get_account_balance_info(self):
9082
reference_doctype="Mpesa Settings", reference_docname=self.name, doc_details=vars(self)
9183
)
9284

93-
if frappe.flags.in_test:
94-
from payments.payment_gateways.doctype.mpesa_settings.test_mpesa_settings import (
95-
get_test_account_balance_response,
96-
)
97-
98-
response = frappe._dict(get_test_account_balance_response())
99-
else:
100-
response = frappe._dict(get_account_balance(payload))
101-
85+
response = frappe._dict(get_account_balance(payload))
10286
self.handle_api_response("ConversationID", payload, response)
10387

10488
def handle_api_response(self, global_id, request_dict, response):

0 commit comments

Comments
 (0)