Download the PHP package katsana/insurance-sdk-php without Composer
On this page you can find all versions of the php package katsana/insurance-sdk-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download katsana/insurance-sdk-php
More information about katsana/insurance-sdk-php
Files in katsana/insurance-sdk-php
Package insurance-sdk-php
Short Description KATSANA Insurance Renewal SDK for PHP
License BSD-3-Clause
Informations about the package insurance-sdk-php
KATSANA Insurance Renewal SDK for PHP
- Installation
- Getting Started
- Creating Client
- Handling Response
- Using the API
- Usages
- Get List of Insurers
- Create Draft Quotation
- Update Quotation
- Save Vehicle Information
- Make Payment
Installation
To install through composer, simply put the following in your composer.json
file:
Quick Installation
Above installation can also be simplify by using the following command:
composer require "php-http/guzzle6-adapter" "katsana/insurance-sdk-php=^0.2"
HTTP Adapter
Instead of utilizing php-http/guzzle6-adapter
you might want to use any other adapter that implements php-http/client-implementation
. Check Clients & Adapters for PHP-HTTP.
Getting Started
Creating Client
You can start by creating a client by using the following code (which uses php-http/guzzle6-adapter
and php-http/discovery
to automatically pick available adapter installed via composer):
Authenticate Using Client Credential Grant
Once you initiate the client, you need to get an Access Token before using the services. All you need to do is:
Additionally, if you already have an Access Token, you can initiate a client with existing Access Token. You can initiate the client using the following code:
Handling Response
Every API request using the API would return an instance of Katsana\Insurance\Response
which can fallback to \Psr\Http\Message\ResponseInterface
, this allow developer to further inspect the response.
As an example:
Getting the Response
You can get the raw response using the following:
However we also create a method to parse the return JSON string to array.
Checking the Response HTTP Status
You can get the response status code via:
Checking the Response Header
You can also check the response header via the following code:
Using the API
There are two way to request an API:
Using API Resolver
This method allow you as the developer to automatically select the current selected API version without having to modify the code when KATSANA release new API version.
This would resolve an instance of
Katsana\Insurance\One\Insurer
class (asv1
would resolve toOne
namespace).
Explicit API Resolver
This method allow you to have more control on which version to be used.
Usages
Get List of Insurers
Use this API to get a complete list of available Insurers.
Code Example
Response Parameters
Parameters | Type | Description |
---|---|---|
country_code |
string | The country code, e.g: MY |
name |
string | Insurer name |
partner |
boolean | Whether we can make renewal |
product_code |
string|null | Product code |
Response Sample
Create Draft Quotation
Use this API to create a motor insurance renewal quotation draft.
Code Example
Request Parameters
Parameter | Type | Rule | Description |
---|---|---|---|
$plateNumber |
string | required | The vehicle license plate. |
$insurerCode |
string | required | Insurer's Product Code. |
$ownerInformation['fullname'] |
string | required | Driver's fullname. |
$ownerInformation['birthdate'] |
string | required | Driver's birth date in Y-m-d format. |
$ownerInformation['email'] |
string | required | Driver's e-mail address. |
$ownerInformation['nric'] |
string | required | Driver's National Registration Identity Card (NRIC) ID. |
$ownerInformation['phone_no'] |
string | required | Driver's phone number. |
$ownerInformation['postcode'] |
string | required | Driver's current address postcode. |
$insuranceInformation['ended_at'] |
string | required | Current vehicle insurance expiry date in Y-m-d format. |
$vehicleInformation['maker'] |
string | optional | Vehicle's maker. E.g Proton , Perodua , Honda etc. |
$vehicleInformation['model'] |
string | optional | Vehicle's maker. E.g Iriz , Persona , MyVi , Civic , Vios etc. |
$vehicleInformation['year_manufactured'] |
integer | optional | Vehicle's year of manufactured. |
$vehicleInformation['chasis_number'] |
string | optional | Vehicle's chassis number. |
$vehicleInformation['engine_number'] |
string | optional | Vehicle's engine number. |
$sumCovered |
float | optional | Total sum covered for the vehicle in MYR . |
$addons['windscreen'] |
float | optional | Total covered for windscreen coverage. |
$addons['flood'] |
boolean | optional | Enable basic flood coverage. |
$addons['extended_flood'] |
boolean | optional | Enable extended flood coverage. |
$addons['under_repair_compensation'] |
boolean | optional | ... |
$addons['passenger_negligence_liability'] |
boolean | optional | ... |
Response Example
Update Quotation
Use this API to update draft quotation for motor insurance renewal.
Code Example
Request Parameters
Parameter | Type | Rule | Description |
---|---|---|---|
$plateNumber |
string | required | The vehicle license plate. |
$insurerCode |
string | required | Insurer's Product Code. |
$sumCovered |
float | required | Total sum covered for the vehicle in MYR . |
$addons['windscreen'] |
float | optional | Total covered for windscreen coverage. |
$addons['flood'] |
boolean | optional | Enable basic flood coverage. |
$addons['extended_flood'] |
boolean | optional | Enable extended flood coverage. |
$addons['under_repair_compensation'] |
boolean | optional | ... |
$addons['passenger_negligence_liability'] |
boolean | optional | ... |
Response Example
Save Vehicle Information
Use this API to store and update Vehicle information.
Code Example
Request Parameters
Parameter | Type | Rule | Description |
---|---|---|---|
$plateNumber |
string | required | The vehicle license plate. |
$ownerInformation['fullname'] |
string | required | Driver's fullname. |
$ownerInformation['birthdate'] |
string | required | Driver's birth date in Y-m-d format. |
$ownerInformation['email'] |
string | required | Driver's e-mail address. |
$ownerInformation['nric'] |
string | required | Driver's National Registration Identity Card (NRIC) ID. |
$ownerInformation['phone_no'] |
string | required | Driver's phone number. |
$ownerInformation['postcode'] |
string | required | Driver's current address postcode. |
$insuranceInformation['ended_at'] |
string | required | Current vehicle insurance expiry date in Y-m-d format. |
$vehicleInformation['maker'] |
string | required | Vehicle's maker. E.g Proton , Perodua , Honda etc. |
$vehicleInformation['model'] |
string | required | Vehicle's maker. E.g Iriz , Persona , MyVi , Civic , Vios etc. |
$vehicleInformation['year_manufactured'] |
integer | required | Vehicle's year of manufactured. |
$vehicleInformation['chasis_number'] |
string | optional | Vehicle's chassis number. |
$vehicleInformation['engine_number'] |
string | optional | Vehicle's engine number. |
Response Example
Make Payment
Use this API to make a payment for Insurance Renewal.
Code Example
Request Parameters
Parameter | Type | Rule | Description |
---|---|---|---|
$plateNumber |
string | required | The vehicle license plate. |
$insurerCode |
string | required | Insurer's Product Code. |
$sumCovered |
float | required | Total sum covered for the vehicle in MYR . |
$addons['windscreen'] |
float | optional | Total covered for windscreen coverage. |
$addons['flood'] |
boolean | optional | Enable basic flood coverage. |
$addons['extended_flood'] |
boolean | optional | Enable extended flood coverage. |
$addons['under_repair_compensation'] |
boolean | optional | ... |
$addons['passenger_negligence_liability'] |
boolean | optional | ... |
$declaration['pds'] |
boolean | required | ... |
$declaration['ind'] |
boolean | required | ... |
$declaration['pdpa'] |
boolean | required | Required to be true to indicate user has agree to Insurance Renewal PDPA. |
$declaration['lapse'] |
boolean | optional | Required to be true only if insurance has been expired but within the 90 days lapse duration! |
Insurance renewal is not available for insurance that has been expired over 90 days!
Response Example
Notes:
pay_url
is the URL user must be redirected to, to start payment process.- Once user has completed payment, they will be redirected to
completion_url
. Mobile application can listen to this URL to detect end of payment process.