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

Reconcile contribution amount tokens #21036

Merged
merged 1 commit into from
Aug 6, 2021

Conversation

eileenmcnaughton
Copy link
Contributor

Overview

Reconcile contribution amount tokens

Before

non_deductible_amount identified in #21034 as being present in the legacy token provider but not the token processor / scheduled reminders

After

Rendered & tested in both

Technical Details

PR also moves the metadata functions to a parent class - this class might wind up
being a temporary class as there are 3 other contenders for where this functionality
should go - the TokenTrait, the abstractProvider or the tokenRow class. The intent
is not to make that decision yet - just to provide visual clarity about
what is generic

Note - I've figured out how to switch over to v4 api for this but will do that in a separate PR

Comments

@civibot
Copy link

civibot bot commented Aug 6, 2021

(Standard links)

@civibot civibot bot added the master label Aug 6, 2021
*/
public function evaluateToken(TokenRow $row, $entity, $field, $prefetch = NULL) {
$actionSearchResult = $row->context['actionSearchResult'];
$fieldValue = $actionSearchResult->{"contrib_$field"} ?? NULL;

if (in_array($field, ['total_amount', 'fee_amount', 'net_amount'])) {
if (array_key_exists($field, $this->getPseudoTokens())) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just moved higher to process it first since there is no metadata for these tokens & it will enotice

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • note I will switch in a follow up to having an isPseudoToken function

@eileenmcnaughton eileenmcnaughton force-pushed the act_mon branch 2 times, most recently from b13db4a to 6519150 Compare August 6, 2021 01:12
@eileenmcnaughton
Copy link
Contributor Author

Follow up switch to use apiv4 metadata #21038

@seamuslee001
Copy link
Contributor

@eileenmcnaughton this is conflicted now but it does match what I was expecting

@eileenmcnaughton
Copy link
Contributor Author

@seamuslee001 rebased

This adds non_deductible_amount, as identified in civicrm#21034

It also moves the metadata functions to a parent class - this class might wind up
being a temporary class as there are 3 other contenders for where this functionality
should go - the TokenTrait, the abstractProvider or the tokenRow class. The intent
is not to make that decision yet - just to provide visual clarity about
what is generic

Note - I've figured out how to switch over to v4 api for this but will do that in a separate PR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants