35 lines
913 B
Python
35 lines
913 B
Python
# -*- coding: utf-8 -*-
|
|
#
|
|
# ITerativ GmbH
|
|
# http://www.iterativ.ch/
|
|
#
|
|
# Copyright (c) 2020 ITerativ GmbH. All rights reserved.
|
|
#
|
|
# Created on 25.02.20
|
|
# @author: chrigu <christian.cueni@iterativ.ch>
|
|
import json
|
|
|
|
from django.http import HttpResponse
|
|
from django.views import View
|
|
|
|
from core.hep_client import HepClient, HepClientException
|
|
|
|
|
|
class RegistrationProxyView(View):
|
|
|
|
def post(self, request, *args, **kwargs):
|
|
hep_client = HepClient()
|
|
data = json.loads(request.body)
|
|
data['group_id'] = 5
|
|
|
|
try:
|
|
hep_data = hep_client.customer_create(data)
|
|
except HepClientException as e:
|
|
return HttpResponse(json.dumps(e.args[1]), status=e.args[0], content_type='application/json')
|
|
|
|
response_data = hep_data.copy()
|
|
del response_data['confirmation']
|
|
|
|
return HttpResponse(json.dumps(response_data), content_type='application/json')
|
|
|