.NET SDK for connecting with Acrosure Insurance Gateway
Install via Install-Package :
Install-Package acrosure-dotnet-sdk
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>")
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.
Get application with specified id.
JObject application = AcrosureClient.Application.Get("<application_id>").Result;
or
JObject application = await AcrosureClient.Application.Get("<application_id>");
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 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 current application available packages.
JObject packages = AcrosureClient.Application.GetPackages(
"<application_id>"
).Result;
or
JObject packages = await AcrosureClient.Application.GetPackages(
"<application_id>"
);
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 selected package of current application.
JObject currentPackage = AcrosureClient.Application.GetPackage(
"<application_id>"
).Result;
or
JObject currentPackage = await AcrosureClient.Application.GetPackage(
"<application_id>"
);
Submit current application.
JObject submittedApplication = AcrosureClient.Application.Submit(
"<application_id>"
).Result;
or
JObject submittedApplication = await AcrosureClient.Application.Submit(
"<application_id>"
);
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 your applications .
JObject applications = AcrosureClient.Application.List().Result;
or
JObject applications = await AcrosureClient.Application.List();
Get product with specified id.
JObject product = await AcrosureClient.Product.Get("<product_id>");
List your products.
JObject products = AcrosureClient.Product.List().Result;
or
JObject products = await AcrosureClient.Product.List();
Get policy with specified id.
JObject policy = AcrosureClient.policy.Get("<policy_id>").Result;
or
JObject policy = await AcrosureClient.policy.Get("<policy_id>");
List your policies .
JObject policies = await AcrosureClient.policy.List().Result;
or
JObject policies = await AcrosureClient.policy.List();
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>']
}");
Get current team information.
const teamInfo = AcrosureClient.Team.getInfo().Result;
or
const teamInfo = await AcrosureClient.Team.getInfo();
Verify webhook signature by specify signature and raw data string. (Only Node.js environment)
bool isSignatureValid = AcrosureClient.verifySignature(
"<signature>",
@"{'data':'<raw_data>'}"
);
Please refer to this document for AcrosureClient usage.
And refer to Acrosure API Document for more details on Acrosure API.
/applications/get
/applications/list
/applications/create
/applications/update
/applications/get-packages
/applications/get-package
/applications/select-package
/applications/submit
/applications/confirm
/products/get
/products/list
/policies/get
/policies/list
/data/get
/teams/get-info