def create_customer(): try: customer = Customer.parse(request.json) except ValueError as e: raise ApiError(str(e), 400) try: customer = customer.create() except Exception as e: raise ApiError(str(e), 500) admin_audit_trail.send(current_app._get_current_object(), event='customer-created', message='', user=g.login, customers=g.customers, scopes=g.scopes, resource_id=customer.id, type='customer', request=request) if customer: return jsonify(status='ok', id=customer.id, customer=customer.serialize), 201 else: raise ApiError('create customer lookup failed', 500)
def create_customer(): try: customer = Customer.parse(request.json) except ValueError as e: raise ApiError(str(e), 400) try: customer = customer.create() except Exception as e: raise ApiError(str(e), 500) if customer: return jsonify(status="ok", id=customer.id, customer=customer.serialize), 201 else: raise ApiError("create customer lookup failed", 500)
def create_customer(): try: customer = Customer.parse(request.json) except ValueError as e: raise ApiError(str(e), 400) try: customer = customer.create() except Exception as e: raise ApiError(str(e), 500) if customer: return jsonify(status="ok", id=customer.id, customer=customer.serialize), 201 else: raise ApiError("create customer lookup failed", 500)
def create_customer(): try: customer = Customer.parse(request.json) except ValueError as e: raise ApiError(str(e), 400) try: customer = customer.create() except Exception as e: raise ApiError(str(e), 500) admin_audit_trail.send(current_app._get_current_object(), event='customer-created', message='', user=g.login, customers=g.customers, scopes=g.scopes, resource_id=customer.id, type='customer', request=request) if customer: return jsonify(status='ok', id=customer.id, customer=customer.serialize), 201 else: raise ApiError('create customer lookup failed', 500)