*
*/
public function submit($submittedValues) {
+ $this->_params = $submittedValues;
+ $this->beginPostProcess();
$participantId = NULL;
if ($this->_component == 'event') {
$participantId = $this->_id;
}
// Get the required fields value only.
- $params = $this->_params = $submittedValues;
-
- //get the payment processor id as per mode.
- //@todo unclear relevance of mode - seems like a lot of duplicated params here!
- $this->_params['payment_processor'] = $params['payment_processor_id']
- = $this->_params['payment_processor_id'] = $submittedValues['payment_processor_id'] = $this->_paymentProcessor['id'];
+ $params = $submittedValues;
$now = date('YmdHis');
$fields = array();
$this->_params["state_province-{$this->_bltID}"] = $this->_params["billing_state_province-{$this->_bltID}"] = CRM_Core_PseudoConstant::stateProvinceAbbreviation($this->_params["billing_state_province_id-{$this->_bltID}"]);
$this->_params["country-{$this->_bltID}"] = $this->_params["billing_country-{$this->_bltID}"] = CRM_Core_PseudoConstant::countryIsoCode($this->_params["billing_country_id-{$this->_bltID}"]);
- if ($this->_paymentProcessor['payment_type'] & CRM_Core_Payment::PAYMENT_TYPE_CREDIT_CARD) {
- $this->_params['year'] = CRM_Core_Payment_Form::getCreditCardExpirationYear($this->_params);
- $this->_params['month'] = CRM_Core_Payment_Form::getCreditCardExpirationMonth($this->_params);
- }
- $this->_params['ip_address'] = CRM_Utils_System::ipAddress();
$this->_params['amount'] = $this->_params['total_amount'];
// @todo - stop setting amount level in this function & call the CRM_Price_BAO_PriceSet::getAmountLevel
// function to get correct amount level consistently. Remove setting of the amount level in
$this->_bltID
));
- $date = CRM_Utils_Date::format($params['credit_card_exp_date']);
- $date = CRM_Utils_Date::mysqlToIso($date);
- $this->assign('credit_card_type', CRM_Utils_Array::value('credit_card_type', $params));
- $this->assign('credit_card_exp_date', $date);
- $this->assign('credit_card_number',
- CRM_Utils_System::mungeCreditCard($params['credit_card_number'])
- );
-
//Add common data to formatted params
CRM_Contribute_Form_AdditionalInfo::postProcessCommon($params, $this->_params, $this);
// at this point we've created a contact and stored its address etc
/**
* Wrapper for unit testing the post process submit function.
*
- *
* @param array $params
* @param string|null $creditCardMode
* @param string $enitityType
*/
public function testSubmit($params, $creditCardMode = NULL, $enitityType = 'contribute') {
$this->_bltID = 5;
+ // Required because processCreditCard calls set method on this.
+ $_SERVER['REQUEST_METHOD'] = 'GET';
+ $this->controller = new CRM_Core_Controller();
+
+ $this->assignPaymentRelatedVariables();
if (!empty($params['contribution_id'])) {
$this->_contributionId = $params['contribution_id'];
$this->_mode = $creditCardMode;
}
- // Required because processCreditCard calls set method on this.
- $_SERVER['REQUEST_METHOD'] = 'GET';
- $this->controller = new CRM_Core_Controller();
-
$this->_fields = array();
$this->submit($params);
}
/**
* Test the submit function that completes the partially paid Contribution using Credit Card.
-
+ */
public function testAddPaymentUsingCreditCardForPartialyPaidContribution() {
$this->createContribution('Partially paid');
$this->submitPayment(70, 'live');
$this->checkResults(array(30, 70), 2);
}
- */
/**
* Test the submit function that completes the partially paid Contribution.
$this->submitPayment(20);
$this->checkResults(array(30, 50, 20), 3);
}
+
/**
* Test the submit function that completes the partially paid Contribution with multiple payments.
- *
- public function testMultiplePaymentForPartialyPaidContributionWithOneCreditCardPayment() {
+ */
+ public function testMultiplePaymentForPartiallyPaidContributionWithOneCreditCardPayment() {
$this->createContribution('Partially paid');
// pay additional amount
$this->checkResults(array(30, 50, 20), 3);
}
-
/**
* Test the submit function that completes the pending pay later Contribution using Credit Card.
- *
+ */
public function testAddPaymentUsingCreditCardForPendingPayLaterContribution() {
$this->createContribution('Pending');
$this->submitPayment(100, 'live');
$this->checkResults(array(100), 1);
}
- */
/**
* Test the submit function that completes the pending pay later Contribution.
/**
* Test the submit function that completes the pending pay later Contribution with multiple payments.
- *
+ */
public function testMultiplePaymentForPendingPayLaterContributionWithOneCreditCardPayment() {
$this->createContribution('Pending');
$this->submitPayment(10, 'live');
$this->checkResults(array(50, 20, 20, 10), 4);
}
- */
/**
* Function to create pending pay later or partially paid conntribution.
'receive_date' => '04/21/2015',
'receive_date_time' => '11:27PM',
'trxn_date' => '2017-04-11 13:05:11',
+ 'payment_processor_id' => 0,
);
if ($mode) {
$submitParams += array(