from django.http import JsonResponse, HttpResponseBadRequest
from django.views.decorators.http import require_POST
from django.views.decorators.csrf import csrf_exempt
import json

@require_POST
@csrf_exempt
def calculate(request):
    params = json.loads(request.body)
    savings_amount = params.get('savingsAmount', None)
    interest_rate = params.get('interestRate', None)

    if savings_amount is None or interest_rate is None:
        return HttpResponseBadRequest('Required parameters are not provided')

    return JsonResponse({'result': 1000})