Skip to content

Commit 1525427

Browse files
fix kissflow integration
1 parent 3389912 commit 1525427

File tree

6 files changed

+481
-10
lines changed

6 files changed

+481
-10
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
prime-env.sh
12
.DS_Store
23
.env
34
.flaskenv
@@ -23,4 +24,4 @@ secure-drop.log
2324
htmlcov/
2425
.coverage
2526
.coverage.*
26-
*,cover
27+
*,cover

.infisical.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"workspaceId": "6b03f5f8-6c53-4cd6-8fa9-6a56f6804adb",
3+
"defaultEnvironment": "",
4+
"gitBranchToEnvironmentMapping": null
5+
}

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.13

pyproject.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[project]
2+
name = "secure-drop"
3+
version = "0.1.0"
4+
description = "Add your description here"
5+
readme = "README.md"
6+
requires-python = ">=3.13"
7+
dependencies = [
8+
"boto3==1.26.137",
9+
"flask==2.2.2",
10+
"flask-limiter==3.8.0",
11+
"flask-recaptcha==0.4.2",
12+
"gunicorn==20.1.0",
13+
"jinja2==3.0.3",
14+
"python-dotenv==0.21.0",
15+
"werkzeug==2.2.2",
16+
]

server.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -235,15 +235,16 @@ def find_aog_item_by_grant_id(grant_id):
235235
items_found = []
236236

237237
# Check if there's a table structure in the response
238-
for table_name, table_data in data.items():
239-
if table_name == "Columns" or table_name == "Filter":
238+
for key, val in data.items():
239+
if key != "Data":
240240
continue
241241

242-
if isinstance(table_data, list):
243-
for page_data in table_data:
244-
if isinstance(page_data, dict) and 'response' in page_data:
245-
items_found.extend(page_data['response'])
246-
242+
if isinstance(val, list):
243+
for page_data in val:
244+
if isinstance(page_data, dict) and '_created_by' in page_data:
245+
items_found.append(page_data)
246+
247+
#print(items_found)
247248
# Search through the items for matching Grant ID
248249
for item in items_found:
249250
# Check various possible field names for the Grant ID
@@ -298,7 +299,7 @@ def update_aog_kyc_comments(item_id, legal_identifier):
298299
}
299300

300301
# Get current item details using admin endpoint
301-
get_url = f"https://{subdomain}.kissflow.com/process/2/{account_id}/admin/{process_id}/item/{item_id}"
302+
get_url = f"https://{subdomain}.kissflow.com/process/2/{account_id}/admin/{process_id}/{item_id}"
302303
get_response = requests.get(get_url, headers=headers)
303304

304305
if get_response.status_code != 200:
@@ -310,10 +311,13 @@ def update_aog_kyc_comments(item_id, legal_identifier):
310311
# Update the KYC_Comments field while preserving other fields
311312
current_item['KYC_Comments'] = legal_identifier
312313

314+
# Remove all fields starting with '_' before sending to Kissflow
315+
filtered_item = {k: v for k, v in current_item.items() if not k.startswith('_')}
316+
313317
# Use admin PUT endpoint to update the item
314318
put_url = f"https://{subdomain}.kissflow.com/process/2/{account_id}/admin/{process_id}/{item_id}"
315319

316-
response = requests.put(put_url, headers=headers, json=current_item)
320+
response = requests.put(put_url, headers=headers, json=filtered_item)
317321

318322
if response.status_code == 200:
319323
logging.info(f"Successfully updated AOG item {item_id} with legal identifier {legal_identifier}")

0 commit comments

Comments
 (0)