Skip to content

Commit 7c4b853

Browse files
authored
Merge pull request #2172 from coronasafe/develop
Develop to Staging
2 parents 0240be1 + 57986ea commit 7c4b853

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+4555
-776
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919
}
2020
},
2121
"postCreateCommand": "echo 'eval \"$(direnv hook bash)\"' >> ~/.bashrc && cp .env.example .env",
22-
"postAttachCommand": "make up",
22+
"postStartCommand": "make up",
2323
"forwardPorts": [8000, 9000, 4000]
2424
}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,3 +356,7 @@ secrets.sh
356356
/.idea/modules.xml
357357
/.idea/vcs.xml
358358
/.idea/ruff.xml
359+
360+
361+
# Redis
362+
*.rdb

Pipfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ djangoql = "==0.17.1"
2525
djangorestframework = "==3.14.0"
2626
djangorestframework-simplejwt = "==5.3.1"
2727
dry-rest-permissions = "==0.1.10"
28-
drf-nested-routers = "==0.93.4"
28+
drf-nested-routers = "==0.94.1"
2929
drf-spectacular = "==0.26.4"
3030
"fhir.resources" = "==6.5.0"
3131
gunicorn = "==22.0.0"
@@ -36,18 +36,18 @@ newrelic = "==9.3.0"
3636
pillow = "==10.3.0"
3737
psycopg = "==3.1.18"
3838
pycryptodome = "==3.20.0"
39-
pydantic = "==1.10.12" # fix for fhir.resources < 7.0.2
39+
pydantic = "==1.10.15" # fix for fhir.resources < 7.0.2
4040
pyjwt = "==2.8.0"
4141
python-slugify = "==8.0.1"
4242
pywebpush = "==1.14.0"
4343
redis = {extras = ["hiredis"], version = "<5.0.0"} # constraint for redis-om
4444
requests = "==2.31.0"
4545
sentry-sdk = "==1.30.0"
46-
whitenoise = "==6.5.0"
46+
whitenoise = "==6.6.0"
4747
redis-om = "==0.2.1"
4848

4949
[dev-packages]
50-
black = "==24.3.0"
50+
black = "==24.4.2"
5151
boto3-stubs = {extras = ["s3", "boto3"], version = "==1.34.84"}
5252
coverage = "==7.4.0"
5353
debugpy = "==1.8.1"
@@ -60,14 +60,14 @@ djangorestframework-stubs = "==3.14.2"
6060
factory-boy = "==3.3.0"
6161
flake8 = "==7.0.0"
6262
freezegun = "==1.2.2"
63-
ipython = "==8.15.0"
63+
ipython = "==8.24.0"
6464
isort = "==5.12.0"
6565
mypy = "==1.9.0"
6666
pre-commit = "==3.4.0"
6767
requests-mock = "==1.12.1"
6868
tblib = "==2.0.0"
6969
watchdog = "==3.0.0"
70-
werkzeug = "==2.3.8"
70+
werkzeug = "==3.0.3"
7171

7272
[docs]
7373
furo = "==2023.9.10"

Pipfile.lock

Lines changed: 311 additions & 310 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aws/backend.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@
4141
"name": "CURRENT_DOMAIN",
4242
"value": "https://care.ohc.network"
4343
},
44+
{
45+
"name": "BACKEND_DOMAIN",
46+
"value": "https://careapi.ohc.network"
47+
},
4448
{
4549
"name": "DJANGO_ADMIN_URL",
4650
"value": "w8BYTTYRkxqAsbS2iU9Yd2ZgQy6D3uws"

aws/celery.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232
"name": "CURRENT_DOMAIN",
3333
"value": "https://care.ohc.network"
3434
},
35+
{
36+
"name": "BACKEND_DOMAIN",
37+
"value": "https://careapi.ohc.network"
38+
},
3539
{
3640
"name": "DJANGO_ADMIN_URL",
3741
"value": "w8BYTTYRkxqAsbS2iU9Yd2ZgQy6D3uws"
@@ -307,6 +311,10 @@
307311
"name": "CURRENT_DOMAIN",
308312
"value": "https://care.ohc.network"
309313
},
314+
{
315+
"name": "BACKEND_DOMAIN",
316+
"value": "https://careapi.ohc.network"
317+
},
310318
{
311319
"name": "DJANGO_ADMIN_URL",
312320
"value": "w8BYTTYRkxqAsbS2iU9Yd2ZgQy6D3uws"

care/abdm/api/serializers/consent.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
from rest_framework import serializers
2+
3+
from care.abdm.api.serializers.abhanumber import AbhaNumberSerializer
4+
from care.abdm.models.consent import ConsentArtefact, ConsentRequest
5+
from care.users.api.serializers.user import UserBaseMinimumSerializer
6+
7+
8+
class ConsentArtefactSerializer(serializers.ModelSerializer):
9+
id = serializers.CharField(source="external_id", read_only=True)
10+
11+
class Meta:
12+
model = ConsentArtefact
13+
exclude = (
14+
"deleted",
15+
"external_id",
16+
"key_material_private_key",
17+
"key_material_public_key",
18+
"key_material_nonce",
19+
"key_material_algorithm",
20+
"key_material_curve",
21+
"signature",
22+
)
23+
24+
25+
class ConsentRequestSerializer(serializers.ModelSerializer):
26+
id = serializers.CharField(source="external_id", read_only=True)
27+
patient_abha_object = AbhaNumberSerializer(source="patient_abha", read_only=True)
28+
requester = UserBaseMinimumSerializer(read_only=True)
29+
consent_artefacts = ConsentArtefactSerializer(many=True, read_only=True)
30+
31+
class Meta:
32+
model = ConsentRequest
33+
exclude = ("deleted", "external_id")

care/abdm/api/viewsets/auth.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ def post(self, request, *args, **kwargs):
290290
data["hiRequest"]["keyMaterial"]["nonce"],
291291
)
292292

293-
AbdmGateway().data_transfer(
293+
data_transfer_response = AbdmGateway().data_transfer(
294294
{
295295
"transaction_id": data["transactionId"],
296296
"data_push_url": data["hiRequest"]["dataPushUrl"],
@@ -306,11 +306,11 @@ def post(self, request, *args, **kwargs):
306306
],
307307
"data": cipher.encrypt(
308308
Fhir(
309-
PatientConsultation.objects.get(
309+
PatientConsultation.objects.filter(
310310
external_id=context[
311311
"careContextReference"
312312
]
313-
)
313+
).first()
314314
).create_record(record)
315315
)["data"],
316316
},
@@ -332,7 +332,7 @@ def post(self, request, *args, **kwargs):
332332
"parameters": "Curve25519/32byte random key",
333333
"keyValue": cipher.key_to_share,
334334
},
335-
"nonce": cipher.sender_nonce,
335+
"nonce": cipher.internal_nonce,
336336
},
337337
}
338338
)
@@ -345,6 +345,10 @@ def post(self, request, *args, **kwargs):
345345
],
346346
"consent_id": data["hiRequest"]["consent"]["id"],
347347
"transaction_id": data["transactionId"],
348+
"session_status": "TRANSFERRED"
349+
if data_transfer_response
350+
and data_transfer_response.status_code == 202
351+
else "FAILED",
348352
"care_contexts": list(
349353
map(
350354
lambda context: {"id": context["careContextReference"]},

0 commit comments

Comments
 (0)