-
-
Notifications
You must be signed in to change notification settings - Fork 824
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[REF] Extract code to get the from address for a recurring contribution.
This makes the retrieval generally available, since is it part of the data model, rather than tied to the form. It could possibly be a token, or at least retrievable on the recurring edit workflow template - but that is beyond the scope of this
- Loading branch information
1 parent
3b943db
commit 8159df5
Showing
3 changed files
with
68 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ class CRM_Contribute_Form_UpdateSubscriptionTest extends CiviUnitTestCase { | |
/** | ||
* Test the mail sent on update. | ||
* | ||
* @throws \CRM_Core_Exception | ||
* @throws \CRM_Core_Exception|\API_Exception | ||
*/ | ||
public function testMail(): void { | ||
$mut = new CiviMailUtils($this, TRUE); | ||
|
@@ -44,14 +44,14 @@ public function testMail(): void { | |
public function getExpectedMailStrings(): array { | ||
return [ | ||
'MIME-Version: 1.0', | ||
'From: FIXME <[email protected]>', | ||
'From: "Bob" <[email protected]>', | ||
'To: Anthony Anderson <[email protected]>', | ||
'Subject: Recurring Contribution Update Notification - Mr. Anthony Anderson II', | ||
'Return-Path: [email protected]', | ||
'Return-Path: [email protected]', | ||
'Dear Anthony,', | ||
'Your recurring contribution has been updated as requested:', | ||
'Recurring contribution is for $ 10.00, every 1 month(s) for 12 installments.', | ||
'If you have questions please contact us at FIXME <[email protected]>.', | ||
'If you have questions please contact us at "Bob" <[email protected]>.', | ||
]; | ||
} | ||
|
||
|
@@ -77,7 +77,12 @@ public function addContribution(): void { | |
'contribution_recur_id' => $this->getContributionRecurID(), | ||
'financial_type_id' => 'Donation', | ||
'total_amount' => 10, | ||
'api.Payment.create' => ['total_amount' => 10, 'payment_processor_id' => $this->paymentProcessorId], | ||
'contribution_page_id' => $this->getContributionPageID(), | ||
'api.Payment.create' => [ | ||
'total_amount' => 10, | ||
'payment_processor_id' => $this->paymentProcessorId, | ||
'is_send_contribution_notification' => FALSE, | ||
], | ||
]); | ||
} | ||
|
||
|
@@ -99,4 +104,20 @@ public function getContributionRecurID(): int { | |
return $this->ids['ContributionRecur'][0]; | ||
} | ||
|
||
/** | ||
* Get a contribution page id. | ||
* | ||
* @return int | ||
*/ | ||
public function getContributionPageID(): int { | ||
if (!isset($this->ids['ContributionPage'][0])) { | ||
$this->ids['ContributionPage'][0] = $this->callAPISuccess('ContributionPage', 'create', [ | ||
'receipt_from_name' => 'Bob', | ||
'receipt_from_email' => '[email protected]', | ||
'financial_type_id' => 'Donation', | ||
])['id']; | ||
} | ||
return $this->ids['ContributionPage'][0]; | ||
} | ||
|
||
} |