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

feat: add prefills for variable payments #6899

Merged
merged 2 commits into from
Nov 28, 2023
Merged

Conversation

KenLSM
Copy link
Contributor

@KenLSM KenLSM commented Nov 15, 2023

Problem

Agencies requires a way to programmatically preset the variable payments field. They don't require a hard-prefill nor a verified prefill (i.e., savvy respondents would be able to change the prefills by updating the URL)

Closes FRM-1514

Solution

Expose PAYMENT_VARIABLE_INPUT_AMOUNT_FIELD_ID as the fieldId for prefills.
Read and populate variable payments field if prefill exists.
Validation of values is not performed until the payer interacts with the field -- similar to how soft-prefill works currently.
There's no toggle required for prefills (no need for field_id)

Breaking Changes

  • No - this PR is backwards compatible

Tests

Regression

Ensure that prefill works on non-payment forms
  • On a regular form
  • Toggle on prefill for a Short Text field
  • Append prefilled id + data on the URL
  • Ensure that the Short Text field is prefilled
Prefills happy flow
  • Add a payment variable to a form
  • Append ?payment_variable_input_amount_field_id=<amount_in_cents> to the end of the url
  • Observe that the variable input field is prefilled
Prefills happy flow with other prefillable fields
  • Add a payment variable to a form
  • Toggle on prefill for a Short Text field
  • Append prefilled id + data on the URL
  • Append &payment_variable_input_amount_field_id=<amount_in_cents> to the end of the url (note that we're trying to have two prefills on the URL. 1 for Short Text, another for Variable Payments`
  • Observe that the variable input field is prefilled
Prefills invalid data flow
  • Create a new payment variable form
  • Append ?payment_variable_input_amount_field_id=THIS_IS_NOT_A_NUMBER to the end of the url
  • Observe that the variable input field is not prefilled

@KenLSM KenLSM requested a review from wanlingt November 15, 2023 10:05
Copy link

linear bot commented Nov 15, 2023

FRM-1514 Add soft pre-fill to payment amount

Description

Problem

Currently our variable payment amount fields are not-prefillable and hence agencies are not able to send specific payment amount links to individuals. Example: NP library fines.

Solution

Make variable payment field soft-prefillable:

  • Add prefill toggle
  • Prefill the payment amount when passed in the url
  • User can update the amount by updating the link.

Copy link
Contributor

@wanlingt wanlingt left a comment

Choose a reason for hiding this comment

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

also, I think we can consider getting the InlineMessage (Highlighted fields below have been pre-filled according to the form link you clicked. You may edit these fields if necessary, except non-editable fields with a lock icon.) to show up for the prefilled payment field too (L150 onwards)

@KenLSM KenLSM requested a review from justynoh November 16, 2023 15:11
@KenLSM
Copy link
Contributor Author

KenLSM commented Nov 16, 2023

also, I think we can consider getting the InlineMessage (Highlighted fields below have been pre-filled according to the form link you clicked. You may edit these fields if necessary, except non-editable fields with a lock icon.) to show up for the prefilled payment field too (L150 onwards)

I feel that this might bring too much attention to the variable prefills. This change is currently meant to be for NP's usecase where they want the respondents to simply pay the stated amount. @amitogp wdyt?

@amitogp
Copy link

amitogp commented Nov 17, 2023

also, I think we can consider getting the InlineMessage (Highlighted fields below have been pre-filled according to the form link you clicked. You may edit these fields if necessary, except non-editable fields with a lock icon.) to show up for the prefilled payment field too (L150 onwards)

I feel that this might bring too much attention to the variable prefills. This change is currently meant to be for NP's usecase where they want the respondents to simply pay the stated amount. @amitogp wdyt?

Agree with @KenLSM, we should not focus much on the variable nature of prefill field. @KenLSM is there a link I can QA to see the current behavior?

@KenLSM KenLSM enabled auto-merge (squash) November 26, 2023 17:38
@KenLSM
Copy link
Contributor Author

KenLSM commented Nov 28, 2023

Update, QA has been done.

Copy link
Contributor

@wanlingt wanlingt left a comment

Choose a reason for hiding this comment

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

lgtm!

@KenLSM KenLSM merged commit 266a719 into develop Nov 28, 2023
20 of 22 checks passed
@KenLSM KenLSM deleted the feat/payment-soft-prefills branch November 28, 2023 02:04
@KenLSM KenLSM mentioned this pull request Nov 28, 2023
26 tasks
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.

None yet

3 participants