### Example: Terminate Policy (Go) Source: https://developers.ppibroker.com/ Example demonstrating how to terminate a policy in Go. It shows parameter preparation and printing the policy and any errors. ```go import( pasarpolis_models "gitlab.com/pasarpolis/go-sdk.v2/models" "fmt" ) params :=map[string]interface{}{} params["execution_date"] = ["2020-10-12 12:30:00"] params["reason"] = ["wring policy"] params["user"] = ["johndeo@gmail.com"] policy, error := pasarpolis_models.TerminatePolicy("123454321123", params) fmt.Println(policy) ``` -------------------------------- ### Example: Create Aggregate Policy (Python) Source: https://developers.ppibroker.com/ This Python example shows how to create aggregate policies by preparing a list of parameter dictionaries. The result is printed. ```python from pasarpolis import Policy params1 = {} params1["name"]="Jacob" params1["email_id"]="john.doe@example.com" params1["phone_no"]="+6200000000000" params1["reference_id"]="R1" params1["make"]="Apple" params1["model"]="iPhone X" params1["purchase_date"]="2018-12-20" params1["purchase_value"]=32000.00 params1["last_property"]=true params2 = {} params2["name"]="Jason" params2["email_id"]="john.doe@example.com" params2["phone_no"]="+6200000000000" params2["reference_id"]="R1" params2["make"]="Apple" params2["model"]="iPhone X" params2["purchase_date"]="2018-12-20" params2["purchase_value"]=32000.00 params2["last_property"]=true param_list = [params1, params2] policies = Policy.create_aggregate_policy("travel-protection", param_list); print(policies) ``` -------------------------------- ### Example: Create Aggregate Policy (Go) Source: https://developers.ppibroker.com/ This Go example shows how to prepare parameters for creating aggregate policies. Note the use of map[string]interface{} for parameters. ```go import( pasarpolis_models "gitlab.com/pasarpolis/go-sdk.v2/models" "fmt" ) var params []interface{} params1 := map[string]interface{}{}; params1["name"]="Jacob" params1["email_id"]="john.doe@example.com" params1["phone_no"]="+6200000000000" ``` -------------------------------- ### Example: Terminate Policy (Python) Source: https://developers.ppibroker.com/ Example demonstrating how to terminate a policy with a specific reference ID and parameters. The output will be printed. ```python from pasarpolis import Policy params = {} params["execution_date"] = ["2020-10-12 12:30:00"] params["reason"] = ["wring policy"] params["user"] = ["johndeo@gmail.com"] ref_id = "d77d436ad9485b86b8a0c18c3d2f70f77a10c43d" policy = Policy.terminate_policy(ref_id, params) print(policy) ``` -------------------------------- ### Example: Cancel Policy (Ruby) Source: https://developers.ppibroker.com/ Example demonstrating how to cancel a policy with specific parameters. The output will be printed to the console. ```ruby require "pasarpolis_sdk" params = {} params["execution_date"] = ["2020-10-12 12:30:00"] params["reason"] = ["wring policy"] params["user"] = ["johndeo@gmail.com"] policy = Pasarpolis::Policy.cancel_policy("xxxxx-xxxxx-xxxxxxxxxx", params) puts policy ``` -------------------------------- ### Example: Terminate Policy (Java) Source: https://developers.ppibroker.com/ Example demonstrating how to terminate a policy in Java. It includes setting parameters in a HashMap and handling potential exceptions. ```java import java.util.HashMap; import com.pasarpolis.sdk.models.Policy; try { params.put ("execution_date", "2020-10-12 15:13:14") params.put ("user", "johndeo@gmail.com") params.put ("reason", "Wrong policy") params.put ("execution_date", "2020-10-12 15:13:14") Policy policies = Policy.terminatePolicy("1234-xxxx-xxxx", params); System.out.println(policy); }catch(Exception e) { // Error Handling part } ``` -------------------------------- ### Example: Create Aggregate Policy (Ruby) Source: https://developers.ppibroker.com/ This example demonstrates creating multiple aggregate policies in Ruby by passing a list of parameters. The output is printed to the console. ```ruby require "pasarpolis_sdk" params1 = {} params1["name"]="Jacob" params1["email_id"]="john.doe@example.com" params1["phone_no"]="+6200000000000" params1["reference_id"]="R1" params1["make"]="Apple" params1["model"]="iPhone X" params1["purchase_date"]="2018-12-20" params1["purchase_value"]=32000.00 params2 = {} params2["name"]="Jason" params2["email_id"]="john.doe@example.com" params2["phone_no"]="+6200000000000" params2["reference_id"]="R1" params2["make"]="Apple" params2["model"]="iPhone X" params2["purchase_date"]="2018-12-20" params2["purchase_value"]=32000.00 param_list = [params1, params2] policies = Policy.create_aggregate_policy("travel-protection", param_list); puts policies ``` -------------------------------- ### Example: Create Aggregate Policy (Java) Source: https://developers.ppibroker.com/ This Java example demonstrates creating aggregate policies using ArrayList of HashMaps. It includes basic error handling. ```java import java.util.HashMap; import java.util.ArrayList; import com.pasarpolis.sdk.models.Policy; try { ArrayList > params = new ArrayList >(); HashMap params1 = new HashMap(); params1.put("name","John Doe"); params1.put("email_id","john.doe@example.com"); params1.put("phone_no","+6200000000000"); params1.put("reference_id","R1"); params1.put("make","Apple"); params1.put("model","iPhone X"); params1.put("purchase_date","2018-12-20"); params1.put("purchase_value",32000.00); HashMap params2 = new HashMap(); params2.put("name","John Doe"); params2.put("email_id","john.doe@example.com"); params2.put("phone_no","+6200000000000"); params2.put("reference_id","R2"); params2.put("make","Apple"); params2.put("model","iPhone X"); params2.put("purchase_date","2018-12-20"); params2.put("purchase_value",32000.00); params.add(params1); params.add(params2); Policy[] policy = Policy.createAggregatePolicy("gadget-protection", params); System.out.println(policy); }catch(Exception e) { // Error Handling part } ``` -------------------------------- ### Example: Terminate Policy (Node.js) Source: https://developers.ppibroker.com/ Example demonstrating how to terminate a policy using the Node.js SDK. It initializes the client, defines parameters, and handles the promise response. ```javascript const sdk = require('pasarpolis-sdk-nodejs') const client = sdk.init(, , ) const refID = '456712345679876qwertg23' const params {   "execution_date" : "2020-09-01 14:12:12",   "user" : "johndeo@example.com",   "reason" : "wrong policy created", const cancelPolicy = client.terminatePolicy(refID, params) /** It will give response as promise */ cancelPolicy .then(response => console.log(response)) .catch(err => console.log(err)) ``` -------------------------------- ### Example: Cancel Policy (PHP) Source: https://developers.ppibroker.com/ Example demonstrating how to cancel a policy in PHP. It includes setting parameters and calling the cancel_policy method. ```php require_once('pasarpolis/policy.php') $policyObj = new policy($params); $params = Array(); params["execution_date"] = ["2020-10-12 12:30:00"] params["reason"] = ["wring policy"] params["user"] = ["johndeo@gmail.com"] $ref_id = "d77d436ad9485b86b8a0c18c3d2f70f77a10c43d" $policies = Policy -> cancel_policy($ref_id, $params, $clientObj); print_r($policies); ``` -------------------------------- ### Configure and Create Policy (Java) Source: https://developers.ppibroker.com/ Java example for configuring and creating a policy. Ensure the Policy class and HashMap are imported. Includes basic error handling. ```java import java.util.HashMap; import com.pasarpolis.sdk.models.Policy; try { HashMap params = new HashMap(); params.put("name","John Doe"); params.put("email_id","john.doe@example.com"); params.put("phone_no","+6200000000000"); params.put("reference_id","R1"); params.put("make","Apple"); params.put("model","iPhone X"); params.put("purchase_date","2018-12-20"); params.put("purchase_value",32000.00); Policy policy = Policy.configCreatePolicy("gadget-protection", params); System.out.println(policy.referenceNumber); System.out.println(policy.applicationNumber); System.out.println(policy.premium); }catch(Exception e) { // Error Handling part } ``` -------------------------------- ### Configure and Create Policy (Node.js) Source: https://developers.ppibroker.com/ Node.js example for creating a policy. Requires initializing the SDK with partner credentials and host. Handles response as a promise. ```javascript const sdk = require('pasarpolis-sdk-nodejs') const client = sdk.init(, , ) const packageName = 'phone-protection' const params = { "name": "John Doe", "email_id": "john.doe@example.com", "phone_no": "+6200000000000", "reference_id": "R1", "make": "Apple", "model": "iPhone X", "purchase_date": "2018-12-20", "purchase_value": 32000.00 } const configCreatePolicy = client.configCreatePolicy(packageName, params) /** It will give response as promise */ configCreatePolicy .then(response => console.log(response)) .catch(err => console.log(err)) ``` -------------------------------- ### Example Valid Request Response Source: https://developers.ppibroker.com/ This is an example of a successful response when validating an aggregate policy. ```json {   "policies":{     "INS12AQYF40392-973-1":{       "application_no":"APP-000067265",       "ref":"259a06539a4e9d75c39ec0e1b292077fee17c840",       "premium":48000,     },     "INS12AQYF40392-974-1":{       "application_no":"APP-000067265",       "ref":"259a06539a4e9d75c39ec0e1b292077fee17c840",       "premium":48000,     }   } } ``` -------------------------------- ### Basic Policy Creation Signatures Source: https://developers.ppibroker.com/ Provides signature examples for creating policies across different languages. ```ruby policy = Pasarpolis::Policy.config_create_policy(, params); ``` ```python from pasarpolis import Policy policy = Policy.config_create_policy(, params); ``` ```java import com.pasarpolis.sdk.models.Policy; Policy policy = Policy.configCreatePolicy(, params); ``` ```go import( pasarpolis_models "gitlab.com/pasarpolis/go-sdk.v2/models" "fmt" ) policy, error := pasarpolis_models.CreatePolicy(, params); ``` ```plaintext Policy.config_create_policy(, params); ``` ```php require_once('pasarpolis/policy.php') $policyObj = new policy($params); $policy = $policyObj->config_create_policy(, $params, $clientObj); ``` -------------------------------- ### Create Aggregate Policy (Go) Source: https://developers.ppibroker.com/ Example of creating an aggregate policy using the Go SDK. This function allows for the creation of policies with multiple parameters. ```APIDOC ## Create Aggregate Policy (Go) ### Description This Go code snippet demonstrates how to create an aggregate policy using the `pasarpolis_models.CreateAggregatePolicy` function. It shows how to define and pass policy parameters. ### Function Signature `policy, error := pasarpolis_models.CreateAggregatePolicy(packageName string, params []map[string]interface{})` ### Parameters - `packageName` (string): The name of the insurance package (e.g., "gadget-rental-protection"). - `params` ([]map[string]interface{}): A slice of maps, where each map represents a policy with its associated details. ### Request Example ```go params1 := map[string]interface{}{ "reference_id": "R1", "make": "Apple", "model": "iPhone X", "purchase_date": "2018-12-20", "purchase_value": 32000.00 } params2 := map[string]interface{}{ "name": "Jacob2", "email_id": "john.doe@example.com", "phone_no": "+6200000000000", "reference_id": "R1", "make": "Apple", "model": "iPhone X", "purchase_date": "2018-12-20", "purchase_value": 32000.00 } params := []map[string]interface{}{} params = append(params, params1) params = append(params, params2) policy, error := pasarpolis_models.CreateAggregatePolicy("gadget-rental-protection", params) fmt.Println(policy) ``` ### Response - `policy`: The created policy object. - `error`: An error object if the creation failed. ``` -------------------------------- ### Get Policy Status (Node.js) Source: https://developers.ppibroker.com/ Initialize the SDK client with partner credentials and host, then call `client.getPolicyStatus` with a reference number. The response is handled as a promise. ```javascript const sdk = require('pasarpolis-sdk-nodejs') const client = sdk.init(, , ) const getPolicyStatus = client.getPolicyStatus('48fc2801e487af79ef311621f63e4133c') /** It will give response as promise */ getPolicyStatus .then(response => console.log(response)) .catch(err => console.log(err)) ``` -------------------------------- ### Validate Policy with PHP Source: https://developers.ppibroker.com/ Validate policy configurations in PHP. This example demonstrates initializing a policy object and calling the `config_validate_policy` method. ```php require_once('pasarpolis/policy.php') $policyObj = new policy($params); $policy = $policyObj->config_validate_policy(, $params, $clientObj); ``` ```php require_once('pasarpolis/policy.php') $policyObj = new policy($params); $params = Array(); $params["name"] = "Jacob"; $params["email_id"] = "john.doe@example.com" $params["phone_no"] = "+6200000000000" $params["reference_id"] = "R1" $params["make"] = "Apple" $params["model"] = "iPhone X" $params["purchase_date"] = "2018-12-20" $params["purchase_value"] = 32000.00; $params["last_property"] = true; ``` -------------------------------- ### Create Claim With Documents API Response Example Source: https://developers.ppibroker.com/ This is a sample response from the Create Claim With Documents API, confirming the claim creation and its current status. ```json { "claim_number": "KLM-2008000011", "status": "document_received" } ``` -------------------------------- ### Create Policy V1 Response Example Source: https://developers.ppibroker.com/ This is a sample response when a policy is successfully created using the V1 API. It includes the application number and a reference ID. ```json { "application_no":"APP-000725168", "premium":50000, "ref":"d72cf8436c06968e9c60ee98bd6643062497cf36" } ``` -------------------------------- ### Aggregate Policy Response Structure Source: https://developers.ppibroker.com/ This example shows the structure of a response containing policy details, including application number and reference. ```json { "policies":   { '2c104b94-3705-45d2-bd1e-test1':     {       "application_no":"APP-000067265",       "ref":"259a06539a4e9d75c39ec0e1b292077fee17c840",     },   { '2c104b94-3705-45d2-bd1e-test2':     {       "application_no":"APP-000067265",       "ref":"259a06539a4e9d75c39ec0e1b292077fee17c840",     }   } } ``` -------------------------------- ### Create Aggregate Policy in Node.js Source: https://developers.ppibroker.com/ This Node.js example demonstrates creating an aggregate policy for travel protection. Initialize the SDK with your partner credentials and host. The response is handled as a promise. ```javascript const sdk = require('pasarpolis-sdk-nodejs') const client = sdk.init(, , ) const packageName = 'travel-protection-ultra' const params = [ {   "reference_id": "2c104b94-3705-45d2-bd1e-test1",   "policy_insured"{     "name": "John Doe",     "phone_no": "+6200000000000",     "email": "abc@gmail.com",     "gender": "Male",     "identity_type": 1,     "identity_number": "123456789111"   },   "flight_information"[     {       "type": 0,       "airport_code": "FGK",       "flight_code": "JT-341",       "departure_date": "2019-01-01 04:30:00",       "destination_airport_code": "KUL",       "pnr": "187651"     },     {       "type": 1,       "airport_code": "FGK",       "flight_code": "QG-342",       "departure_date": "2019-01-01 13:23:00",       "destination_airport_code": "DEL",       "pnr": "187659"     },   ],   "booking_code": "ABC123455"   "travel_type": 1   "transit_type": 1   "travel_destination": 1   "trip_reason": 1   "note": ""   "package_id": 1  }, {   "reference_id": "2c104b94-3705-45d2-bd1e-test2",   "policy_insured"{     "name": "Alice Doe",     "phone_no": "627888910121",     "email": "abc@gmail.com",     "gender": "Male",     "identity_type": 1,     "identity_number": "123456789113"   },   "flight_information"[     {       "type": 0,       "airport_code": "KJL",       "flight_code": "JT-3422",       "departure_date": "2019-01-01 04:30:00",       "destination_airport_code": "KUL",       "pnr": "187661"     },     {       "type": 1,       "airport_code": "KUL",       "flight_code": "QG-345",       "departure_date": "2019-01-01 14:23:00",       "destination_airport_code": "KLP",       "pnr": "187662"     },   ],   "booking_code": "ABC123455"   "travel_type": 1   "transit_type": 1   "travel_destination": 1   "trip_reason": 1   "note": ""   "package_id": 1 } ] const createAgrregatePolicy = client.createAggregatePolicy(packageName, params) /** It will give response as promise */ createAgrregatePolicy .then(response => {   if ( response.details !== undefined )     console.log(response.detail.errors)   else     console.log(response) }) .catch(err => console.log(err)) ``` -------------------------------- ### Create Policy V2 Request Example (Bike Protection) Source: https://developers.ppibroker.com/ Sample JSON request body for creating a policy for the 'bike-protection' product. Ensure all mandatory fields and product-specific attributes are included. ```json { "product":"phone-protection", "dob": "1992-01-23", "name": "Kaisar Wiranegara", "brand": "365566", "model": "365681", "premium": 0, "package_id": "combined", "phone_no": "+6200000000000", "reference_id": "a6f496ab-e2cc-4308-849e-50a4301ae321", "vehicle_year": 2019, "chassis_number": MH3RG5610KK003293 } ``` -------------------------------- ### Create Policy V2 Response Example Source: https://developers.ppibroker.com/ Sample JSON response body returned after a successful policy creation request via the Create Policy V2 API. ```json { "application_no":"APP-000725168", "premium":50000, "ref":"d72cf8436c06968e9c60ee98bd6643062497cf36" } ``` -------------------------------- ### Validate Policy with Go Source: https://developers.ppibroker.com/ Validate policy configurations in Go. This example shows how to use the `ConfigValidatePolicy` function from the Pasarpolis models package. ```go import( pasarpolis_models "gitlab.com/pasarpolis/go-sdk.v2/models" "fmt" ) policy, error := pasarpolis_models.ConfigCreatePolicy(, params); ``` ```go import( pasarpolis_models "gitlab.com/pasarpolis/go-sdk.v2/models" "fmt" ) params := map[string]interface{}{}; params["name"]="John Doe" params["email_id"]="john.doe@example.com" params["phone_no"]="+6200000000000" params["reference_id"]="R1" params["make"]="Apple" params["model"]="iPhone X" params["purchase_date"]="2018-12-20" params["purchase_value"]=32000.00 params["last_property"]=true policy := pasarpolis_models.ConfigValidatePolicy("gadget-rental-protection", params); fmt.Println(policy.message); ``` -------------------------------- ### Create Aggregate Policy (PHP) Source: https://developers.ppibroker.com/ Example of creating an aggregate policy using PHP. This code snippet shows how to instantiate the policy object and call the `create_aggregate_policy` method. ```APIDOC ## Create Aggregate Policy (PHP) ### Description This PHP code snippet demonstrates how to create an aggregate policy using the `Policy` class. It shows how to prepare policy parameters and call the `create_aggregate_policy` method. ### Setup ```php require_once('pasarpolis/policy.php'); // Assuming $clientObj is an initialized client object ``` ### Method `Policy::create_aggregate_policy(packageName, paramList, clientObj)` ### Parameters - `packageName` (string): The name of the insurance package (e.g., "travel-protection"). - `paramList` (Array): An array of policy parameter arrays, where each inner array represents a policy. - Each inner array can contain keys like `name`, `email_id`, `phone_no`, `reference_id`, `purchase_date`, `purchase_value`, `last_property`. - `clientObj`: The client object used for API communication. ### Request Example ```php $policyObj = new policy($params); $params1 = Array(); $params1["name"] = "Jacob"; $params1["email_id"] = "john.doe@example.com"; $params1["phone_no"] = "+6200000000000"; $params1["reference_id"] = "R1"; $params1["purchase_date"] = "2018-12-20"; $params1["purchase_value"] = 32000.00; $params1["last_property"] = true; $params2 = Array(); $params2["name"] = "Jacob"; $params2["email_id"] = "john.doe@example.com"; $params2["phone_no"] = "+6200000000000"; $params2["reference_id"] = "R1"; $params2["purchase_date"] = "2018-12-20"; $params2["purchase_value"] = 32000.00; $params2["last_property"] = true; $param_list = array ($params1, $params2); $policies = Policy::create_aggregate_policy("travel-protection", $param_list, $clientObj); ``` ### Response - `$policies`: The result of the `create_aggregate_policy` call. ``` -------------------------------- ### Create Policy V1 Request Example Source: https://developers.ppibroker.com/ Use this JSON payload to create a policy for the 'bike-protection' product. Ensure all required fields, including product-specific attributes, are included. ```json { "product":"phone-protection", "dob": "1992-01-23", "name": "Kaisar Wiranegara", "brand": "365566", "model": "365681", "premium": 0, "package_id": "combined", "phone_no": "+6200000000000", "reference_id": "a6f496ab-e2cc-4308-849e-50a4301ae321", "vehicle_year": 2019, "chassis_number": MH3RG5610KK003293 } ``` -------------------------------- ### Get Policy Status (PHP) Source: https://developers.ppibroker.com/ Instantiate the `policy` class and call the `get_policy_status` method with reference numbers and a client object. Ensure the `pasarpolis/policy.php` file is included. ```php require_once('pasarpolis/policy.php') $refs = Array("d77d436ad9485b86b8a0c18c3d2f70f77a10c43d"); $policyObj = new policy($params); $policies = Policy -> get_policy_status($refs, $clientObj); print_r($policies[0]) ``` -------------------------------- ### Benefit List API Request Example Source: https://developers.ppibroker.com/ Use this endpoint to retrieve a list of benefits applicable to a given application number. The `is_detailed` and `partial_document` flags control the amount of detail returned. ```http /api/v3/claims/benefits/list/?application_number=APP-000655580&is_detailed=true&partial_document=true ``` -------------------------------- ### Create Claim With Documents API Request Body Example Source: https://developers.ppibroker.com/ This is a sample JSON request body for the Create Claim With Documents API. It includes essential claim details and document references required for processing. ```json { "reference_number": "APP-00012339", "benefit_id": "33a73c9c-5045-4057-b0c9-98708fa168cf", "benefit_slug": "jaminan-kerusakan-total", "application_no": "APP-000578990", "created_at": "2020-06-25 01:12:34", "warning-physical-visit": "http://url" "warning-email": "http://url" "warning_letter": "http://url" "medical-invoice": "http://url" "proposed_amount": "100000000" "tax-identification-number": "http://url" "statement_letter_from_authorities": "http://url" "payment-history": "http://url" "witness_statement": "http://url" "policy-certificate-internal": "http://url" "ktp": "http://url" "credit_aggrement": "http://url" "family_certificate": "http://url" } ``` -------------------------------- ### Go: Validate Aggregate Policy Source: https://developers.ppibroker.com/ Validate aggregate policies using the `models.ValidateAggregatePolicy` function. This example shows parameter setup for the Go SDK. ```go import( pasarpolis_models "gitlab.com/pasarpolis/go-sdk.v2/models" "fmt" ) var params []interface{} params1 := map[string]interface{}{}; params1["name"]="Jacob" params1["email_id"]="john.doe@example.com" ``` -------------------------------- ### Get Policy Status (Java) Source: https://developers.ppibroker.com/ Retrieve policy status using the `getPolicyStatus` method from the `Policy` class. This example includes basic error handling with a try-catch block. ```java import com.pasarpolis.sdk.models.Policy; try { String[] refs = {"d77d436ad9485b86b8a0c18c3d2f70f77a10c43d"}); Policy[] policies = Policy.getPolicyStatus(refs); System.out.println(policies[0]); }catch(Exception e) { // Error Handling part } ``` -------------------------------- ### Configure and Create Policy (Go) Source: https://developers.ppibroker.com/ This Go snippet shows how to configure and create a policy. It requires importing the models package and fmt for printing. ```go import( pasarpolis_models "gitlab.com/pasarpolis/go-sdk.v2/models" "fmt" ) params := map[string]interface{}{}; params["name"]="John Doe" params["email_id"]="john.doe@example.com" params["phone_no"]="+6200000000000" params["reference_id"]="R1" params["make"]="Apple" params["model"]="iPhone X" params["purchase_date"]="2018-12-20" params["purchase_value"]=32000.00 params["last_property"]=true policy := pasarpolis_models.ConfigCreatePolicy("gadget-protection", params); fmt.Println(policy.referenceNumber); fmt.Println(policy.applicationNumber); fmt.Println(policy.premium); ``` -------------------------------- ### Initialize Pasarpolis Client in Python Source: https://developers.ppibroker.com/ Use this code to initialize the Pasarpolis client with your PartnerCode, PartnerSecret, and Host. ```python from pasapolis import Client Client.init(, , ) ``` -------------------------------- ### Configure and Create Policy (Python) Source: https://developers.ppibroker.com/ This Python snippet demonstrates how to configure and create a policy. The Pasarpolis library must be imported. ```python from pasarpolis import Policy params = {} params["name"]="John Doe" params["email_id"]="john.doe@example.com" params["phone_no"]="+6200000000000" params["reference_id"]="R1" params["make"]="Apple" params["model"]="iPhone X" params["purchase_date"]="2018-12-20" params["purchase_value"]=32000.00 policy = Policy.config_create_policy("gadget-protection", params); print(policy.reference_number," ") print(policy.application_number) print(policy.premium) ``` -------------------------------- ### Initialize Pasarpolis Client in PHP Source: https://developers.ppibroker.com/ Use this code to initialize the Pasarpolis client with your PartnerCode, PartnerSecret, and Host. ```php require_once('pasarpolis/client.php') $clientObj = new client(, , ) ``` -------------------------------- ### Cancellation Response Example Source: https://developers.ppibroker.com/ The cancellation API returns a JSON object containing a closure_id upon successful cancellation. ```json { "closure_id":1 } ``` -------------------------------- ### Initialize Pasarpolis SDK in Ruby Source: https://developers.ppibroker.com/ Use this code to initialize the Pasarpolis SDK with your PartnerCode, PartnerSecret, and Host. ```ruby require 'pasarpolis_sdk' PasarpolisSdk.init(, , ) ``` -------------------------------- ### Get Policy Status Source: https://developers.ppibroker.com/ Retrieves the status of policies using their reference numbers. It returns an array of Policy objects. ```APIDOC ## Get Policy Status ### Description Retrieves the status of policies by providing an array of reference numbers. Returns an array of Policy objects. ### Parameters #### Query Parameters - **ReferenceNumbers** (string array) - Required - An array of strings containing reference numbers for the policies. ### Response #### Success Response (200) - **policies** (Policy array) - An array of Policy objects, each containing detailed information about a policy. ### Policy Object Structure - **reference_number** (string) - Hexadecimal number provided by Pasarpolis for future reference. - **application_number** (string) - Number provided for future reference. - **document_url** (string) - URL for the policy document (if any). - **policy_number** (string) - Number for the policy. - **status** (string) - Current status of the policy. - **status_code** (integer) - Status code of the policy. - **issue_date** (string) - Issue date of the policy (YYYY-MM-DD h:mm:ss). - **message** (string) - Message or comments on the policy, if any. - **partner_ref** (string) - Unique reference of the policy. - **product_key** (string) - Product name of the policy. - **expiry_date** (string) - Expiry date of the policy (YYYY-MM-DD hh:mm:ss). - **activation_url** (string) - Activation URL of the policy if an activation flow is present. ### Request Example (Ruby) ```ruby require "pasarpolis_sdk" refs = ["d77d436ad9485b86b8a0c18c3d2f70f77a10c43d"] policy = Pasarpolis::Policy.get_policy_status(refs) puts policies[0] ``` ### Request Example (Python) ```python from pasarpolis import Policy refs = ["d77d436ad9485b86b8a0c18c3d2f70f77a10c43d"] policies = Policy.get_policy_status(refs) print(policies[0]) ``` ### Request Example (Java) ```java import com.pasarpolis.sdk.models.Policy; try { String[] refs = {"d77d436ad9485b86b8a0c18c3d2f70f77a10c43d"}); Policy[] policies = Policy.getPolicyStatus(refs); System.out.println(policies[0]); } catch (Exception e) { // Error Handling part } ``` ### Request Example (Go) ```go import ( pasarpolis_models "gitlab.com/pasarpolis/go-sdk.v2/models" "fmt" ) String[] refs = {"d77d436ad9485b86b8a0c18c3d2f70f77a10c43d"}); policies, error = pasarpolis_models.GetPolicyStatus(refs) fmt.Println(policies[0]) ``` ### Request Example (Node.js) ```javascript const sdk = require('pasarpolis-sdk-nodejs') const client = sdk.init(, , ) const getPolicyStatus = client.getPolicyStatus('48fc2801e487af79ef311621f63e4133c') /** It will give response as promise */ getPolicyStatus .then(response => console.log(response)) .catch(err => console.log(err)) ``` ### Request Example (PHP) ```php require_once('pasarpolis/policy.php'); $refs = Array("d77d436ad9485b86b8a0c18c3d2f70f77a10c43d"); $policyObj = new policy($params); $policies = Policy -> get_policy_status($refs, $clientObj); print_r($policies[0]); ``` ### Response Example ```json { "ref":"d77d436ad9485b86b8a0c18c3d2f70f77a10c43d", "application_no":"MI100073", "document_url":"NA", "policy_no":"-", "status_code":2, "status":"COMPLETED", "issue_date":"2020-07-16 08:24:11", "message":"", "partner_ref":"b4b35667-ab56-38a6-8642-bd38b21e087d", "product_key":"go-car-complete", "expiry_date":"2017-06-22 16:59:59", "activation_url":"", } ``` ``` -------------------------------- ### Validate Policy V1 Response Example Source: https://developers.ppibroker.com/ A successful validation response from the V1 API indicates that the provided policy data is valid. ```json { "message":"Valid request" } ``` -------------------------------- ### Initialize Pasarpolis Client in Go Source: https://developers.ppibroker.com/ Use this code to initialize the Pasarpolis client with your PartnerCode, PartnerSecret, and Host. ```go import( "gitlab.com/pasarpolis/go-sdk" ) pasarpolis.InitClient(, , ); ``` -------------------------------- ### Create Policy in Node.js Source: https://developers.ppibroker.com/ Use this method to create a policy in Node.js. Initialize the SDK with partner credentials and host. ```javascript const sdk = require('pasarpolis-sdk-nodejs') const client = sdk.init(, , ) const packageName = 'phone-protection' const params = { "name": "John Doe", "email_id": "john.doe@example.com", "phone_no": "+6200000000000", "reference_id": "R1", "make": "Apple", "model": "iPhone X", "purchase_date": "2018-12-20", "purchase_value": 32000.00 } const createPolicy = client.createPolicy(packageName, params) /** It will give response as promise */ createPolicy .then(response => console.log(response)) .catch(err => console.log(err)) ``` -------------------------------- ### Initialize Policy Object (PHP) Source: https://developers.ppibroker.com/ PHP snippet to initialize a policy object and then configure a policy. Requires including the policy file. ```php require_once('pasarpolis/policy.php') $policyObj = new policy($params); $params = Array(); $params["name"] = "Jacob"; ``` -------------------------------- ### Initialize Pasarpolis SDK in Node.js Source: https://developers.ppibroker.com/ Use this code to initialize the Pasarpolis SDK with your PartnerCode, PartnerSecret, and Host. ```javascript const sdk = require('pasarpolis-sdk-nodejs') const client = sdk.init(, , ) ``` -------------------------------- ### Get Policy Status (Ruby) Source: https://developers.ppibroker.com/ Use this method to retrieve the status of a policy by providing an array of reference numbers. Ensure the pasarpolis_sdk is required. ```ruby require "pasarpolis_sdk" refs = ["d77d436ad9485b86b8a0c18c3d2f70f77a10c43d"] policy = Pasarpolis::Policy.get_policy_status(refs) puts policies[0] ``` -------------------------------- ### Create Policy in Go Source: https://developers.ppibroker.com/ Use this method to create a policy in Go. Ensure the necessary packages are imported. ```go import( pasarpolis_models "gitlab.com/pasarpolis/go-sdk.v2/models" "fmt" ) policy, error := pasarpolis_models.CreatePolicy(, params); ``` ```go import( pasarpolis_models "gitlab.com/pasarpolis/go-sdk.v2/models" "fmt" ) params := map[string]interface{}{}; params["name"]="John Doe" params["email_id"]="john.doe@example.com" params["phone_no"]="+6200000000000" params["reference_id"]="R1" params["make"]="Apple" params["model"]="iPhone X" params["purchase_date"]="2018-12-20" params["purchase_value"]=32000.00 params["last_property"]=true policy := pasarpolis_models.CreatePolicy("gadget-rental-protection", params); fmt.Println(policy.referenceNumber); fmt.Println(policy.applicationNumber); fmt.Println(policy.premium); ``` -------------------------------- ### Validate Policy V2 Response Example Source: https://developers.ppibroker.com/ Sample JSON response body indicating a valid request when using the Validate Policy V2 API. ```json { "message":"Valid request" } ``` -------------------------------- ### Initialize Pasarpolis Client in Java Source: https://developers.ppibroker.com/ Use this code to initialize the Pasarpolis client with your PartnerCode, PartnerSecret, and Host. ```java import com.pasarpolis.sdk.PasarpolisClient; PasarpolisClient.init(, , ); ``` -------------------------------- ### Create Aggregate Policy (Node.js) Source: https://developers.ppibroker.com/ Example of creating an aggregate policy using the Node.js SDK. This function is used for creating travel protection policies. ```APIDOC ## Create Aggregate Policy (Node.js) ### Description This Node.js code snippet demonstrates how to create an aggregate policy for travel protection using the `pasarpolis-sdk-nodejs`. It shows how to initialize the client and call the `createAggregatePolicy` method with package name and policy parameters. ### Initialization ```javascript const sdk = require('pasarpolis-sdk-nodejs'); const client = sdk.init(, , ); ``` ### Method `client.createAggregatePolicy(packageName, params)` ### Parameters - `packageName` (string): The name of the insurance package (e.g., 'travel-protection-ultra'). - `params` (Array): An array of policy objects, each containing details for a single policyholder and their flight information. - `reference_id` (string): Unique identifier for the policy. - `policy_insured` (Object): Details of the insured person. - `name` (string): Name of the insured. - `phone_no` (string): Phone number of the insured. - `email` (string): Email address of the insured. - `gender` (string): Gender of the insured. - `identity_type` (number): Type of identity document. - `identity_number` (string): Identity document number. - `flight_information` (Array): Details of flight segments. - `type` (number): Type of flight segment. - `airport_code` (string): Departure airport code. - `flight_code` (string): Flight number. - `departure_date` (string): Departure date and time. - `destination_airport_code` (string): Destination airport code. - `pnr` (string): Passenger Name Record (PNR). - `booking_code` (string): Booking reference code. - `travel_type` (number): Type of travel. - `transit_type` (number): Type of transit. - `travel_destination` (number): Travel destination category. - `trip_reason` (number): Reason for the trip. - `note` (string): Additional notes. - `package_id` (number): The ID of the insurance package. ### Request Example ```javascript const packageName = 'travel-protection-ultra'; const params = [ { "reference_id": "2c104b94-3705-45d2-bd1e-test1", "policy_insured": { "name": "John Doe", "phone_no": "+6200000000000", "email": "abc@gmail.com", "gender": "Male", "identity_type": 1, "identity_number": "123456789111" }, "flight_information": [ { "type": 0, "airport_code": "FGK", "flight_code": "JT-341", "departure_date": "2019-01-01 04:30:00", "destination_airport_code": "KUL", "pnr": "187651" }, { "type": 1, "airport_code": "FGK", "flight_code": "JT-342", "departure_date": "2019-01-01 13:23:00", "destination_airport_code": "DEL", "pnr": "187659" } ], "booking_code": "ABC123455", "travel_type": 1, "transit_type": 1, "travel_destination": 1, "trip_reason": 1, "note": "", "package_id": 1 }, { "reference_id": "2c104b94-3705-45d2-bd1e-test2", "policy_insured": { "name": "Alice Doe", "phone_no": "627888910121", "email": "abc@gmail.com", "gender": "Male", "identity_type": 1, "identity_number": "123456789113" }, "flight_information": [ { "type": 0, "airport_code": "KJL", "flight_code": "JT-3422", "departure_date": "2019-01-01 04:30:00", "destination_airport_code": "KUL", "pnr": "187661" }, { "type": 1, "airport_code": "KUL", "flight_code": "QG-345", "departure_date": "2019-01-01 14:23:00", "destination_airport_code": "KLP", "pnr": "187662" } ], "booking_code": "ABC123455", "travel_type": 1, "transit_type": 1, "travel_destination": 1, "trip_reason": 1, "note": "", "package_id": 1 } ]; const createAgrregatePolicy = client.createAggregatePolicy(packageName, params); /** It will give response as promise */ createAgrregatePolicy .then(response => { if ( response.details !== undefined ) console.log(response.detail.errors) else console.log(response) }) .catch(err => console.log(err)); ``` ### Response - The response is a Promise that resolves with the API response or rejects with an error. ```