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] Extract activity payment creation #13695

Merged
merged 1 commit into from
Mar 4, 2019

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Feb 25, 2019

Overview

Minor code cleanup

Before

Code less readable

After

code more readable

Technical Details

I suspect this might also go on the payment class but that might be next - it could also do with a another round of tidy up since it's 2 functions when only one is needed

Comments

The following doesn't block merging this change which is a refactor - but it is commentary on possible next steps

Should the payment.create bao call this? I feel like maybe it should call this if it doesn't result in completetransaction (which would have other activities ) - in our ideal flow we would create an order (pending) process a payment & add a payment when it's complete (potentially completing the order) - if these things happen all at the same time it might be odd to have too many activities created

@civibot
Copy link

civibot bot commented Feb 25, 2019

(Standard links)

THis is likely not it's last resting place but it does make the functions involved a lot simpler now
@eileenmcnaughton
Copy link
Contributor Author

test this please

2 similar comments
@eileenmcnaughton
Copy link
Contributor Author

test this please

@eileenmcnaughton
Copy link
Contributor Author

test this please

@monishdeb
Copy link
Member

@eileenmcnaughton two points:

  1. Why can't we move addActivityForPayment in Payment BAO after making some additional changes in it, because its only called by Contribution::recordAdditionalPayment in entire codebase. And then we will no longer need to have new fn recordPaymentActivity ?
  2. I think its ok to create Activity of type Refund or Payment. And rest of the activities are necessary to indicate contribution is completed, receipt is sent after completeOrder is being called.

@eileenmcnaughton
Copy link
Contributor Author

@monishdeb so in terms of 1 - this was just intended as a small step - not necessarily the final form of the function. I think addActivityForPayment should be re-merged back into recordPaymentActivity & the function cleaned up as the next step

in terms of 2 - I guess my worry is just that it's a behaviour change if we always create activities - & I feel like some wider buy in is needed

@eileenmcnaughton
Copy link
Contributor Author

@monishdeb shall we merge this - I think your comments were along the lines of 'could go further' - which I agree with but this seems like a step in the right direction

@monishdeb
Copy link
Member

umm yeah rightful step, ok I am gonna merge this! As reviewed earlier, nothing changes since then and all the code is safely shipped to this new fn. Merging now.

@monishdeb monishdeb merged commit b891f1a into civicrm:master Mar 4, 2019
@eileenmcnaughton eileenmcnaughton deleted the extract_activity branch March 4, 2019 03:38
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