-
Notifications
You must be signed in to change notification settings - Fork 106
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
Update contribution transact code to use version from contributiontransactlegacy extension #437
Conversation
/** | ||
* Adjust Metadata for Transact action. | ||
* | ||
* The metadata is used for setting defaults, documentation & validation. | ||
* | ||
* @param array $params | ||
* Array of parameters determined by getfields. | ||
*/ | ||
function _wf_civicrm_api3_contribution_transact_spec(&$params) { | ||
$fields = civicrm_api3('Contribution', 'getfields', ['action' => 'create']); | ||
$params = array_merge($params, $fields['values']); | ||
$params['receive_date']['api.default'] = 'now'; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@KarinG Why did you include this in the original PR? I don't think it is relevant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh that was just a copy/paste. I noticed you had that in your replacement Extension as well and figured it may be useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It won't do anything except in the context of API3 so not needed here.
|
||
$paymentProcessor = \CRM_Financial_BAO_PaymentProcessor::getPayment($params['payment_processor'], $params['payment_processor_mode']); | ||
$paymentProcessor['object']->doPayment($params); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No more doPayment
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's called via PaymentProcessor.Pay
API.
|
||
$reflectionClass = new ReflectionClass($propertyBag); | ||
$reflectionProperty = $reflectionClass->getProperty('props'); | ||
$reflectionProperty->setAccessible(TRUE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is ReflectionClass()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have now added a comment to the code. It's a way of accessing protected vars/methods in a class because civicrm/civicrm-core#17507 has not (yet) been merged... We need PropertyBag as an array and this gets it.
654bc54
to
a39a0eb
Compare
…nsactlegacy extension
77829ef
to
be9ac14
Compare
Excellent @mattwire - looks like you have the ContributionPageTest ✅ working! I'll have a look later today or tomorrow - specifically at invoiceIDs. Do you have access to a 'live' test account for Stripe (like I have for iATS) so that you can add a Functional Javascript Test? Copy ContributionPageTest to ContributionPageStripeTest -> i.e. make a new one for Stripe specifically. It would be awesome to ensure we have iATS and Stripe coverage for D8 & D9! |
Ok merging this - assuming that will make it easier for you to add a Summary - this PR passes automated tests for:
And manual tests for:
|
Overview
Follow up to #434
Before
Using same code as core which doesn't really follow "good practise" for payments.
After
Use code from contributiontransactlegacy extension which is updated to follow "good practise" for payments.
Technical Details
Comments
Note I didn't test this yet..