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

use form's currency, not system default, for displaying line items/total #842

Open
wants to merge 1 commit into
base: 6.x
Choose a base branch
from

Conversation

MegaphoneJon
Copy link
Contributor

Overview

See https://www.drupal.org/project/webform_civicrm/issues/3340955.

Before

The line items and total on the payment page display in the system default currency.

After

The line items and total on the payment page display in the webform's currency.

Comments

The PHP fix is the primary fix. The JS fix works because the PHP fix is providing the correct format.

@jitendrapurohit
Copy link
Collaborator

@MegaphoneJon The test failure seems to be related. There seems to be js error when the default currency is selected on the Contribution tab.

image

The console error is probably due to the usage of uppercase FALSE in js. Should be fixed by replacing it to false.

@KarinG
Copy link
Collaborator

KarinG commented Feb 20, 2023

Hi @MegaphoneJon - that looks like a real failure:

5) Drupal\Tests\webform_civicrm\FunctionalJavascript\ContributionDummyTest::testAssignContributionSecondContactSelectByUserPaymentProcessor
Behat\Mink\Exception\ElementTextException: The text "10.00" was not found in the text of the element matching css "#wf-crm-billing-total".

@MegaphoneJon
Copy link
Contributor Author

A question (unrelated to the currently failing test):

I've written a new JavaScript function that really needs unit testing with a large number of inputs. FunctionalJavascript seems way too heavy, since I want to do a pure unit test. Is there existing support for JS unit tests?

The values I want to test:

€275.00 EUR
$4,000.00 EUR
€275 EUR
$4,000.00
$4,000,000.00
$4 000 000.00
275€ EUR
275.00€ EUR
1'275.00€ EUR
$4_000_000.00
$1
$1.00
£9,500
$2.000,75

@KarinG
Copy link
Collaborator

KarinG commented Feb 28, 2023

Hi Jon -> if I understand your questions correctly -> yes we support non Functional JS tests ->

image

@MegaphoneJon
Copy link
Contributor Author

test this please

@KarinG
Copy link
Collaborator

KarinG commented Jun 7, 2023

I’ll hit re-run tests

@VangelisP
Copy link

VangelisP commented Jun 15, 2024

I got stuck with the same issue/situation as @MegaphoneJon : I have a couple of available currencies but the payment screen shows the default site currency.

I can confirm that with this patch, my issue got resolved. @KarinG could we merge this one ?

Thanks for the work @MegaphoneJon !!

@KarinG
Copy link
Collaborator

KarinG commented Jun 15, 2024

It really needs to pass the existing battery of tests before we can merge this.

@VangelisP
Copy link

Coming back to this PR as I've recently upgraded webform_civicrm to version 6.2.5. I have a different behaviour with 6.2.5 vs 6.2.4:

I believe this line should be taken out.
It replaces the line item amount with the total amount

Before removing/commenting the pointed line:

image

After commenting it:

image

PS. Please ignore the total amount which is 26 in one screenshot and 21 in the other..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants