}
}
}
- elseif ($form->_contributeMode == 'express') {
- if ($form->_values['is_monetary'] && $form->_amount > 0.0) {
- // determine if express + recurring and direct accordingly
- if (!empty($paymentParams['is_recur']) && $paymentParams['is_recur'] == 1) {
- if (is_object($payment)) {
- $result = $payment->createRecurringPayments($paymentParams);
- }
- else {
- CRM_Core_Error::fatal($paymentObjError);
- }
+
+ elseif ($isPaymentTransaction && $form->_contributeMode) {
+ if ($form->_contributeMode == 'express' && !empty($paymentParams['is_recur']) && $paymentParams['is_recur'] == 1) {
+ if (is_object($payment)) {
+ $result = $payment->createRecurringPayments($paymentParams);
}
else {
- if (is_object($payment)) {
- $result = $payment->doExpressCheckout($paymentParams);
- }
- else {
- CRM_Core_Error::fatal($paymentObjError);
- }
+ CRM_Core_Error::fatal($paymentObjError);
}
}
- }
- elseif ($isPaymentTransaction) {
- if ($form->_contributeMode == 'direct') {
+ else {
$paymentParams['contactID'] = $contactID;
// Fix for CRM-14354. If the membership is recurring, don't create a
}
$form->postProcessPremium($premiumParams, $contribution);
- if (is_array($result) && !empty($result['trxn_id'])) {
- $contribution->trxn_id = $result['trxn_id'];
+ if (is_array($result)) {
+ if (!empty($result['trxn_id'])) {
+ $contribution->trxn_id = $result['trxn_id'];
+ }
+ if (!empty($result['payment_status_id'])) {
+ $contribution->payment_status_id = $result['payment_status_id'];
+ }
}
$result['contribution'] = $contribution;
}
//Do not send an email if Recurring contribution is done via Direct Mode
//We will send email once the IPN is received.
- if ($form->_contributeMode == 'direct') {
+ if (!$isPayLater) {
return $result;
}