Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REF][Test] Remove call to CRM_Contribute_BAO_Contribution::recordAdditionalPayment in favour of payment create #14137

Merged
merged 1 commit into from
May 20, 2019

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Apr 26, 2019

Overview

Remove call to CRM_Contribute_BAO_Contribution::recordAdditionalPayment in favour of using Payment.create api. This exposes that the Payment.create api currently adds an extra transaction for refunds where the status is changed to completetransaction & handles that

Before

Less tests. Extra financial trxn created when adding a refund payment through the Payment.create api

After

More tests. Extra financial trxn not created when adding a refund payment through the Payment.create api

Technical Details

The goal here is to remove recordAdditionalPayment and call the Payment.create api instead. In order to do this we have been working to ensure the functionality is equivalent and tested.

With this merged I still see 2 gaps

  1. creating an activity from Payment.create api - should be pretty simple
  2. currently when you record a refund payment (of any amount) with a participant id ALL related participant records are set to 'Registered' - this seems kinda odd but we could probably transfer into the payment.create BAO & retain for now.

Comments

FYI @pradpnayak @jitendrapurohit @monishdeb

@civibot
Copy link

civibot bot commented Apr 26, 2019

(Standard links)

@civibot civibot bot added the master label Apr 26, 2019
@eileenmcnaughton
Copy link
Contributor Author

that's weird - it succeeded but didn't update github....

Setting status of efb8bd57a6c8518a7eae5810c6a235d35b5a0a12 to SUCCESS with url https://test.civicrm.org:443/job/CiviCRM-Core-PR/25967/ and message: 'Build finished. '
Could not update commit status of the Pull Request on GitHub.
org.kohsuke.github.HttpException: {
  "message": "Server Error"
}

	at org.kohsuke.github.Requester.handleApiError(Requester.java:695)
	at org.kohsuke.github.Requester._to(Requester.java:298)
	at org.kohsuke.github.Requester.to(Requester.java:239)
	at org.kohsuke.github.GHRepository.createCommitStatus(GHRepository.java:1083)
	at org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus.createCommitStatus(GhprbSimpleStatus.java:283)
	at org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus.onBuildComplete(GhprbSimpleStatus.java:241)
	at org.jenkinsci.plugins.ghprb.GhprbBuilds.onCompleted(GhprbBuilds.java:205)
	at org.jenkinsci.plugins.ghprb.GhprbBuildListener.onCompleted(GhprbBuildListener.java:28)
	at hudson.model.listeners.RunListener.fireCompleted(RunListener.java:211)
	at hudson.model.Run.execute(Run.java:1861)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
	at hudson.model.ResourceController.execute(ResourceController.java:97)
	at hudson.model.Executor.run(Executor.java:429)
Caused by: org.kohsuke.github.HttpException: Server returned HTTP response code: 502, message: 'Bad Gateway' for URL: https://api.github.com/repos/civicrm/civicrm-core/statuses/efb8bd57a6c8518a7eae5810c6a235d35b5a0a12
	at org.kohsuke.github.Requester.parse(Requester.java:638)
	at org.kohsuke.github.Requester.parse(Requester.java:599)
	at org.kohsuke.github.Requester._to(Requester.java:277)
	... 11 more
Caused by: java.io.IOException: Server returned HTTP response code: 502 for URL: https://api.github.com/repos/civicrm/civicrm-core/statuses/efb8bd57a6c8518a7eae5810c6a235d35b5a0a12
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1944)
	at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1939)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1938)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1508)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:263)
	at org.kohsuke.github.Requester.parse(Requester.java:617)
	... 13 more
Caused by: java.io.IOException: Server returned HTTP response code: 502 for URL: https://api.github.com/repos/civicrm/civicrm-core/statuses/efb8bd57a6c8518a7eae5810c6a235d35b5a0a12
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1894)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
	at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:347)
	at org.kohsuke.github.Requester.parse(Requester.java:607)
	... 13 more
Finished: SUCCESS

@eileenmcnaughton
Copy link
Contributor Author

test this please

@eileenmcnaughton
Copy link
Contributor Author

@monishdeb @pradpnayak @jitendrapurohit anyone want to take a look? With this merged the only gaps for using Payment.create for refunds from the form are the activity - a step on that is here #14269 and the participant status handling - which is odd but...

@monishdeb
Copy link
Member

Yup happy with this patch, tested on my local and it worked fine. Also the added tests passes. Merging it now

@monishdeb monishdeb merged commit 2cb21b0 into civicrm:master May 20, 2019
@eileenmcnaughton eileenmcnaughton deleted the pay_up branch May 20, 2019 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants