Skip to content

Acrosure/acrosure-dotnet-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

acrosure-dotnet-sdk

Acrosure

.NET SDK for connecting with Acrosure Insurance Gateway

Installation

Install via Install-Package :

Install-Package acrosure-dotnet-sdk

Getting Started

Import Acrosure into your project.

using Acrosure;

Instantiate with an API key from Acrosure Dashboard.

If you're using this on client-side, DO NOT use your secret token.

AcrosureClient AcrosureClient  = new AcrosureClient("<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",
  ...
}

AcrosureClient will return in Json.NET

Instantiate with Json.NET from Json.NET.

Application

Get

Get application with specified id.

JObject application = AcrosureClient.Application.Get("<application_id>").Result;

or

JObject application = await AcrosureClient.Application.Get("<application_id>");

Create

Create an application.

JObject createdApplication = AcrosureClient.Application.Create(@"{
  productId: '<product_id>', // required
  basic_data: {},
  package_options: {},
  additional_data: {},
  package_code: '<package_code>',
  attachments: []
}").Result;

or

JObject createdApplication = await AcrosureClient.Application.Create(@"{
  productId: '<product_id>', // required
  basic_data: {},
  package_options: {},
  additional_data: {},
  package_code: '<package_code>',
  attachments: []
}");

Update

Update an application.

JObject updatedApplication = AcrosureClient.Application.Update(@"{
  application_id: '<application_id>', // required
  basic_data: {},
  package_options: {},
  additional_data: {},
  package_code: '<package_code>',
  attachments: []
}").Result;

or

JObject updatedApplication = await AcrosureClient.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.

JObject packages = AcrosureClient.Application.GetPackages(
  "<application_id>"
).Result;

or

JObject packages = await AcrosureClient.Application.GetPackages(
  "<application_id>"
);

Select package

Select package for current application.

JObject updatedApplication =  AcrosureClient.Application.selectPackage({
  application_id: "<application_id>",
  package_code: "<package_code>"
}).Result;

or

JObject updatedApplication = await AcrosureClient.Application.selectPackage({
  application_id: "<application_id>",
  package_code: "<package_code>"
});

Get package

Get selected package of current application.

JObject currentPackage = AcrosureClient.Application.GetPackage(
  "<application_id>"
).Result;

or

JObject currentPackage = await AcrosureClient.Application.GetPackage(
  "<application_id>"
);

Submit

Submit current application.

JObject submittedApplication = AcrosureClient.Application.Submit(
  "<application_id>"
).Result;

or

JObject submittedApplication = await AcrosureClient.Application.Submit(
  "<application_id>"
);

Confirm

Confirm current application.

This function needs secret API key.

JObject confirmedApplication = await AcrosureClient.Application.Confirm(
  "<application_id>"
).Result;

or

JObject confirmedApplication = await AcrosureClient.Application.Confirm(
  "<application_id>"
);

List

List your applications .

JObject applications = AcrosureClient.Application.List().Result;

or

JObject applications = await AcrosureClient.Application.List();

Product

Get

Get product with specified id.

JObject product = await AcrosureClient.Product.Get("<product_id>");

List

List your products.

JObject products = AcrosureClient.Product.List().Result;

or

JObject products = await AcrosureClient.Product.List();

Policy

Get

Get policy with specified id.

JObject policy = AcrosureClient.policy.Get("<policy_id>").Result;

or

JObject policy = await AcrosureClient.policy.Get("<policy_id>");

List

List your policies .

JObject policies = await AcrosureClient.policy.List().Result;

or

JObject policies = await AcrosureClient.policy.List();

Data

Get

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

// Without dependencies
JObject values = AcrosureClient.Data.Get(@"{
  handler: "<some_handler>"
}").Result;

// With dependencies
JObject values = AcrosureClient.Data.Get(@"{
  handler: '<some_handler>',
  dependencies: ['<dependency_1>', '<dependency_2>']
}").Result;

or

// Without dependencies
JObject values = await AcrosureClient.Data.Get(@"{
  handler: "<some_handler>"
}");

// With dependencies
JObject values = await AcrosureClient.Data.Get(@"{
  handler: '<some_handler>',
  dependencies: ['<dependency_1>', '<dependency_2>']
}");

Team

Get info

Get current team information.

const teamInfo = AcrosureClient.Team.getInfo().Result;

or

const teamInfo = await AcrosureClient.Team.getInfo();

Other functionality

Verify webhook signature

Verify webhook signature by specify signature and raw data string. (Only Node.js environment)

bool isSignatureValid = AcrosureClient.verifySignature(
  "<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

Product

/products/get
/products/list

Policy

/policies/get
/policies/list

Data

/data/get

Team

/teams/get-info

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages