Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CiviCRM Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
CiviCRM Core
Commits
ffadd264
Unverified
Commit
ffadd264
authored
5 years ago
by
mattwire
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #15417 from eileenmcnaughton/matt
Add trxn_id as a parameter on Payment.get
parents
6cd53c79
c4204541
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/v3/Payment.php
+7
-0
7 additions, 0 deletions
api/v3/Payment.php
tests/phpunit/api/v3/PaymentTest.php
+46
-0
46 additions, 0 deletions
tests/phpunit/api/v3/PaymentTest.php
with
53 additions
and
0 deletions
api/v3/Payment.php
+
7
−
0
View file @
ffadd264
...
...
@@ -47,6 +47,9 @@ function civicrm_api3_payment_get($params) {
$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
=
[];
...
...
@@ -210,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
,
],
];
}
...
...
This diff is collapsed.
Click to expand it.
tests/phpunit/api/v3/PaymentTest.php
+
46
−
0
View file @
ffadd264
...
...
@@ -107,6 +107,52 @@ class api_v3_PaymentTest extends CiviUnitTestCase {
]);
}
/**
* Retrieve Payment using trxn_id.
*/
public
function
testGetPaymentWithTrxnID
()
{
$this
->
_individualId2
=
$this
->
individualCreate
();
$params1
=
[
'contact_id'
=>
$this
->
_individualId
,
'trxn_id'
=>
111111
,
'total_amount'
=>
10
,
];
$contributionID1
=
$this
->
contributionCreate
(
$params1
);
$params2
=
[
'contact_id'
=>
$this
->
_individualId2
,
'trxn_id'
=>
222222
,
'total_amount'
=>
20
,
];
$contributionID2
=
$this
->
contributionCreate
(
$params2
);
$paymentParams
=
[
'trxn_id'
=>
111111
];
$payment
=
$this
->
callAPISuccess
(
'payment'
,
'get'
,
$paymentParams
);
$expectedResult
=
[
$payment
[
'id'
]
=>
[
'total_amount'
=>
10
,
'trxn_id'
=>
111111
,
'status_id'
=>
1
,
'is_payment'
=>
1
,
'contribution_id'
=>
$contributionID1
,
],
];
$this
->
checkPaymentResult
(
$payment
,
$expectedResult
);
$paymentParams
=
[
'trxn_id'
=>
222222
];
$payment
=
$this
->
callAPISuccess
(
'payment'
,
'get'
,
$paymentParams
);
$expectedResult
=
[
$payment
[
'id'
]
=>
[
'total_amount'
=>
20
,
'trxn_id'
=>
222222
,
'status_id'
=>
1
,
'is_payment'
=>
1
,
'contribution_id'
=>
$contributionID2
,
],
];
$this
->
checkPaymentResult
(
$payment
,
$expectedResult
);
}
/**
* Test email receipt for partial payment.
*/
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment