Exemplo n.º 1
0
 /**
  * check with valid array
  */
 function testPaymentCreate()
 {
     $contributionTypeID = 1;
     //Create Contribution & get contribution ID
     $contributionID = $this->contributionCreate($this->_contactID, $contributionTypeID);
     //Create Participant Payment record With Values
     $params = array('participant_id' => $this->_participantID, 'contribution_id' => $contributionID);
     $participantPayment =& civicrm_participant_payment_create($params);
     $this->assertEquals($participantPayment['is_error'], 0);
     $this->assertTrue(array_key_exists('id', $participantPayment));
     //delete created contribution
     $this->contributionDelete($contributionID);
     // delete created contribution type
     $this->contributionTypeDelete($contributionTypeID);
 }
Exemplo n.º 2
0
 /**
  * Function to create participant payment
  *
  * @return int $id of created payment
  */
 function participantPaymentCreate($participantID, $contributionID)
 {
     require_once 'api/v2/Participant.php';
     //Create Participant Payment record With Values
     $params = array('participant_id' => $participantID, 'contribution_id' => $contributionID);
     $participantPayment =& civicrm_participant_payment_create($params);
     if (CRM_Utils_Array::value('is_error', $participantPayment) || !CRM_Utils_Array::value('id', $participantPayment)) {
         throw new Exception('Could not create participant payment');
     }
     return $participantPayment['id'];
 }