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

Google Pay integration. #4624

Merged
merged 41 commits into from
May 11, 2024
Merged

Google Pay integration. #4624

merged 41 commits into from
May 11, 2024

Conversation

dbrant
Copy link
Member

@dbrant dbrant commented Apr 24, 2024

Base automatically changed from gPayPre to main April 24, 2024 18:38
@dbrant dbrant removed the WIP Work in progress label May 9, 2024
if (Prefs.paymentMethodsMerchantId.isEmpty() || Prefs.paymentMethodsGatewayId.isEmpty()) {
uiState.value = NoPaymentMethod()
} else {
uiState.value = Resource.Success(donationConfig!!)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would it be safer if we handle the null-safey check for donationConfig?

donationConfig?.let {
} ?: run {
    uiState.value = Resouce.Error("...")
}

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm actually not sure this would be safer... If donationConfig is null, it will throw a NullPointerException, which will be caught by the CoroutineExceptionHandler at the top, and will automatically provide a Resource.Error.

app/src/extra/res/layout/activity_donate.xml Show resolved Hide resolved
app/src/extra/res/layout/activity_donate.xml Show resolved Hide resolved
app/src/extra/res/layout/activity_donate.xml Show resolved Hide resolved
app/src/extra/res/layout/activity_donate.xml Show resolved Hide resolved
Copy link
Collaborator

@cooltey cooltey left a comment

Choose a reason for hiding this comment

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

Two questions:

  1. When I changed the country code to TW (Taiwan), it showed the currency correctly, but it did not show the suggested amounts, is that expected?
  1. It looks like the input field allows the user to add multiple zeros to the beginning of the amount, and it does not affect the final amount. Just wonder if we need to remove the unnecessary zero automatically.
  1. When processing the payment, the activity title still showed the "Select amount" title with an empty content. Do we need to change the activity title to "Processing payment" or other proper title?

@dbrant
Copy link
Member Author

dbrant commented May 10, 2024

@cooltey Excellent observations!

  1. When I changed the country code to TW (Taiwan), it showed the currency correctly, but it did not show the suggested amounts, is that expected?

This actually might be a bug in the fundraising API -- it's not giving us the preset amounts for the TWD currency.
I'll make a note for the FR-tech team, and I updated the PR to bounce out of the GPay workflow (fall back to the browser) if the currency presets are not available. Thanks!

  1. It looks like the input field allows the user to add multiple zeros to the beginning of the amount, and it does not affect the final amount. Just wonder if we need to remove the unnecessary zero automatically.

Ehhh I think that's an acceptable behavior. As long as the final amount is parsed correctly, why not let people enter 000001 when they really mean 1.

  1. When processing the payment, the activity title still showed the "Select amount" title with an empty content. Do we need to change the activity title to "Processing payment" or other proper title?

¯\_(ツ)_/¯ this is how it was designed, and it's probably perfectly good for a first iteration. We will surely make refinements as we go along, and I'll make an additional note to discuss this step at the next prioritization.

@cooltey
Copy link
Collaborator

cooltey commented May 10, 2024

@cooltey Excellent observations!

  1. When I changed the country code to TW (Taiwan), it showed the currency correctly, but it did not show the suggested amounts, is that expected?

This actually might be a bug in the fundraising API -- it's not giving us the preset amounts for the TWD currency. I'll make a note for the FR-tech team, and I updated the PR to bounce out of the GPay workflow (fall back to the browser) if the currency presets are not available. Thanks!

Great! Thanks!

  1. It looks like the input field allows the user to add multiple zeros to the beginning of the amount, and it does not affect the final amount. Just wonder if we need to remove the unnecessary zero automatically.

Ehhh I think that's an acceptable behavior. As long as the final amount is parsed correctly, why not let people enter 000001 when they really mean 1.

That makes sense to me.

  1. When processing the payment, the activity title still showed the "Select amount" title with an empty content. Do we need to change the activity title to "Processing payment" or other proper title?

¯_(ツ)_/¯ this is how it was designed, and it's probably perfectly good for a first iteration. We will surely make refinements as we go along, and I'll make an additional note to discuss this step at the next prioritization.

Got it!


I have one final question before merging:

From the article donate campaign dialog, when the user selects "Donate now", the GPay bottomsheet pops up. If the user accidentally closes the bottomsheet by tapping on the dimmed side, the entire donation flow will still be considered as "Completed".

Do we need to update the preference logic to make sure the user clicks one of the options in the GPay bottomsheet instead of saving the preference when tapping on the the dialog "Donate now"?

@cooltey cooltey merged commit 05a574c into main May 11, 2024
2 checks passed
@cooltey cooltey deleted the gPay_design branch May 11, 2024 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants