X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=api%2Fv3%2Fexamples%2FContribution%2FContributionCreateWithNote.php;h=dd139fea7716f3124dc781c1db178d8d8ceadbb0;hb=9f1b81e0ac968205dc1aa169eea1dc1d243957f8;hp=95cf55adc77c33a08288f2593ddedcf9eed28fb9;hpb=2265dc3bb39f2c1a3d4168137789e67599293ef4;p=civicrm-core.git diff --git a/api/v3/examples/Contribution/ContributionCreateWithNote.php b/api/v3/examples/Contribution/ContributionCreateWithNote.php index 95cf55adc7..dd139fea77 100644 --- a/api/v3/examples/Contribution/ContributionCreateWithNote.php +++ b/api/v3/examples/Contribution/ContributionCreateWithNote.php @@ -1,7 +1,7 @@ 67890, 'source' => 'SSF', 'contribution_status_id' => 1, - 'version' => 3, 'note' => 'my contribution note', ); - $result = civicrm_api( 'contribution','create',$params ); +try{ + $result = civicrm_api3('contribution', '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 contribution_create_expectedresult(){ @@ -64,14 +72,14 @@ function contribution_create_expectedresult(){ 'contribution_status_id' => '1', 'honor_type_id' => '', 'address_id' => '', - 'check_number' => 'null', + 'check_number' => '', 'campaign_id' => '', 'contribution_type_id' => '1', ), ), ); - return $expectedResult ; + return $expectedResult; }