Commit 64e0306e authored by eileen's avatar eileen

Omnipay update

parent 172b7128
......@@ -1463,7 +1463,14 @@ class CRM_Core_Payment_OmnipayMultiProcessor extends CRM_Core_Payment_PaymentExt
// and, at least with Way rapid, the createCreditCard call ignores any attempt to authorise.
// that is likely to be a pattern.
$action = CRM_Utils_Array::value('payment_action', $params, 'purchase');
if (method_exists($this->gateway, 'completePurchase') && !isset($params['payment_action']) && !empty($params['is_recur'])) {
// This is a bit tricky. With Paypal there are 2 flows
// 1) you get a token from paypal checkout but there is no recurring - this token needs to be 'completed'
// 2) you have a recurring payment token that we can bill against. However, is_recur is not
// currently we are using a bit of black magic & setting payment_action in the
// ProcessRecurring function - that has test coverage.
// Perhaps we need to set a one-time-token field or incomplete_token field in the first flow?
// @todo - revisit.
if (method_exists($this->gateway, 'completePurchase') && !isset($params['payment_action']) && empty($params['is_recur'])) {
$action = 'completePurchase';
}
......
......@@ -42,10 +42,11 @@ function civicrm_api3_job_process_recurring($params) {
'contributionID' => $pending['id'],
'contactID' => $originalContribution['contact_id'],
'description' => ts('Repeat payment, original was ' . $originalContribution['id']),
'token' => civicrm_api3('PaymentToken', 'getvalue', array(
'token' => civicrm_api3('PaymentToken', 'getvalue', [
'id' => $recurringPayment['payment_token_id'],
'return' => 'token',
)),
]),
'payment_action' => 'purchase',
));
$payment = reset($payment['values']);
......
<?php
/**
* Action payment.
*
* @param array $params
*
* @return array
* API result array.
* @throws CiviCRM_API3_Exception
*/
function civicrm_api3_payment_processor_pay($params) {
$processor = Civi\Payment\System::singleton()->getById($params['payment_processor_id']);
$processor->setPaymentProcessor(civicrm_api3('PaymentProcessor', 'getsingle', array('id' => $params['payment_processor_id'])));
$result = $processor->doPayment($params);
if (is_a($result, 'CRM_Core_Error')) {
throw API_Exception('Payment failed');
}
return civicrm_api3_create_success(array($result), $params);
}
/**
* Action payment.
*
* @param array $params
*
* @return array
*/
function _civicrm_api3_payment_processor_pay_spec(&$params) {
$params['payment_processor_id']['api.required'] = 1;
$params['amount']['api.required'] = 1;
$params['payment_action'] = array(
'api.default' => 'purchase',
);
}
......@@ -14,8 +14,8 @@
<url desc="Support">http://forum.civicrm.org</url>
<url desc="Licensing">http://civicrm.org/licensing</url>
</urls>
<releaseDate>2019-04-04</releaseDate>
<version>3.2</version>
<releaseDate>2019-27-04</releaseDate>
<version>3.3</version>
<develStage>stable</develStage>
<compatibility>
<ver>5.13</ver>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment