diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 0320401..4894b25 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -55,4 +55,5 @@ jobs: key: ${{ secrets.SSH_PRIVATE_KEY }} envs: SECRET_KEY,EMAIL_HOST_PASSWORD,ZIFY_AUTH script: | - docker compose -f AAISS-2023/docker-compose.yml up -d --pull always --force-recreate --no-build \ No newline at end of file + docker compose -f AAISS-2023/docker-compose.yml pull + docker compose -f AAISS-2023/docker-compose.yml up -d --force-recreate --no-build \ No newline at end of file diff --git a/backend/backend_api/models.py b/backend/backend_api/models.py index e3838f6..37a33e8 100644 --- a/backend/backend_api/models.py +++ b/backend/backend_api/models.py @@ -388,7 +388,7 @@ def create_payment_for_user(user: User): presentations: list[Presentation] = [] for workshop in user.registered_workshops.all(): try: - workshop_registration = workshop.workshopregistration_set.get(workshop_id=workshop.id) + workshop_registration = workshop.workshopregistration_set.get(workshop_id=workshop.id, user=user) if workshop_registration.status != WorkshopRegistration.StatusChoices.AWAITING_PAYMENT: continue if workshop.remaining_capacity <= 0: @@ -402,7 +402,7 @@ def create_payment_for_user(user: User): for presentation in user.participated_presentations.all(): try: presentation_participation = presentation.presentationparticipation_set.get( - presentation_id=presentation.id) + presentation_id=presentation.id, user=user) if presentation_participation.status != PresentationParticipation.StatusChoices.AWAITING_PAYMENT: continue if presentation.remaining_capacity <= 0: diff --git a/backend/backend_api/views.py b/backend/backend_api/views.py index 1de9006..62df0ed 100644 --- a/backend/backend_api/views.py +++ b/backend/backend_api/views.py @@ -216,6 +216,8 @@ class PaymentViewSet(viewsets.GenericViewSet): def payment(self, request): account = request.user call_back = request.data.get('call_back') + if call_back is None: + return Response(new_detailed_response(status.HTTP_400_BAD_REQUEST, "call_back field is required")) try: user = User.objects.get(account=account) except ObjectDoesNotExist: @@ -248,7 +250,6 @@ def verify(self, request): response = ZIFYRequest().verify_payment(payment.track_id) if response['status'] == ZIFY_STATUS_OK: payment.update_payment_status(Payment.PaymentStatus.PAYMENT_CONFIRMED) - # FIXME: redirect to payment success page return Response(new_detailed_response(status.HTTP_200_OK, "Payment verified successfully", payment.pk)) else: payment.update_payment_status(Payment.PaymentStatus.PAYMENT_REJECTED)