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

!!! Only merge when Ruben merged refactor registration data #59

Merged
merged 6 commits into from
Dec 2, 2024
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
9 changes: 8 additions & 1 deletion routes/routes121.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ async def kobo_to_121(request: Request, dependencies=Depends(required_headers_12
payload[target_field] = int(kobo_data[kobo_field])
elif target_field == "scope":
payload[target_field] = clean_text(kobo_data[kobo_field])
elif target_field == "fspName" and "nlrc.121.global" not in request.headers["url121"]:
payload["programFinancialServiceProviderConfigurationName"] = kobo_data[kobo_field]
elif kobo_value_url not in attachments.keys():
payload[target_field] = kobo_data[kobo_field]
else:
Expand All @@ -88,9 +90,14 @@ async def kobo_to_121(request: Request, dependencies=Depends(required_headers_12
# Continue with the POST if not in test mode
access_token = login121(request.headers["url121"], request.headers["username121"], request.headers["password121"])


if 'nlrc.121.global' in request.headers['url121']:
url = f"{request.headers['url121']}/api/programs/{programid}/registrations/import"
else:
url = f"{request.headers['url121']}/api/programs/{programid}/registrations"
# POST to 121 import endpoint
import_response = requests.post(
f"{request.headers['url121']}/api/programs/{programid}/registrations/import",
url,
headers={"Cookie": f"access_token_general={access_token}"},
json=[payload],
)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_koboto121.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_kobo_to_121_payload():
assert payload["birthYear"] == "1600"
assert payload["date"] == "2024-04-16"
assert payload["deputyMain"] == "Beneficiary"
assert payload["fspName"] == "Excel"
assert payload["programFinancialServiceProviderConfigurationName"] == "Excel"
assert payload["fullName"] == "asdf"
assert payload["maxPayments"] == 5
assert payload["NRC"] == "12345"
Expand Down
Loading