Merge pull request #17035 from civicrm/5.25
[civicrm-core.git] / api / v3 / ParticipantPayment.php
CommitLineData
6a488035 1<?php
6a488035
TO
2/*
3 +--------------------------------------------------------------------+
a30c801b 4 | Copyright CiviCRM LLC. All rights reserved. |
6a488035 5 | |
a30c801b
TO
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
6a488035
TO
9 +--------------------------------------------------------------------+
10 */
11
12/**
c28e1768 13 * This api exposes CiviCRM participant payments.
6a488035
TO
14 *
15 * @package CiviCRM_APIv3
6a488035
TO
16 */
17
6a488035 18/**
dc64d047 19 * Create a Event Participant Payment.
6a488035
TO
20 *
21 * This API is used for creating a Participant Payment of Event.
c28e1768 22 * Required parameters: participant_id, contribution_id.
6a488035 23 *
cf470720
TO
24 * @param array $params
25 * An associative array of name/value property values of civicrm_participant_payment.
6a488035 26 *
a6c01b45 27 * @return array
6a488035
TO
28 */
29function civicrm_api3_participant_payment_create($params) {
a5750507 30 return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'ParticipantPayment');
6a488035 31}
11e09c59
TO
32
33/**
0aa0303c
EM
34 * Adjust Metadata for Create action.
35 *
36 * The metadata is used for setting defaults, documentation & validation.
1c88e578 37 *
cf470720 38 * @param array $params
b081365f 39 * Array of parameters determined by getfields.
6a488035
TO
40 */
41function _civicrm_api3_participant_payment_create_spec(&$params) {
42 $params['participant_id']['api.required'] = 1;
43 $params['contribution_id']['api.required'] = 1;
44}
45
46/**
22242c87 47 * Deletes an existing Participant Payment.
6a488035 48 *
c490a46a 49 * @param array $params
6a488035 50 *
a6c01b45 51 * @return array
72b3a70c 52 * API result
6a488035
TO
53 */
54function civicrm_api3_participant_payment_delete($params) {
55 $participant = new CRM_Event_BAO_ParticipantPayment();
56 return $participant->deleteParticipantPayment($params) ? civicrm_api3_create_success() : civicrm_api3_create_error('Error while deleting participantPayment');
57}
58
59/**
22242c87 60 * Retrieve one or more participant payment records.
6a488035 61 *
cf470720
TO
62 * @param array $params
63 * Input parameters.
6a488035 64 *
a6c01b45 65 * @return array
72b3a70c 66 * array of properties, if error an array with an error id and error message
6a488035
TO
67 */
68function civicrm_api3_participant_payment_get($params) {
69 return _civicrm_api3_basic_get('CRM_Event_DAO_ParticipantPayment', $params);
70}