Commit 499dce94 authored by rouslan's avatar rouslan Committed by Commit bot

Enable "interledger" non-URI payment method.

After this patch, Android payment applications can support "interledger"
payment method by adding the following section to their
AndroidManifest.xml file:

<activity android:name=".PaymentActivity" android:exported="true">
  <intent-filter>
    <action android:name="org.chromium.intent.action.PAY" />
  </intent-filter>
  <meta-data android:name="org.chromium.default_payment_method_name"
             android:value="interledger" />
</activity>

Flag:
chrome://flags/#android-payment-apps

Design:
https://docs.google.com/document/d/1izV4uC-tiRJG3JLooqY3YRLU22tYOsLTNq0P_InPJeE

BUG=715577

Review-Url: https://codereview.chromium.org/2850503002
Cr-Commit-Position: refs/heads/master@{#467689}
parent 79472099
......@@ -48,12 +48,6 @@ public class AndroidPaymentAppFinder implements ManifestVerifyCallback {
/* package */ static final String ACTION_IS_READY_TO_PAY =
"org.chromium.intent.action.IS_READY_TO_PAY";
/**
* The basic-card payment method name used by merchant and defined by W3C:
* https://w3c.github.io/webpayments-methods-card/#method-id
*/
/* package */ static final String BASIC_CARD_PAYMENT_METHOD = "basic-card";
/**
* Meta data name of an app's supported payment method names.
*/
......@@ -124,7 +118,10 @@ public class AndroidPaymentAppFinder implements ManifestVerifyCallback {
// For non-URI payment method names, only names published by W3C should be supported.
Set<String> supportedNonUriPaymentMethods = new HashSet<>();
supportedNonUriPaymentMethods.add(BASIC_CARD_PAYMENT_METHOD);
// https://w3c.github.io/webpayments-methods-card/
supportedNonUriPaymentMethods.add("basic-card");
// https://w3c.github.io/webpayments/proposals/interledger-payment-method.html
supportedNonUriPaymentMethods.add("interledger");
mNonUriPaymentMethods = new HashSet<>();
mUriPaymentMethods = new HashSet<>();
......
......@@ -91,7 +91,7 @@ public class AndroidPaymentAppFinderTest {
ArgumentMatchers.argThat(sPayIntentArgumentMatcher)))
.thenReturn(new ArrayList<ResolveInfo>());
Set<String> methodNames = new HashSet<>();
methodNames.add(AndroidPaymentAppFinder.BASIC_CARD_PAYMENT_METHOD);
methodNames.add("basic-card");
PaymentAppCreatedCallback callback = Mockito.mock(PaymentAppCreatedCallback.class);
AndroidPaymentAppFinder.find(Mockito.mock(WebContents.class), methodNames,
......@@ -121,7 +121,7 @@ public class AndroidPaymentAppFinderTest {
.thenReturn(activities);
Set<String> methodNames = new HashSet<>();
methodNames.add(AndroidPaymentAppFinder.BASIC_CARD_PAYMENT_METHOD);
methodNames.add("basic-card");
PaymentAppCreatedCallback callback = Mockito.mock(PaymentAppCreatedCallback.class);
AndroidPaymentAppFinder.find(Mockito.mock(WebContents.class), methodNames,
......@@ -156,7 +156,7 @@ public class AndroidPaymentAppFinderTest {
.thenReturn(activities);
Set<String> methodNames = new HashSet<>();
methodNames.add(AndroidPaymentAppFinder.BASIC_CARD_PAYMENT_METHOD);
methodNames.add("basic-card");
PaymentAppCreatedCallback callback = Mockito.mock(PaymentAppCreatedCallback.class);
AndroidPaymentAppFinder.find(Mockito.mock(WebContents.class), methodNames,
......@@ -213,11 +213,9 @@ public class AndroidPaymentAppFinderTest {
Resources resouces = Mockito.mock(Resources.class);
Mockito.when(resouces.getStringArray(ArgumentMatchers.eq(1)))
.thenReturn(new String[] {
"https://alicepay.com", AndroidPaymentAppFinder.BASIC_CARD_PAYMENT_METHOD});
.thenReturn(new String[] {"https://alicepay.com", "basic-card"});
Mockito.when(resouces.getStringArray(ArgumentMatchers.eq(2)))
.thenReturn(new String[] {
"https://bobpay.com", AndroidPaymentAppFinder.BASIC_CARD_PAYMENT_METHOD});
.thenReturn(new String[] {"https://bobpay.com", "basic-card"});
Mockito.when(packageManagerDelegate.getResourcesForApplication(
ArgumentMatchers.eq(alicePay.activityInfo.applicationInfo)))
......@@ -227,7 +225,7 @@ public class AndroidPaymentAppFinderTest {
.thenReturn(resouces);
Set<String> methodNames = new HashSet<>();
methodNames.add(AndroidPaymentAppFinder.BASIC_CARD_PAYMENT_METHOD);
methodNames.add("basic-card");
PaymentAppCreatedCallback callback = Mockito.mock(PaymentAppCreatedCallback.class);
AndroidPaymentAppFinder.find(Mockito.mock(WebContents.class), methodNames,
......@@ -267,8 +265,7 @@ public class AndroidPaymentAppFinderTest {
Resources resouces = Mockito.mock(Resources.class);
Mockito.when(resouces.getStringArray(ArgumentMatchers.eq(1)))
.thenReturn(new String[] {
"https://bobpay.com", AndroidPaymentAppFinder.BASIC_CARD_PAYMENT_METHOD});
.thenReturn(new String[] {"https://bobpay.com", "basic-card"});
Mockito.when(packageManagerDelegate.getResourcesForApplication(
ArgumentMatchers.eq(bobPay.activityInfo.applicationInfo)))
......
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