<?php
-
-/*
-
+/**
+ * Test Generated example of using price_set create API
+ * *
*/
function price_set_create_example(){
$params = array(
- 'version' => 3,
'name' => 'default_goat_priceset',
'title' => 'Goat accessories',
'is_active' => 1,
'is_reserved' => 1,
);
- $result = civicrm_api( 'price_set','create',$params );
+try{
+ $result = civicrm_api3('price_set', 'create', $params);
+}
+catch (CiviCRM_API3_Exception $e) {
+ // handle error here
+ $errorMessage = $e->getMessage();
+ $errorCode = $e->getErrorCode();
+ $errorData = $e->getExtraParams();
+ return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData);
+}
- return $result;
+return $result;
}
-/*
+/**
* Function returns array of result expected from previous function
*/
function price_set_create_expectedresult(){
'is_error' => 0,
'version' => 3,
'count' => 1,
- 'id' => 3,
+ 'id' => 15,
'values' => array(
- '3' => array(
- 'id' => '3',
+ '15' => array(
+ 'id' => '15',
'domain_id' => '',
'name' => 'default_goat_priceset',
'title' => 'Goat accessories',
),
);
- return $expectedResult ;
+ return $expectedResult;
}