Skip to content

Commit b1d8033

Browse files
Modernise exceptions
1 parent 5875af7 commit b1d8033

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

CRM/Core/Payment/OmnipayMultiProcessor.php

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ public function doPayment(&$params, $component = 'contribute') {
256256
*
257257
* @param array $params
258258
*
259-
* @throws \CiviCRM_API3_Exception
259+
* @throws \CRM_Core_Exception
260260
* @throws \CRM_Core_Exception
261261
*/
262262
protected function initialize(&$params) {
@@ -394,7 +394,7 @@ public function setProcessorFields(): void {
394394
* @return array
395395
* Payment processor configuration fields
396396
*
397-
* @throws CiviCRM_API3_Exception
397+
* @throws CRM_Core_Exception
398398
*/
399399
public function getProcessorFields(): array {
400400
$labelFields = $result = [];
@@ -643,7 +643,7 @@ public function checkConfig() {
643643
*
644644
* @return array
645645
*
646-
* @throws CiviCRM_API3_Exception
646+
* @throws CRM_Core_Exception
647647
*/
648648
public function getPaymentFormFields() {
649649
$fields = $this->getProcessorTypeMetadata('payment_fields');
@@ -743,7 +743,7 @@ public function getTransparentDirectDisplayFields() {
743743
* @param int $billingLocationID
744744
*
745745
* @return array
746-
* @throws \CiviCRM_API3_Exception
746+
* @throws \CRM_Core_Exception
747747
*/
748748
public function getBillingAddressFields($billingLocationID = NULL) {
749749
$fields = $this->getProcessorTypeMetadata('fields');
@@ -808,7 +808,7 @@ public function handlePaymentNotification() {
808808
* @param array $params
809809
*
810810
* @throws CRM_Core_Exception
811-
* @throws CiviCRM_API3_Exception
811+
* @throws CRM_Core_Exception
812812
*/
813813
public function processPaymentNotification($params) {
814814
$this->createGateway($params['processor_id']);
@@ -863,7 +863,7 @@ public function processPaymentNotification($params) {
863863
$this->storePaymentToken(array_merge($params, ['contact_id' => $this->contribution['contact_id']]), $this->contribution['contribution_recur_id'], $tokenReference);
864864
}
865865
}
866-
catch (CiviCRM_API3_Exception $e) {
866+
catch (CRM_Core_Exception $e) {
867867
if (stripos($e->getMessage(), 'Contribution already completed') === FALSE) {
868868
$this->handleError('error', 'ipn_completion failed', $this->transaction_id . $e->getMessage(), 9000, 'An error may have occurred. Please check your receipt is correct');
869869
}
@@ -921,7 +921,7 @@ public function queryPaymentPlans($params) {
921921
* @return mixed
922922
*
923923
* @throws \CRM_Core_Exception
924-
* @throws \CiviCRM_API3_Exception
924+
* @throws \CRM_Core_Exception
925925
*/
926926
public function query($params) {
927927
$this->createGateway($this->_paymentProcessor['id']);
@@ -938,7 +938,7 @@ public function query($params) {
938938
* @param array $params
939939
*
940940
* @return bool
941-
* @throws CiviCRM_API3_Exception
941+
* @throws CRM_Core_Exception
942942
* @throws \CRM_Core_Exception
943943
*/
944944
public static function processPaymentResponse($params) {
@@ -1015,7 +1015,7 @@ protected function redirectOrExit($outcome, $response = NULL) {
10151015
* @param array $contribution
10161016
* @param string $tokenReference
10171017
*
1018-
* @throws \CiviCRM_API3_Exception
1018+
* @throws \CRM_Core_Exception
10191019
*/
10201020
protected function storePaymentToken($params, $contributionRecurID, $tokenReference) {
10211021
$tokenID = $this->savePaymentToken(array_merge($params, [
@@ -1041,7 +1041,7 @@ protected function storePaymentToken($params, $contributionRecurID, $tokenRefere
10411041
* It's kind of 'hacked on' to the payment_processor params normally but not when called form
10421042
* the pay api.
10431043
*
1044-
* @throws \CiviCRM_API3_Exception
1044+
* @throws \CRM_Core_Exception
10451045
*/
10461046
protected function ensurePaymentProcessorTypeIsSet() {
10471047
if (!isset($this->_paymentProcessor['payment_processor_type'])) {
@@ -1060,7 +1060,7 @@ protected function ensurePaymentProcessorTypeIsSet() {
10601060
* Generally (and in the case of Cybersource specifically) they collect billing details first.
10611061
*
10621062
* @return bool
1063-
* @throws \CiviCRM_API3_Exception
1063+
* @throws \CRM_Core_Exception
10641064
*/
10651065
private function isTransparentRedirect() {
10661066
$paymentType = civicrm_api3('option_value', 'getsingle', [
@@ -1287,7 +1287,7 @@ public function doRecurPostApproval(&$params) {
12871287
* form (UpdateSubscription).
12881288
*
12891289
* @return array
1290-
* @throws \CiviCRM_API3_Exception
1290+
* @throws \CRM_Core_Exception
12911291
*/
12921292
public function getEditableRecurringScheduleFields() {
12931293
$possibles = ['amount'];
@@ -1307,7 +1307,7 @@ public function getEditableRecurringScheduleFields() {
13071307
* @param int $id
13081308
*
13091309
* @throws \CRM_Core_Exception
1310-
* @throws \CiviCRM_API3_Exception
1310+
* @throws \CRM_Core_Exception
13111311
*/
13121312
private function createGateway($id) {
13131313
$paymentProcessorTypeId = civicrm_api3('payment_processor', 'getvalue', [
@@ -1629,7 +1629,7 @@ public function getText($context, $params) {
16291629

16301630
/**
16311631
* @return array
1632-
* @throws \CiviCRM_API3_Exception
1632+
* @throws \CRM_Core_Exception
16331633
*/
16341634
protected function loadContribution(): array {
16351635
if (!$this->contribution) {
@@ -1691,7 +1691,7 @@ protected function gatewayConfirmContribution($response): void {
16911691
* @param array $params
16921692
*
16931693
* @return int
1694-
* @throws \CiviCRM_API3_Exception
1694+
* @throws \CRM_Core_Exception
16951695
*/
16961696
protected function savePaymentToken(array $params): int {
16971697
$params['contact_id'] = $this->getContactID($params);
@@ -1766,7 +1766,8 @@ protected function updatePaymentTokenWithAnyExtraData(string $trxnReference) {
17661766
]);
17671767
}
17681768
}
1769-
} catch (CiviCRM_API3_Exception $e) {
1769+
}
1770+
catch (CRM_Core_Exception $e) {
17701771
$this->log('possible error saving token', ['error' => $e->getMessage()]);
17711772
}
17721773
}

0 commit comments

Comments
 (0)