if (!empty($softParams) && empty($paymentParams['is_recur'])) {
$membershipParams['soft_credit'] = $softParams;
}
+ if (isset($result['fee_amount'])) {
+ $membershipParams['fee_amount'] = $result['fee_amount'];
+ }
// This is required to trigger the recording of the membership contribution in the
// CRM_Member_BAO_Membership::Create function.
// @todo stop setting this & 'teach' the create function to respond to something
'record_contribution' => TRUE,
'trxn_id' => 777,
'contribution_status_id' => 1,
+ 'fee_amount' => .5,
);
$form->_contactID = $this->_individualId;
));
$this->assertEquals($contribution['trxn_id'], 777);
+ $this->assertEquals(.5, $contribution['fee_amount']);
$this->callAPISuccessGetCount('LineItem', array(
'entity_id' => $membership['id'],
'entity_table' => 'civicrm_membership',
$form = $this->getForm();
$processor = Civi\Payment\System::singleton()->getById($this->_paymentProcessorID);
- $processor->setDoDirectPaymentResult(array('payment_status_id' => 1, 'trxn_id' => 'kettles boil water'));
+ $processor->setDoDirectPaymentResult(array(
+ 'payment_status_id' => 1,
+ 'trxn_id' => 'kettles boil water',
+ 'fee_amount' => .14,
+ ));
$this->callAPISuccess('MembershipType', 'create', array(
'id' => $this->membershipTypeAnnualFixedID,
'duration_unit' => 'month',
$membership = $this->callAPISuccessGetSingle('Membership', array('contact_id' => $this->_individualId));
$this->callAPISuccessGetCount('ContributionRecur', array('contact_id' => $this->_individualId), 1);
- $contribution = $this->callAPISuccess('Contribution', 'get', array(
+ $contribution = $this->callAPISuccess('Contribution', 'getsingle', array(
'contact_id' => $this->_individualId,
'is_test' => TRUE,
));
+ $this->assertEquals(.14, $contribution['fee_amount']);
+ $this->assertEquals('kettles boil water', $contribution['trxn_id']);
+
$this->callAPISuccessGetCount('LineItem', array(
'entity_id' => $membership['id'],
'entity_table' => 'civicrm_membership',