*/
public function testRepeatTransactionAlteredAmount() {
$paymentProcessorID = $this->paymentProcessorCreate();
- $campaignID = $this->campaignCreate();
- $campaignID2 = $this->campaignCreate();
$contributionRecur = $this->callAPISuccess('contribution_recur', 'create', array(
'contact_id' => $this->_individualId,
'installments' => '12',
$this->_params,
array(
'contribution_recur_id' => $contributionRecur['id'],
- 'campaign_id' => $campaignID,
))
);
'trxn_id' => uniqid(),
'total_amount' => '400',
'fee_amount' => 50,
- 'campaign_id' => $campaignID2,
));
$lineItemParams = array(
'entity_id' => $originalContribution['id'],
);
$this->callAPISuccessGetSingle('contribution', array(
'total_amount' => 400,
- 'campaign_id' => $campaignID2,
'fee_amount' => 50,
'net_amount' => 350,
));
unset($expectedLineItem['id'], $expectedLineItem['entity_id']);
unset($lineItem2['values'][0]['id'], $lineItem2['values'][0]['entity_id']);
$this->assertEquals($expectedLineItem, $lineItem2['values'][0]);
+ }
- $this->quickCleanUpFinancialEntities();
+ /**
+ * CRM-16397 test appropriate action if total amount has changed for single line items.
+ */
+ public function testRepeatTransactionPassedInCampaign() {
+ $paymentProcessorID = $this->paymentProcessorCreate();
+ $campaignID = $this->campaignCreate();
+ $campaignID2 = $this->campaignCreate();
+ $contributionRecur = $this->callAPISuccess('contribution_recur', 'create', array(
+ 'contact_id' => $this->_individualId,
+ 'installments' => '12',
+ 'frequency_interval' => '1',
+ 'amount' => '100',
+ 'contribution_status_id' => 1,
+ 'start_date' => '2012-01-01 00:00:00',
+ 'currency' => 'USD',
+ 'frequency_unit' => 'month',
+ 'payment_processor_id' => $paymentProcessorID,
+ ));
+ $originalContribution = $this->callAPISuccess('contribution', 'create', array_merge(
+ $this->_params,
+ array(
+ 'contribution_recur_id' => $contributionRecur['id'],
+ 'campaign_id' => $campaignID,
+ ))
+ );
+
+ $this->callAPISuccess('contribution', 'repeattransaction', array(
+ 'original_contribution_id' => $originalContribution['id'],
+ 'contribution_status_id' => 'Completed',
+ 'trxn_id' => uniqid(),
+ 'campaign_id' => $campaignID2,
+ ));
+
+ $this->callAPISuccessGetSingle('contribution', array(
+ 'total_amount' => 100,
+ 'campaign_id' => $campaignID2,
+ ));
+ }
+
+ /**
+ * CRM-17718 campaign stored on contribution recur gets priority.
+ *
+ * This reflects the fact we permit people to update them.
+ */
+ public function testRepeatTransactionUpdatedCampaign() {
+ $paymentProcessorID = $this->paymentProcessorCreate();
+ $campaignID = $this->campaignCreate();
+ $campaignID2 = $this->campaignCreate();
+ $contributionRecur = $this->callAPISuccess('contribution_recur', 'create', array(
+ 'contact_id' => $this->_individualId,
+ 'installments' => '12',
+ 'frequency_interval' => '1',
+ 'amount' => '100',
+ 'contribution_status_id' => 1,
+ 'start_date' => '2012-01-01 00:00:00',
+ 'currency' => 'USD',
+ 'frequency_unit' => 'month',
+ 'payment_processor_id' => $paymentProcessorID,
+ 'campaign_id' => $campaignID,
+ ));
+ $originalContribution = $this->callAPISuccess('contribution', 'create', array_merge(
+ $this->_params,
+ array(
+ 'contribution_recur_id' => $contributionRecur['id'],
+ 'campaign_id' => $campaignID2,
+ ))
+ );
+
+ $this->callAPISuccess('contribution', 'repeattransaction', array(
+ 'original_contribution_id' => $originalContribution['id'],
+ 'contribution_status_id' => 'Completed',
+ 'trxn_id' => uniqid(),
+ ));
+
+ $this->callAPISuccessGetSingle('contribution', array(
+ 'total_amount' => 100,
+ 'campaign_id' => $campaignID,
+ ));
}
/**