def get_gadget_quote(module_data): client = insurance.Client() if 'model' in module_data: module_data['model_name'] = module_data['model'] del module_data['model'] quote = insurance.Quotes(client) quote = quote.create(module_data) return quote
from wsgiref.simple_server import make_server from pyramid.config import Configurator from pyramid.response import Response from root import insurance from os import environ as env import json client = insurance.Client() policy_holder = { "id": { "number": "6801015800084", "type": "id", "country": "ZA" }, "first_name": "John", "last_name": "Smith", "date_of_birth": "19950101", "email": "*****@*****.**", "cellphone": { "country": "ZA", "number": "0718822882" } } application = { "quote_package_id": "2c9a2297-5532-4f35-bbd1-48762934602f", "monthly_premium": 12340, "serial_number": "1234567789" }
def get_policies(policyholder_id): client = insurance.Client() policyholder = client.policyholders.get(policyholder_id) return policyholder['policy_ids']
def issue_policy(application_id): client = insurance.Client() return client.policies.issue(application_id)
def get_phone_brands(): client = insurance.Client() return client.gadgets.list_phone_brands()
def create_application(policyholder_id, quote_id, amount, serial_number): client = insurance.Client() return client.applications.create(policyholder_id, quote_id, amount, serial_number)
def cancel_policy(policy_id, reason): client = insurance.Client() client.policies.cancel(policy_id, reason)
def get_policy(policy_id): client = insurance.Client() return client.policies.get(policy_id)