X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=api%2Fv3%2FPayment.php;h=4ec6647c22d3aa4f455d7588f9debd577e4f0bde;hb=8b056441a3578c3e29f545865cbc951ddaa740c0;hp=73143111474d898f4cd1baafbeddf650fe1752c4;hpb=4c274652821b1e1a4410c12318820fe76d3cdf44;p=civicrm-core.git diff --git a/api/v3/Payment.php b/api/v3/Payment.php index 7314311147..4ec6647c22 100644 --- a/api/v3/Payment.php +++ b/api/v3/Payment.php @@ -43,10 +43,13 @@ function civicrm_api3_payment_get($params) { $financialTrxn = []; $limit = ''; - if (isset($params['options']) && CRM_Utils_Array::value('limit', $params['options'])) { + if (isset($params['options']) && !empty($params['options']['limit'])) { $limit = CRM_Utils_Array::value('limit', $params['options']); } $params['options']['limit'] = 0; + if (isset($params['trxn_id'])) { + $params['financial_trxn_id.trxn_id'] = $params['trxn_id']; + } $eft = civicrm_api3('EntityFinancialTrxn', 'get', $params); if (!empty($eft['values'])) { $eftIds = []; @@ -84,7 +87,7 @@ function civicrm_api3_payment_get($params) { * @return array * Api result array */ -function civicrm_api3_payment_delete(&$params) { +function civicrm_api3_payment_delete($params) { return civicrm_api3('FinancialTrxn', 'delete', $params); } @@ -98,7 +101,7 @@ function civicrm_api3_payment_delete(&$params) { * @return array * Api result array */ -function civicrm_api3_payment_cancel(&$params) { +function civicrm_api3_payment_cancel($params) { $eftParams = [ 'entity_table' => 'civicrm_contribution', 'financial_trxn_id' => $params['id'], @@ -130,9 +133,9 @@ function civicrm_api3_payment_cancel(&$params) { * @return array * Api result array */ -function civicrm_api3_payment_create(&$params) { +function civicrm_api3_payment_create($params) { // Check if it is an update - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { $amount = $params['total_amount']; civicrm_api3('Payment', 'cancel', $params); $params['total_amount'] = $amount; @@ -178,6 +181,12 @@ function _civicrm_api3_payment_create_spec(&$params) { 'title' => ts('Cancel Date'), 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, ], + 'is_send_contribution_notification' => [ + 'title' => ts('Send out notifications based on contribution status change?'), + 'description' => ts('Most commonly this equates to emails relating to the contribution, event, etcwhen a payment completes a contribution'), + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'api.default' => TRUE, + ], ]; } @@ -204,6 +213,10 @@ function _civicrm_api3_payment_get_spec(&$params) { 'type' => CRM_Utils_Type::T_INT, 'api.aliases' => ['contribution_id'], ], + 'trxn_id' => [ + 'title' => 'Transaction ID', + 'type' => CRM_Utils_Type::T_STRING, + ], ]; }