X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=api%2Fv3%2FPaymentProcessor.php;h=ea54aca4e1c2f513653908a9aca44fdd0d4b8450;hb=867308b9118fa03058555e3bae6e67c9f3ddccd9;hp=8373cc7ec7c8174995f81830715f85980aba15a9;hpb=a0827f986d6c393a9450df0a5937ee0d60f10da3;p=civicrm-core.git diff --git a/api/v3/PaymentProcessor.php b/api/v3/PaymentProcessor.php index 8373cc7ec7..ea54aca4e1 100644 --- a/api/v3/PaymentProcessor.php +++ b/api/v3/PaymentProcessor.php @@ -3,7 +3,7 @@ +--------------------------------------------------------------------+ | CiviCRM version 5 | +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2019 | + | Copyright CiviCRM LLC (c) 2004-2020 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | @@ -65,7 +65,13 @@ function _civicrm_api3_payment_processor_create_spec(&$params) { $params['domain_id']['api.default'] = CRM_Core_Config::domainID(); $params['financial_account_id']['api.default'] = CRM_Financial_BAO_PaymentProcessor::getDefaultFinancialAccountID(); $params['financial_account_id']['api.required'] = TRUE; + $params['financial_account_id']['type'] = CRM_Utils_Type::T_INT; $params['financial_account_id']['title'] = ts('Financial Account for Processor'); + $params['financial_account_id']['pseudoconstant'] = [ + 'table' => 'civicrm_financial_account', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ]; } /** @@ -131,15 +137,6 @@ function civicrm_api3_payment_processor_pay($params) { $processor = Civi\Payment\System::singleton()->getById($params['payment_processor_id']); $processor->setPaymentProcessor(civicrm_api3('PaymentProcessor', 'getsingle', ['id' => $params['payment_processor_id']])); try { - $processor->setContributionID($params['contribution_id']); - $processor->setInvoiceID($params['invoice_id'] ?? ''); - if (!empty($params['contact_id'])) { - $processor->setContactID((int) $params['contact_id']); - } - if (!empty($params['contribution_recur_id'])) { - $processor->setContributionRecurID((int) $params['contribution_recur_id']); - } - $result = $processor->doPayment($params); } catch (\Civi\Payment\Exception\PaymentProcessorException $e) { @@ -150,7 +147,7 @@ function civicrm_api3_payment_processor_pay($params) { } throw new API_Exception('Payment failed', $code, $errorData, $e); } - return civicrm_api3_create_success([$result], $params); + return civicrm_api3_create_success(array($result), $params); } /**