本文整理汇总了Java中org.chromium.payments.mojom.CanMakePaymentQueryResult类的典型用法代码示例。如果您正苦于以下问题:Java CanMakePaymentQueryResult类的具体用法?Java CanMakePaymentQueryResult怎么用?Java CanMakePaymentQueryResult使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CanMakePaymentQueryResult类属于org.chromium.payments.mojom包,在下文中一共展示了CanMakePaymentQueryResult类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: canMakePayment
import org.chromium.payments.mojom.CanMakePaymentQueryResult; //导入依赖的package包/类
/**
* Called by the merchant website to check if the user has complete payment instruments.
*/
@Override
public void canMakePayment() {
if (mClient == null) return;
CanMakePaymentQuery query = sCanMakePaymentQueries.get(mOrigin);
if (query == null) {
query = new CanMakePaymentQuery(mMethodData.keySet());
sCanMakePaymentQueries.put(mOrigin, query);
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
sCanMakePaymentQueries.remove(mOrigin);
}
}, CAN_MAKE_PAYMENT_QUERY_PERIOD_MS);
}
if (!query.matchesPaymentMethods(mMethodData.keySet())) {
mClient.onCanMakePayment(CanMakePaymentQueryResult.QUERY_QUOTA_EXCEEDED);
if (sObserverForTest != null) {
sObserverForTest.onPaymentRequestServiceCanMakePaymentQueryResponded();
}
return;
}
if (query.getPreviousResponse() != null) {
respondCanMakePaymentQuery(query.getPreviousResponse().booleanValue());
return;
}
query.addObserver(this);
if (isFinishedQueryingPaymentApps()) query.setResponse(mCanMakePayment);
}
示例2: respondCanMakePaymentQuery
import org.chromium.payments.mojom.CanMakePaymentQueryResult; //导入依赖的package包/类
private void respondCanMakePaymentQuery(boolean response) {
mClient.onCanMakePayment(response
? CanMakePaymentQueryResult.CAN_MAKE_PAYMENT
: CanMakePaymentQueryResult.CANNOT_MAKE_PAYMENT);
if (sObserverForTest != null) {
sObserverForTest.onPaymentRequestServiceCanMakePaymentQueryResponded();
}
}
示例3: canMakePayment
import org.chromium.payments.mojom.CanMakePaymentQueryResult; //导入依赖的package包/类
/**
* Called by the merchant website to check if the user has complete payment instruments.
*/
@Override
public void canMakePayment() {
if (mClient == null) return;
CanMakePaymentQuery query = sCanMakePaymentQueries.get(mPaymentRequestOrigin);
if (query == null) {
// If there has not been a canMakePayment() query in the last 30 minutes, take a note
// that one has happened just now. Remember the payment method names and the
// corresponding data for the next 30 minutes. Forget about it after the 30 minute
// period expires.
query = new CanMakePaymentQuery(Collections.unmodifiableMap(mMethodData));
sCanMakePaymentQueries.put(mPaymentRequestOrigin, query);
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
sCanMakePaymentQueries.remove(mPaymentRequestOrigin);
}
}, CAN_MAKE_PAYMENT_QUERY_PERIOD_MS);
} else if (shouldEnforceCanMakePaymentQueryQuota()
&& !query.matchesPaymentMethods(Collections.unmodifiableMap(mMethodData))) {
// If there has been a canMakePayment() query in the last 30 minutes, but the previous
// payment method names and the corresponding data don't match, enforce the
// canMakePayment() query quota (unless the quota is turned off).
mClient.onCanMakePayment(CanMakePaymentQueryResult.QUERY_QUOTA_EXCEEDED);
if (sObserverForTest != null) {
sObserverForTest.onPaymentRequestServiceCanMakePaymentQueryResponded();
}
return;
}
query.addObserver(this);
if (isFinishedQueryingPaymentApps()) query.notifyObserversOfResponse(mCanMakePayment);
}
示例4: respondCanMakePaymentQuery
import org.chromium.payments.mojom.CanMakePaymentQueryResult; //导入依赖的package包/类
private void respondCanMakePaymentQuery(boolean response) {
if (mClient == null) return;
boolean isIgnoringQueryQuota = false;
if (!shouldEnforceCanMakePaymentQueryQuota()) {
CanMakePaymentQuery query = sCanMakePaymentQueries.get(mPaymentRequestOrigin);
// The cached query may have expired between instantiation of PaymentRequest and
// finishing the query of the payment apps.
if (query != null) {
isIgnoringQueryQuota =
!query.matchesPaymentMethods(Collections.unmodifiableMap(mMethodData));
}
}
if (mIsIncognito) {
mClient.onCanMakePayment(CanMakePaymentQueryResult.CAN_MAKE_PAYMENT);
} else if (isIgnoringQueryQuota) {
mClient.onCanMakePayment(response
? CanMakePaymentQueryResult.WARNING_CAN_MAKE_PAYMENT
: CanMakePaymentQueryResult.WARNING_CANNOT_MAKE_PAYMENT);
} else {
mClient.onCanMakePayment(response ? CanMakePaymentQueryResult.CAN_MAKE_PAYMENT
: CanMakePaymentQueryResult.CANNOT_MAKE_PAYMENT);
}
mJourneyLogger.setCanMakePaymentValue(response || mIsIncognito);
if (sObserverForTest != null) {
sObserverForTest.onPaymentRequestServiceCanMakePaymentQueryResponded();
}
}
示例5: canMakePayment
import org.chromium.payments.mojom.CanMakePaymentQueryResult; //导入依赖的package包/类
@Override
public void canMakePayment() {
if (mClient != null) {
mClient.onCanMakePayment(CanMakePaymentQueryResult.CANNOT_MAKE_PAYMENT);
}
}