1 // Copyright 2020 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef COMPONENTS_PAYMENTS_CORE_ANDROID_APP_DESCRIPTION_H_ 6 #define COMPONENTS_PAYMENTS_CORE_ANDROID_APP_DESCRIPTION_H_ 7 8 #include <memory> 9 #include <string> 10 #include <vector> 11 12 namespace payments { 13 14 // Describes an Android activity with org.chromium.intent.action.PAY intent 15 // filter. Documentation: 16 // https://web.dev/android-payment-apps-overview/ 17 struct AndroidActivityDescription { 18 AndroidActivityDescription(); 19 ~AndroidActivityDescription(); 20 21 // Disallow copy and assign. 22 AndroidActivityDescription(const AndroidActivityDescription& other) = delete; 23 AndroidActivityDescription& operator=( 24 const AndroidActivityDescription& other) = delete; 25 26 // The name of the activity, e.g., "com.example.app.PaymentActivity". 27 std::string name; 28 29 // The payment method identifier from the 30 // "org.chromium.default_payment_method_name" metadata value of this activity. 31 // For example, "https://example.com/web-pay". 32 // 33 // The metadata value of "org.chromium.payment_method_names" is not yet used 34 // here, so it's omitted from the struct at this time. 35 std::string default_payment_method; 36 }; 37 38 // Describes an Android app that can handle payments. 39 struct AndroidAppDescription { 40 AndroidAppDescription(); 41 ~AndroidAppDescription(); 42 43 // Disallow copy and assign. 44 AndroidAppDescription(const AndroidAppDescription& other) = delete; 45 AndroidAppDescription& operator=(const AndroidAppDescription& other) = delete; 46 47 // The name of the Android package of this app, e.g., "com.example.app". 48 std::string package; 49 50 // The list of activities with org.chromium.intent.action.PAY intent filters 51 // in this app. 52 std::vector<std::unique_ptr<AndroidActivityDescription>> activities; 53 54 // The list of service names with org.chromium.intent.action.IS_READY_TO_PAY 55 // intent filters in this app. For example, 56 // ["com.example.app.IsReadyToPayService"]. 57 // 58 // Note that it's a mistake to declare multiple IS_READY_TO_PAY services in an 59 // app. This mistake would be reported to the developer. 60 std::vector<std::string> service_names; 61 }; 62 63 } // namespace payments 64 65 #endif // COMPONENTS_PAYMENTS_CORE_ANDROID_APP_DESCRIPTION_H_ 66