Skip to content

Latest commit

 

History

History
285 lines (194 loc) · 4.49 KB

README.md

File metadata and controls

285 lines (194 loc) · 4.49 KB

Acrosure Python SDK

Acrosure

Python version 2 and 3 SDK for connecting with Acrosure Insurance Gateway

Installation

Install via pip:

pip install acrosure_sdk

Requirements

  • Python 2.7.1+
  • requests library

Getting Started

Import AcrosureClient into your project.

from acrosure_sdk import AcrosureClient

Instantiate with an API key from Acrosure Dashboard.

acrosure_client = AcrosureClient(token = '<your_api_key>')

Basic Usage

AcrosureClient provides several objects such as application, product, etc. and associated APIs.

Any data will be inside an response object with data key, along with meta data, such as:

{
  "data": { ... },
  "status": "ok",
  ...
}

Application

Get

Get application with specified id.

application = acrosure_client.application.get('<application_id>')

Create

Create an application.

created_application = acrosure_client.application.create(
  productId = '<product_id>', # required
  basic_data = {},
  package_options = {},
  additional_data = {},
  package_code = '<package_code>',
  attachments = []
)

Update

Update an application.

updatedApplication = acrosure_client.application.update(
  application_id = '<application_id>', # required
  basic_data = {},
  package_options = {},
  additional_data = {},
  package_code = '<package_code>',
  attachments = []
)

Get packages

Get current application available packages.

packages = acrosure_client.application.get_packages(
  '<application_id>'
)

Select package

Select package for current application.

updated_application = acrosure_client.application.select_package(
  application_id = '<application_id>',
  package_code = '<package_code>'
)

Get package

Get selected package of current application.

current_package = acrosure_client.application.get_package(
  '<application_id>'
)

Get 2C2P hash

Get 2C2P hash.

returned_hash = acrosure_client.application.get_2c2p_hash(
  application_id = '<application_id>',
  args = '<arguments>'
)

Submit

Submit current application.

submitted_application = acrosure_client.application.submit(
  '<application_id>'
)

Confirm

Confirm current application.

This function needs secret API key.

confirmed_application = acrosure_client.application.confirm(
  '<application_id>'
)

List

List your applications (with or without query).

applications = acrosure_client.application.list(query)

Product

Get

Get product with specified id.

product = acrosure_client.product.get('<product_id>')

List

List your products (with or without query).

products = acrosure_client.product.list(query)

Policy

Get

Get policy with specified id.

policy = acrosure_client.policy.get('<policy_id>')

List

List your policies (with or without query).

policies = acrosure_client.policy.list(query)

Data

Get

Get values for a handler (with or without dependencies, please refer to Acrosure API Document).

// Without dependencies
values = acrosure_client.data.get(
  handler = '<some_handler>'
)

// With dependencies
values = acrosure_client.data.get(
  handler = '<some_handler>',
  dependencies = ['<dependency_1>', '<dependency_2>']
)

Team

Get info

Get current team information.

team_info = acrosure_client.team.get_info()

Other functionality

Verify webhook signature

Verify webhook signature by specify signature and raw data string

is_signature_valid = acrosure_client.verify_webhook(
  signature = '<signature>',
  data = '<raw_data>'
)

Advanced Usage

Please refer to this document for AcrosureClient usage.

And refer to Acrosure API Document for more details on Acrosure API.

Associated Acrosure API endpoints

Application

/applications/get
/applications/list
/applications/create
/applications/update
/applications/get-packages
/applications/get-package
/applications/select-package
/applications/submit
/applications/confirm
/applications/get-hash

Product

/products/get
/products/list

Policy

/policies/get
/policies/list

Data

/data/get

Team

/teams/get-info