Skip to content
Snippets Groups Projects
Commit 42d921ea authored by mattwire's avatar mattwire
Browse files

Replace deprecated CiviCRM_API3_Exception

parent c63908d5
No related branches found
No related tags found
No related merge requests found
......@@ -235,7 +235,7 @@ trait CRM_Core_Payment_MJWIPNTrait {
* Cancel a subscription (recurring contribution)
* @param array $params
*
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
* @throws \Civi\Payment\Exception\PaymentProcessorException
*/
protected function updateRecurCancelled($params) {
......@@ -247,7 +247,7 @@ trait CRM_Core_Payment_MJWIPNTrait {
* Update the subscription (recurring contribution) to a successful status
* @param array $params
*
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
* @throws \Civi\Payment\Exception\PaymentProcessorException
*/
private function updateRecurSuccess($params) {
......@@ -263,7 +263,7 @@ trait CRM_Core_Payment_MJWIPNTrait {
* Update the subscription (recurring contribution) to a completed status
* @param array $params
*
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
* @throws \Civi\Payment\Exception\PaymentProcessorException
*/
private function updateRecurCompleted($params) {
......@@ -279,7 +279,7 @@ trait CRM_Core_Payment_MJWIPNTrait {
* Update the subscription (recurring contribution) to a failing status
* @param array $params
*
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
* @throws \Civi\Payment\Exception\PaymentProcessorException
*/
private function updateRecurFailed($params) {
......@@ -304,7 +304,7 @@ trait CRM_Core_Payment_MJWIPNTrait {
* @param array $repeatContributionParams
*
* @return int
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
* @throws \Civi\Payment\Exception\PaymentProcessorException
*/
private function repeatContribution(array $repeatContributionParams): int {
......@@ -385,7 +385,7 @@ trait CRM_Core_Payment_MJWIPNTrait {
/**
* @param array $params
*
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
* @throws \Civi\Payment\Exception\PaymentProcessorException
*/
private function updateContribution($params) {
......@@ -404,7 +404,7 @@ trait CRM_Core_Payment_MJWIPNTrait {
*
* @param array $contributionParams
*
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
* @throws \Civi\Payment\Exception\PaymentProcessorException
*/
private function updateContributionCompleted(array $contributionParams) {
......@@ -454,7 +454,7 @@ trait CRM_Core_Payment_MJWIPNTrait {
*
* @param array $params ['contribution_id', 'order_reference'{, cancel_date, cancel_reason}]
*
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
* @throws \Civi\Payment\Exception\PaymentProcessorException
*/
private function updateContributionFailed($params) {
......@@ -510,7 +510,7 @@ trait CRM_Core_Payment_MJWIPNTrait {
* @param array $params
*
* @throws \CRM_Core_Exception
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
*/
protected function updateContributionRefund($params) {
$this->checkRequiredParams('updateContributionRefund', ['contribution_id', 'total_amount'], $params);
......
......@@ -216,7 +216,7 @@ trait CRM_Core_Payment_MJWTrait {
* @param array $params ['name' => payment instrument name]
*
* @return int|null
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
*/
public static function createPaymentInstrument($params) {
$mandatoryParams = ['name'];
......@@ -437,6 +437,9 @@ trait CRM_Core_Payment_MJWTrait {
}
/**
* Call this at the beginning of call to CRM_Core_Payment::doPayment()
* to ensure that all necessary parameters are set.
*
* @param \Civi\Payment\PropertyBag $propertyBag
*
* @return \Civi\Payment\PropertyBag
......@@ -466,6 +469,33 @@ trait CRM_Core_Payment_MJWTrait {
}
/**
* Call this at the beginning of call to CRM_Core_Payment::doRefund()
* to ensure that all necessary parameters are set.
*
* @param \Civi\Payment\PropertyBag|array $propertyBag
*
* @return \Civi\Payment\PropertyBag
*/
protected function beginDoRefund($propertyBag) {
// Make sure it's a propertyBag
$propertyBag = PropertyBag::cast($propertyBag);
// Make sure we have a contactID set on propertyBag
$this->getContactId($propertyBag);
// In 5.72 propertyBag maps transaction_id to transactionID but trxn_id is not mapped
// Once we add trxn_id then ->has('transactionID') will be TRUE and the set won't be run.
if (!$propertyBag->has('transactionID') && $propertyBag->has('trxn_id')) {
$propertyBag->setTransactionID($propertyBag->getCustomProperty('trxn_id'));
}
return $propertyBag;
}
/**
* Call this at the beginning of call to CRM_Core_Payment::changeSubscriptionAmount()
* to ensure that all necessary parameters are set.
*
* @param array $params
*
* @return \Civi\Payment\PropertyBag
......@@ -515,6 +545,9 @@ trait CRM_Core_Payment_MJWTrait {
}
/**
* Call this at the beginning of call to CRM_Core_Payment::updateSubscriptionBillingInfo()
* to ensure that all necessary parameters are set.
*
* @param array $params
*
* @return \Civi\Payment\PropertyBag
......@@ -567,12 +600,13 @@ trait CRM_Core_Payment_MJWTrait {
}
/**
* Call this at the end of a call to doPayment to ensure everything is updated/returned correctly.
* Call this at the end of a call to CRM_Core_Payment::doPayment() to build the
* standard return parameters array.
*
* @param \Civi\Payment\PropertyBag|array $params
*
* @return array
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
*/
protected function endDoPayment($params) {
$propertyBag = PropertyBag::cast($params);
......
......@@ -38,7 +38,7 @@ class CRM_Mjwshared_Check {
/**
* @return array
* @throws \API_Exception
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
* @throws \Civi\API\Exception\UnauthorizedException
*/
public function checkRequirements() {
......@@ -95,7 +95,7 @@ class CRM_Mjwshared_Check {
}
/**
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
*/
private function checkExtensionWorldpay() {
$extensions = civicrm_api3('Extension', 'get', [
......@@ -116,7 +116,7 @@ class CRM_Mjwshared_Check {
}
/**
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
*/
private function checkExtensionMinifier() {
$extensionName = 'minifier';
......@@ -144,7 +144,7 @@ class CRM_Mjwshared_Check {
}
/**
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
*/
private function checkExtensionContributiontransactlegacy() {
$extensionName = 'contributiontransactlegacy';
......@@ -179,7 +179,7 @@ class CRM_Mjwshared_Check {
* We don't support "Separate Membership Payment" configuration
*
* @throws \API_Exception
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
* @throws \Civi\API\Exception\UnauthorizedException
*/
private function checkIfSeparateMembershipPaymentEnabled() {
......@@ -235,7 +235,7 @@ class CRM_Mjwshared_Check {
}
/**
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
*/
private function checkExtensionSweetalert() {
// sweetalert: recommended. If installed requires min version
......@@ -271,7 +271,7 @@ class CRM_Mjwshared_Check {
/**
* @throws \API_Exception
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
* @throws \Civi\API\Exception\UnauthorizedException
*/
private function checkMultidomainJobs() {
......
......@@ -22,7 +22,7 @@ class CRM_Mjwshared_Utils {
* @param bool $fullString If TRUE return "custom_25", If FALSE return "25"
*
* @return int|string
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
*/
public static function getCustomByName($fieldName, $fieldGroup, $fullString = TRUE) {
if (!isset(Civi::$statics[__CLASS__][$fieldGroup][$fieldName])) {
......
......@@ -6,7 +6,7 @@
*
* @return array
* API result array.
* @throws CiviCRM_API3_Exception
* @throws CRM_Core_Exception
*/
function civicrm_api3_contribution_getbalance($params) {
$result['id'] = $params['id'];
......
......@@ -18,7 +18,7 @@ use Civi\Api4\PaymentprocessorWebhook;
*
* @return array
* API result array.
* @throws CiviCRM_API3_Exception
* @throws CRM_Core_Exception
*/
function civicrm_api3_job_process_paymentprocessor_webhooks($params) {
// @fixme: remove when minversion = 5.38
......
......@@ -144,7 +144,7 @@ function _civicrm_api3_mjwpayment_get_payment_spec(&$params) {
*
* @return array
* Array of financial transactions which are payments, if error an array with an error id and error message
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
*/
function civicrm_api3_mjwpayment_get_payment($params) {
return civicrm_api3_payment_get($params);
......@@ -182,7 +182,7 @@ function _civicrm_api3_mjwpayment_create_payment_spec(&$params) {
* Api result array
*
* @throws \CRM_Core_Exception
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
*/
function civicrm_api3_mjwpayment_create_payment($params) {
if (empty($params['skipCleanMoney'])) {
......
......@@ -71,7 +71,7 @@ function mjwshared_symfony_civicrm_coreResourceList($event, $hook) {
/**
* Implements hook_civicrm_check().
*
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
*/
function mjwshared_civicrm_check(&$messages) {
$checks = new CRM_Mjwshared_Check($messages);
......@@ -82,7 +82,7 @@ function mjwshared_civicrm_check(&$messages) {
* @param \Civi\Core\Event\GenericHookEvent $event
* @param $hook
*
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
*/
function mjwshared_symfony_civicrm_buildAsset($event, $hook) {
$extensions = civicrm_api3('Extension', 'get', [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment