Skip to content
Snippets Groups Projects
Commit 5efb95d7 authored by Dave Greenberg's avatar Dave Greenberg
Browse files

Merge pull request #2437 from pratik-joshi/CRM-13965

Crm 13965
parents 5fa4ed15 794abb2e
Branches
Tags
No related merge requests found
......@@ -354,7 +354,7 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract
if (!empty($submittedValues['is_email_receipt']) && $sendReceipt) {
$statusMsg .= ' ' . ts('A receipt has been emailed to the contributor.');
}
if ($sendReceipt) {
if (isset($sendReceipt)) {
$statusMsg .= ' ' . ts('Email has been sent successfully');
}
CRM_Core_Session::setStatus($statusMsg, ts('Saved'), 'success');
......
......@@ -30,7 +30,7 @@
{if $paymentType eq 'refund'}
<h3>{ts}New Event Refund{/ts}</h3>
{else}
<h3>{if $component eq 'event'}{if $contributionMode}{ts}Credit Card Event Payment{/ts}{else}{ts}New Event Payement{/ts}{/if}{/if}</h3>
<h3>{if $component eq 'event'}{if $contributionMode}{ts}Credit Card Event Payment{/ts}{else}{ts}New Event Payment{/ts}{/if}{/if}</h3>
{/if}
<div class="crm-block crm-form-block crm-payment-form-block">
......
......@@ -164,9 +164,6 @@
</script>
{/literal}
{/if}
{if $participantId}
{include file="CRM/Contribute/Page/PaymentInfo.tpl" show='event-payment'}
{/if}
{include file="CRM/Event/Form/EventFees.tpl"}
{elseif $cdType}
{include file="CRM/Custom/Form/CustomData.tpl"}
......@@ -325,6 +322,9 @@
</div>
</div>
{if $action eq 1 or $action eq 2}
{if $participantId}
{include file="CRM/Contribute/Page/PaymentInfo.tpl" show='event-payment'}
{/if}
{literal}
<script type="text/javascript">
// event select
......
......@@ -30,7 +30,7 @@ class WebTest_Event_AdditionalPaymentTest extends CiviSeleniumTestCase {
parent::setUp();
}
// CRM-13964
// CRM-13964 and CRM-13965
function testParticipantParitalPaymentInitiation() {
// Log in using webtestLogin() method
$this->webtestLogin();
......@@ -120,14 +120,9 @@ class WebTest_Event_AdditionalPaymentTest extends CiviSeleniumTestCase {
)
);
// check the fee amount
$feeAmt = 800.00;
$this->assertElementContainsText("xpath=//td[@id='payment-info']/table[@id='info']/tbody/tr[2]/td", "$ {$feeAmt}", 'Missing text: appropriate fee amount');
// check paid amount
$amtPaid = 400.00;
$this->assertElementContainsText("xpath=//td[@id='payment-info']/table[@id='info']/tbody/tr[2]/td[2]/a", "$ {$amtPaid}", 'Missing text: appropriate fee amount');
// check contribution record as well
// check the fee amount and contribution amount
$this->_checkPaymentInfoTable(800.00, 400.00);
$balance = 800.00 - 400.00;
//click through to the contribution view screen
$this->click("xpath=id('ParticipantView')/div[2]/table[@class='selector']/tbody/tr[1]/td[8]/span/a[text()='View']");
$this->waitForElementPresent('_qf_ContributionView_cancel-bottom');
......@@ -142,5 +137,84 @@ class WebTest_Event_AdditionalPaymentTest extends CiviSeleniumTestCase {
'Check Number' => '1044',
)
);
$this->click('_qf_ContributionView_cancel-top');
$this->waitForElementPresent("xpath=id('ParticipantView')/div[2]/table[@class='selector']/tbody/tr[1]/td[8]/span/a[text()='View']");
// make additional payment
// 1 - check for links presence on participant view and edit page
$this->assertElementPresent("xpath=id('Search')/table[@class='selector']/tbody/tr[1]/td[8]/span[2]/ul/li[2]/a[text()='Record Payment']");
$this->click("xpath=id('Search')/table[@class='selector']/tbody/tr[1]/td[8]/span/a[text()='View']");
$this->waitForElementPresent("xpath=id('ParticipantView')");
$this->assertElementPresent("xpath=id('ParticipantView')//td[@id='payment-info']/a/span[contains(text(), 'Record Payment')]");
$this->click("xpath=id('ParticipantView')//div[@class='action-link']/div/a/span[contains(text(), 'Edit')]");
$this->waitForElementPresent("xpath=id('Participant')");
$this->assertElementPresent("xpath=id('Participant')//td[@id='payment-info']/a/span[contains(text(), 'Record Payment')]");
$location = $this->getAttribute("xpath=id('Participant')//td[@id='payment-info']/a/span[contains(text(), 'Record Payment')]/../@href");
$this->open($location);
$this->waitForElementPresent("xpath=id('AdditionalPayment')");
$this->assertElementContainsText("xpath=id('AdditionalPayment')/h3", 'New Event Payment');
// input data
$this->select('financial_type_id', 'label=Donation');
// verify balance
$text = $this->getText("xpath=id('AdditionalPayment')/div[2]/table/tbody/tr[4]/td[2]");
$this->assertTrue((bool)preg_match("/{$balance}/", $text));
// check form rule error
$errorBalance = $balance + 1;
$this->type('total_amount', $errorBalance);
$this->select('payment_instrument_id', 'label=Cash');
$this->click('_qf_AdditionalPayment_upload-bottom');
$this->waitForText("xpath=//span[@id='totalAmount']/span", 'Payment amount cannot be greater than owed amount');
$this->type('total_amount', $balance);
$this->click('_qf_AdditionalPayment_upload-bottom');
$this->waitForText('crm-notification-container', 'The payment record has been processed.');
$this->waitForElementPresent("xpath=id('Search')/table[@class='selector']/tbody/tr[1]/td[8]/span/a[text()='View']");
$this->click("xpath=id('Search')/table[@class='selector']/tbody/tr[1]/td[8]/span/a[text()='View']");
$this->waitForElementPresent("_qf_ParticipantView_cancel-top");
$this->webtestVerifyTabularData(
array(
'Event' => 'Rain-forest Cup Youth Soccer Tournament',
'Participant Role' => 'Attendee',
'Status' => 'Registered',
'Event Source' => 'Event Partially Paid Webtest',
)
);
// check the fee amount and contribution amount
$this->_checkPaymentInfoTable(800.00, 800.00);
// check for not apprence of record payment button
$this->assertFalse($this->isElementPresent("xpath=id('ParticipantView')//td[@id='payment-info']/a/span[contains(text(), 'Record Payment')]"));
$this->click("xpath=id('ParticipantView')/div[2]/table[@class='selector']/tbody/tr[1]/td[8]/span/a[text()='View']");
$this->waitForElementPresent('_qf_ContributionView_cancel-bottom');
$this->webtestVerifyTabularData(
array(
'From' => $displayName,
'Financial Type' => 'Event Fee',
'Total Amount' => '$ 800.00',
'Contribution Status' => 'Completed',
'Paid By' => 'Check',
'Check Number' => '1044',
)
);
$this->click('_qf_ContributionView_cancel-bottom');
// view transaction popup info check
$this->waitForElementPresent("xpath=//td[@id='payment-info']/table[@id='info']/tbody/tr[2]/td[2]/a");
$this->click("xpath=//td[@id='payment-info']/table[@id='info']/tbody/tr[2]/td[2]/a");
$this->waitForElementPresent("xpath=//table[@id='info']/tbody/tr/th[contains(text(), 'Amount')]/../../tr[2]/td[contains(text(), '$ 400.00')]/../../tr[3]/td[contains(text(), '$ 400.00')]");
$this->waitForElementPresent("xpath=//table[@id='info']/tbody/tr/th[3][contains(text(), 'Paid By')]/../../tr[2]/td[3][contains(text(), 'Check')]/../../tr[3]/td[3][contains(text(), 'Cash')]");
$this->waitForElementPresent("xpath=//table[@id='info']/tbody/tr/th[6][contains(text(), 'Status')]/../../tr[2]/td[6][contains(text(), 'Completed')]/../../tr[3]/td[6][contains(text(), 'Completed')]");
}
function _checkPaymentInfoTable($feeAmt, $amtPaid) {
$this->assertElementContainsText("xpath=//td[@id='payment-info']/table[@id='info']/tbody/tr[2]/td", "$ {$feeAmt}", 'Missing text: appropriate fee amount');
$this->assertElementContainsText("xpath=//td[@id='payment-info']/table[@id='info']/tbody/tr[2]/td[2]/a", "$ {$amtPaid}", 'Missing text: appropriate fee amount');
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment