/** * Process payment - this function wraps around both doTransferPayment and doDirectPayment. * * The function ensures an exception is thrown & moves some of this logic out of the form layer and makes the forms * more agnostic. * * Payment processors should set payment_status_id. This function adds some historical defaults ie. the * assumption that if a 'doDirectPayment' processors comes back it completed the transaction & in fact * doTransferCheckout would not traditionally come back. * * doDirectPayment does not do an immediate payment for Authorize.net or Paypal so the default is assumed * to be Pending. * * Once this function is fully rolled out then it will be preferred for processors to throw exceptions than to * return Error objects * * @param array $params * * @param string $component * * @return array * Result array * * @throws \Civi\Payment\Exception\PaymentProcessorException */ public function doPayment(&$params, $component = 'contribute') { if ($this->_paymentProcessor['payment_processor_type'] == 'PayPal_Express' || $this->_paymentProcessor['payment_processor_type'] == 'PayPal' && !empty($params['token'])) { $this->_component = $component; return $this->doExpressCheckout($params); } return parent::doPayment($params, $component); }
/** * Process payment - this function wraps around both doTransferPayment and doDirectPayment. * * The function ensures an exception is thrown & moves some of this logic out of the form layer and makes the forms * more agnostic. * * Payment processors should set payment_status_id. This function adds some historical defaults ie. the * assumption that if a 'doDirectPayment' processors comes back it completed the transaction & in fact * doTransferCheckout would not traditionally come back. * * doDirectPayment does not do an immediate payment for Authorize.net or Paypal so the default is assumed * to be Pending. * * Once this function is fully rolled out then it will be preferred for processors to throw exceptions than to * return Error objects * * @param array $params * * @param string $component * * @return array * Result array * * @throws \Civi\Payment\Exception\PaymentProcessorException */ public function doPayment(&$params, $component = 'contribute') { if ($this->_paymentProcessor['payment_processor_type'] != 'PayPal_Express' && (!empty($params['credit_card_number']) && empty($params['token']))) { return parent::doPayment($params, $component); } $this->_component = $component; return $this->doExpressCheckout($params); }