* id of created contribution
*/
public function contributionCreate($params, $cTypeID = 1, $invoiceID = 67890, $trxnID = 12345,
- $paymentInstrumentID = 1, $isFee = TRUE) {
+ $paymentInstrumentID = 1) {
if (!is_array($params)) {
$params = array('contact_id' => $params);
}
+
$params = array_merge(array(
'domain_id' => 1,
'receive_date' => date('Ymd'),
'total_amount' => 100.00,
+ 'fee_amount' => 5.00,
+ 'net_ammount' => 95.00,
'financial_type_id' => $cTypeID,
'payment_instrument_id' => empty($paymentInstrumentID) ? 1 : $paymentInstrumentID,
'non_deductible_amount' => 10.00,
'contribution_status_id' => 1,
), $params);
- if ($isFee) {
- $params['fee_amount'] = 5.00;
- $params['net_amount'] = 95.00;
- }
-
$result = $this->callAPISuccess('contribution', 'create', $params);
return $result['id'];
}
protected $_participantID;
protected $_eventID;
protected $_participantPaymentID;
- protected $_contributionTypeId;
+ protected $_financialTypeId;
public function setUp() {
parent::setUp();
$this->_contactID = $this->individualCreate();
$this->_createdParticipants = array();
$this->_individualId = $this->individualCreate();
+ $this->_financialTypeId = 1;
$this->_participantID = $this->participantCreate(array(
'contactID' => $this->_contactID,
));
}
- ///////////////// civicrm_participant_payment_create methods
-
/**
* Test civicrm_participant_payment_create with wrong params type.
*/
public function testPaymentCreateWrongParamsType() {
$params = 'a string';
- $result = $this->callAPIFailure('participant_payment', 'create', $params);
+ $this->callAPIFailure('participant_payment', 'create', $params);
}
/**
*/
public function testPaymentCreateEmptyParams() {
$params = array();
- $result = $this->callAPIFailure('participant_payment', 'create', $params);
+ $this->callAPIFailure('participant_payment', 'create', $params);
}
/**
$params = array(
'participant_id' => $this->_participantID,
);
-
- $participantPayment = $this->callAPIFailure('participant_payment', 'create', $params);
+ $this->callAPIFailure('participant_payment', 'create', $params);
}
/**
*/
public function testPaymentCreate() {
//Create Contribution & get contribution ID
- $contributionID = $this->contributionCreate($this->_contactID);
+ $contributionID = $this->contributionCreate(array('contact_id' => $this->_contactID));
//Create Participant Payment record With Values
$params = array(
public function testPaymentOffline() {
// create contribution w/o fee
- $contributionID = $this->contributionCreate($this->_contactID, $this->_contributionTypeId, NULL, NULL, 4, FALSE);
+ $contributionID = $this->contributionCreate(array(
+ 'contact_id' => $this->_contactID,
+ 'financial_type_id' => $this->_financialTypeId,
+ 'payment_instrument_id' => 4,
+ 'fee_amount' => 0,
+ 'net_amount' => 100,
+ ));
$this->_participantPaymentID = $this->participantPaymentCreate($this->_participantID, $contributionID);
$params = array(
* Check with valid array.
*/
public function testPaymentDelete() {
-
- // create contribution
- $contributionID = $this->contributionCreate($this->_contactID, $this->_contributionTypeId);
+ $contributionID = $this->contributionCreate(array(
+ 'contact_id' => $this->_contactID,
+ ));
$this->_participantPaymentID = $this->participantPaymentCreate($this->_participantID, $contributionID);
$params = array(
'id' => $this->_participantPaymentID,
);
-
- $result = $this->callAPIAndDocument('participant_payment', 'delete', $params, __FUNCTION__, __FILE__);
+ $this->callAPIAndDocument('participant_payment', 'delete', $params, __FUNCTION__, __FILE__);
}
- ///////////////// civicrm_participantPayment_get methods
/**
* Test civicrm_participantPayment_get - success expected.
*/
public function testGet() {
- //Create Contribution & get contribution ID
- $contributionID = $this->contributionCreate($this->_contactID3, $this->_contributionTypeId);
- $participantPaymentID = $this->participantPaymentCreate($this->_participantID4, $contributionID);
+ $contributionID = $this->contributionCreate(array('contact_id' => $this->_contactID3));
+ $this->participantPaymentCreate($this->_participantID4, $contributionID);
//Create Participant Payment record With Values
$params = array(