Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRM-17647 fix for submitting payment with thousand separator #11539

Merged
merged 2 commits into from
Feb 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CRM/Contribute/BAO/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ public static function add(&$params, $ids = array()) {
else {
// @todo put a deprecated here - this should be done in the form layer.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eileenmcnaughton if this passes i think we should remove this to do

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol

$params['skipCleanMoney'] = FALSE;
Civi::log()->warning('Deprecated code path. Money should always be clean before it hits the BAO.', array('civi.tag' => 'deprecated'));
}

foreach ($moneyFields as $field) {
Expand Down
2 changes: 1 addition & 1 deletion CRM/Event/Form/Participant.php
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ public function submit($params) {
}
if ($this->_isPaidEvent) {

$contributionParams = array();
$contributionParams = array('skipCleanMoney' => TRUE);
$lineItem = array();
$additionalParticipantDetails = array();
if (CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled')) {
Expand Down
20 changes: 9 additions & 11 deletions tests/phpunit/CRM/Core/Payment/AuthorizeNetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function testCreateSingleNowDated() {
$invoiceID = sha1(rand());
$amount = rand(100, 1000) . '.00';

$contributionRecurParams = array(
$recur = $this->callAPISuccess('ContributionRecur', 'create', array(
'contact_id' => $contactId,
'amount' => $amount,
'currency' => 'USD',
Expand All @@ -74,21 +74,19 @@ public function testCreateSingleNowDated() {
'contribution_status_id' => 2,
'is_test' => 1,
'payment_processor_id' => $this->_paymentProcessorID,
);
$recur = CRM_Contribute_BAO_ContributionRecur::add($contributionRecurParams);
));

$contributionParams = array(
$contribution = $this->callAPISuccess('Contribution', 'create', array(
'contact_id' => $contactId,
'financial_type_id' => $this->_financialTypeId,
'receive_date' => date('Ymd'),
'total_amount' => $amount,
'invoice_id' => $invoiceID,
'currency' => 'USD',
'contribution_recur_id' => $recur->id,
'contribution_recur_id' => $recur['id'],
'is_test' => 1,
'contribution_status_id' => 2,
);
$contribution = CRM_Contribute_BAO_Contribution::add($contributionParams);
));

$params = array(
'qfKey' => '08ed21c7ca00a1f7d32fff2488596ef7_4454',
Expand Down Expand Up @@ -157,9 +155,9 @@ public function testCreateSingleNowDated() {
'contributionPageID' => '',
'email' => "{$firstName}.{$lastName}@example.com",
'contactID' => $contactId,
'contributionID' => $contribution->id,
'contributionID' => $contribution['id'],
'contributionTypeID' => $this->_financialTypeId,
'contributionRecurID' => $recur->id,
'contributionRecurID' => $recur['id'],
);

// turn verifySSL off
Expand All @@ -169,12 +167,12 @@ public function testCreateSingleNowDated() {
Civi::settings()->set('verifySSL', '0');

// if subscription was successful, processor_id / subscription-id must not be null
$this->assertDBNotNull('CRM_Contribute_DAO_ContributionRecur', $recur->id, 'processor_id',
$this->assertDBNotNull('CRM_Contribute_DAO_ContributionRecur', $recur['id'], 'processor_id',
'id', 'Failed to create subscription with Authorize.'
);

// cancel it or the transaction will be rejected by A.net if the test is re-run
$subscriptionID = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionRecur', $recur->id, 'processor_id');
$subscriptionID = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionRecur', $recur['id'], 'processor_id');
$message = '';
$result = $this->processor->cancelSubscription($message, array('subscriptionId' => $subscriptionID));
$this->assertTrue($result, 'Failed to cancel subscription with Authorize.');
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Financial/BAO/FinancialAccountTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public function testdelIfHasContribution() {
'financial_type_id' => $financialType->id,
'contribution_status_id' => 1,
);
$contributions = CRM_Contribute_BAO_Contribution::create($contributionParams);
$this->callAPISuccess('Contribution', 'create', $contributionParams);
CRM_Financial_BAO_FinancialAccount::del($result->id);
$params = array('id' => $result->id);
$result = CRM_Financial_BAO_FinancialAccount::retrieve($params, $defaults);
Expand Down
1 change: 1 addition & 0 deletions tests/phpunit/CRM/Financial/BAO/FinancialTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ public function testcheckPermissionedLineItems() {
'contact_id' => $contactId,
'financial_type_id' => 1,
'contribution_status_id' => 1,
'skipCleanMoney' => TRUE,
);

foreach ($priceFields['values'] as $key => $priceField) {
Expand Down