});
function checkEmailDependancies() {
- if ($('#is_email_receipt', $form).attr('checked')) {
- $('#fromEmail, #notice', $form).show();
- $('#receiptDate', $form).hide();
+ if ($('#is_email_receipt', $form).prop('checked')) {
+ $('#fromEmail', $form).show();
}
else {
- $('#fromEmail, #notice', $form).hide( );
- $('#receiptDate', $form).show();
- }
- }
-
- // bind first click of accordion header to load crm-accordion-body with snippet
- $('#adjust-option-type', $form).hide();
- $('.crm-ajax-accordion .crm-accordion-header', $form).one('click', function() {
- loadPanes($(this).attr('id'));
- });
- $('.crm-ajax-accordion:not(.collapsed) .crm-accordion-header', $form).each(function(index) {
- loadPanes($(this).attr('id'));
- });
- // load panes function call for snippet based on id of crm-accordion-header
- function loadPanes(id) {
- var url = "{/literal}{crmURL p='civicrm/payment/add' q='formType=' h=0}{literal}" + id;
- {/literal}
- {if $contributionMode}
- url += "&mode={$contributionMode}";
- {/if}
- {if $qfKey}
- url += "&qfKey={$qfKey}";
- {/if}
- {literal}
- if (!$('div.'+ id, $form).html()) {
- CRM.loadPage(url, {target: $('div.' + id, $form)});
+ $('#fromEmail', $form).hide( );
}
}
'city' => 'Vancouver',
'location_type_id' => 5,
), 0);
-
}
/**
);
}
+ /**
+ * Test the submit function that completes the partially paid payment using Credit Card
+ */
+ public function testPartialPaymentWithCreditCard() {
+ // create a partially paid contribution by using back-office form
+ $form = new CRM_Contribute_Form_Contribution();
+ $form->testSubmit(
+ array(
+ 'total_amount' => 50,
+ 'financial_type_id' => 1,
+ 'receive_date' => '04/21/2015',
+ 'receive_date_time' => '11:27PM',
+ 'contact_id' => $this->_individualId,
+ 'payment_instrument_id' => array_search('Check', $this->paymentInstruments),
+ 'check_number' => substr(sha1(rand()), 0, 7),
+ 'billing_city-5' => 'Vancouver',
+ 'contribution_status_id' => CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Partially paid'),
+ ), CRM_Core_Action::ADD
+ );
+
+ $contribution = $this->callAPISuccessGetSingle('Contribution', array());
+ $this->assertNotEmpty($contribution);
+ $this->assertEquals('Partially paid', $contribution['contribution_status']);
+ // pay additional amount by using Credit Card
+ $form = new CRM_Contribute_Form_AdditionalPayment();
+ $form->testSubmit(array(
+ 'contribution_id' => $contribution['id'],
+ 'contact_id' => $this->_individualId,
+ 'total_amount' => 50,
+ 'currency' => 'USD',
+ 'financial_type_id' => 1,
+ 'receive_date' => '04/21/2015',
+ 'receive_date_time' => '11:27PM',
+ 'contact_id' => $this->_individualId,
+ 'payment_instrument_id' => array_search('Credit card', $this->paymentInstruments),
+ 'payment_processor_id' => $this->paymentProcessorID,
+ 'credit_card_exp_date' => array('M' => 5, 'Y' => 2025),
+ 'credit_card_number' => '411111111111111',
+ 'cvv2' => 234,
+ 'credit_card_type' => 'Visa',
+ 'billing_city-5' => 'Vancouver',
+ 'billing_state_province_id-5' => 1059,
+ 'billing_postal_code-5' => 1321312,
+ 'billing_country_id-5' => 1228,
+ 'trxn_date' => '2017-04-11 13:05:11',
+ ), 'live');
+ $contribution = $this->callAPISuccessGetSingle('Contribution', array());
+ $this->assertNotEmpty($contribution);
+ $this->assertEquals('Completed', $contribution['contribution_status']);
+ }
+
/**
* Test the submit function for FT with tax.
*/