Commit 8cf54bd6 authored by Rouslan Solomakhin's avatar Rouslan Solomakhin Committed by Commit Bot

[Payment Handler] canMakePayment() is true for JIT install.

Before this patch, if the only method of payment available was a payment
handler that is not yet installed, but is available or installation
Just-In-Time (JIT), then PaymentRequest.canMakePayment() would return
"false". This prevented JIT installable payment handler usage by
merchants that don't call PaymentRequest.show() unless
PaymentRequest.canMakePayment() returns true.

This patch makes canMakePayment() return "true" for JIT installable
payment handlers on both desktop and Android. (iOS does not support
payment handlers at this point.)

After this patch, if the only method of payment available is a payment
handler that is not yet installed, but is available for JIT
installation, then PaymentRequest.canMakePayment() would return "true".

Bug: 877644
Change-Id: I614a02789b514d5d0e7738ca827178a844e74199
Reviewed-on: https://chromium-review.googlesource.com/1188900
Commit-Queue: Rouslan Solomakhin <rouslan@chromium.org>
Reviewed-by: default avatarGanggui Tang <gogerald@chromium.org>
Cr-Commit-Position: refs/heads/master@{#586252}
parent a216c3df
...@@ -355,12 +355,6 @@ public class ServiceWorkerPaymentApp extends PaymentInstrument implements Paymen ...@@ -355,12 +355,6 @@ public class ServiceWorkerPaymentApp extends PaymentInstrument implements Paymen
@Override @Override
public void dismissInstrument() {} public void dismissInstrument() {}
@Override
public boolean canMakePayment() {
// Return false for PaymentRequest.canMakePayment() if installation is needed.
return !mNeedsInstallation;
}
@Override @Override
public boolean canPreselect() { public boolean canPreselect() {
return mCanPreselect; return mCanPreselect;
......
...@@ -279,15 +279,9 @@ base::string16 ServiceWorkerPaymentInstrument::GetMissingInfoLabel() const { ...@@ -279,15 +279,9 @@ base::string16 ServiceWorkerPaymentInstrument::GetMissingInfoLabel() const {
} }
bool ServiceWorkerPaymentInstrument::IsValidForCanMakePayment() const { bool ServiceWorkerPaymentInstrument::IsValidForCanMakePayment() const {
// This instrument should not be used when can_make_payment_result_ is false // This instrument should not be used when can_make_payment_result_ is false,
// , so this interface should not be invoked. // so this interface should not be invoked.
DCHECK(can_make_payment_result_); DCHECK(can_make_payment_result_);
// Returns false for PaymentRequest.CanMakePayment query if the app needs
// installation.
if (needs_installation_)
return false;
return true; return true;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment