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
189e6408
Commit
189e6408
authored
5 years ago
by
eileen
Browse files
Options
Downloads
Patches
Plain Diff
Revert "
financial#77
++ Make contribution_id mandatory for PaymentProcessor.pay, pass incoieID"
This reverts commit
783b62a7
.
parent
3fe06aa5
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/PaymentProcessor.php
+2
-4
2 additions, 4 deletions
api/v3/PaymentProcessor.php
tests/phpunit/api/v3/PaymentProcessorTest.php
+0
-42
0 additions, 42 deletions
tests/phpunit/api/v3/PaymentProcessorTest.php
with
2 additions
and
46 deletions
api/v3/PaymentProcessor.php
+
2
−
4
View file @
189e6408
...
...
@@ -124,10 +124,8 @@ function _civicrm_api3_payment_processor_getlist_defaults(&$request) {
* API result array.
*
* @throws \API_Exception
* @throws \CiviCRM_API3_Exception
*/
function
civicrm_api3_payment_processor_pay
(
$params
)
{
/* @var CRM_Core_Payment $processor */
$processor
=
Civi\Payment\System
::
singleton
()
->
getById
(
$params
[
'payment_processor_id'
]);
$processor
->
setPaymentProcessor
(
civicrm_api3
(
'PaymentProcessor'
,
'getsingle'
,
[
'id'
=>
$params
[
'payment_processor_id'
]]));
try
{
...
...
@@ -141,7 +139,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
);
}
/**
...
...
@@ -151,7 +149,7 @@ function civicrm_api3_payment_processor_pay($params) {
*/
function
_civicrm_api3_payment_processor_pay_spec
(
&
$params
)
{
$params
[
'payment_processor_id'
]
=
[
'api.required'
=>
TRUE
,
'api.required'
=>
1
,
'title'
=>
ts
(
'Payment processor'
),
'type'
=>
CRM_Utils_Type
::
T_INT
,
];
...
...
This diff is collapsed.
Click to expand it.
tests/phpunit/api/v3/PaymentProcessorTest.php
+
0
−
42
View file @
189e6408
...
...
@@ -35,11 +35,6 @@ class api_v3_PaymentProcessorTest extends CiviUnitTestCase {
protected
$_apiversion
=
3
;
protected
$_params
;
/**
* Set up for class.
*
* @throws \CRM_Core_Exception
*/
public
function
setUp
()
{
parent
::
setUp
();
$this
->
useTransaction
(
TRUE
);
...
...
@@ -74,8 +69,6 @@ class api_v3_PaymentProcessorTest extends CiviUnitTestCase {
/**
* Create payment processor.
*
* @throws \Exception
*/
public
function
testPaymentProcessorCreate
()
{
$params
=
$this
->
_params
;
...
...
@@ -95,8 +88,6 @@ class api_v3_PaymentProcessorTest extends CiviUnitTestCase {
/**
* Update payment processor.
*
* @throws \CRM_Core_Exception
*/
public
function
testPaymentProcessorUpdate
()
{
$params
=
$this
->
_params
;
...
...
@@ -140,8 +131,6 @@ class api_v3_PaymentProcessorTest extends CiviUnitTestCase {
/**
* Check payment processor delete.
*
* @throws \CRM_Core_Exception
*/
public
function
testPaymentProcessorDelete
()
{
$result
=
$this
->
callAPISuccess
(
'payment_processor'
,
'create'
,
$this
->
_params
);
...
...
@@ -154,8 +143,6 @@ class api_v3_PaymentProcessorTest extends CiviUnitTestCase {
/**
* Check with valid params array.
*
* @throws \CRM_Core_Exception
*/
public
function
testPaymentProcessorsGet
()
{
$params
=
$this
->
_params
;
...
...
@@ -171,33 +158,4 @@ class api_v3_PaymentProcessorTest extends CiviUnitTestCase {
$this
->
assertEquals
(
'test@test.com'
,
$results
[
'values'
][
$results
[
'id'
]][
'user_name'
]);
}
/**
* Test the processor passed to the hook can access the relevant variables.
*
* @throws \CRM_Core_Exception
* @throws \CiviCRM_API3_Exception
*/
public
function
testPaymentProcessorPay
()
{
$this
->
hookClass
->
setHook
(
'civicrm_alterPaymentProcessorParams'
,
[
$this
,
'hook_civicrm_alterPaymentProcessorParams'
]);
$processor
=
$this
->
dummyProcessorCreate
();
$this
->
callAPISuccess
(
'PaymentProcessor'
,
'pay'
,
[
'payment_processor_id'
=>
$processor
->
getID
(),
'contribution_id'
=>
10
,
'invoice_id'
=>
2
,
'contribution_recur_id'
=>
3
,
'amount'
=>
6
,
]);
}
/**
* Implements civicrm_alterPaymentProcessorParams hook.
*
* @param \CRM_Core_Payment_Dummy $paymentObject
*/
public
function
hook_civicrm_alterPaymentProcessorParams
(
$paymentObject
)
{
$this
->
assertEquals
(
10
,
$paymentObject
->
getContributionID
());
$this
->
assertEquals
(
2
,
$paymentObject
->
getInvoiceID
());
$this
->
assertEquals
(
3
,
$paymentObject
->
getContributionRecurID
());
}
}
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