* SPDX-FileCopyrightText: 2020, microG Project Team
* SPDX-License-Identifier: Apache-2.0 AND CC-BY-4.0
* Notice: Portions of this file are reproduced from work created and shared by Google and used
* according to terms described in the Creative Commons 4.0 Attribution License.
* See https://developers.google.com/readme/policies for details.
*/
packagecom.google.android.gms.wallet;
importorg.microg.gms.common.PublicApi;
importorg.microg.safeparcel.AutoSafeParcelable;
importjava.util.ArrayList;
importjava.util.Collection;
/**
* A Parcelable request that can optionally be passed to {@link PaymentsClient#isReadyToPay(IsReadyToPayRequest)} to specify additional filtering criteria for determining if a user is considered ready to pay.
* Constructs {@link IsReadyToPayRequest} from a JSON object serialized as a string.
* <p>
* To convert back to a JSON object serialized as string use {@link #toJson()}.
* <p>
* Note that you shouldn't rely on the values returned by getters in {@link IsReadyToPayRequest} as they will not be populated with the data set in the given JSON.
* <p>
* For the expected format of this JSON, please see <a href="https://developers.google.com/pay/api/android/reference/object/IsReadyToPayRequest">IsReadyToPayRequest object reference documentation</a>.
* Returns {@link IsReadyToPayRequest} in JSON format.
* <p>
* Note that this will be {@code null} if this request was not constructed using {@link #fromJson(String)}.
* <p>
* For the expected format of this JSON, please see <a href="https://developers.google.com/pay/api/android/reference/object/IsReadyToPayRequest">IsReadyToPayRequest object reference documentation</a>.
*/
publicStringtoJson(){
returnjson;
}
/**
* @return the {@link WalletConstants.CardNetwork} that will be used to filter the instruments deemed acceptable by {@link PaymentsClient#isReadyToPay(IsReadyToPayRequest)}. If not explicitly set, the default supported networks will be {@link WalletConstants#CARD_NETWORK_AMEX}, {@link WalletConstants#CARD_NETWORK_DISCOVER}, {@link WalletConstants#CARD_NETWORK_MASTERCARD}, and {@link WalletConstants#CARD_NETWORK_VISA}.
* @deprecated Use the JSON request format instead, see {@link #fromJson(String)}.
*/
publicArrayList<Integer>getAllowedCardNetworks(){
returnallowedCardNetworks;
}
/**
* @return the supported payment credential types defined in {@link WalletConstants.PaymentMethod}, or {@code null} if no restrictions were specified.
* @deprecated Use the JSON request format instead, see {@link #fromJson(String)}.
* @return whether or not IsReadyToPay will be determined by the user having an existing payment method that matches the other criteria specified in the IsReadyToPayRequest.
* @deprecated Use the JSON request format instead, see {@link #fromJson(String)}.
*/
publicbooleanisExistingPaymentMethodRequired(){
returnexistingPaymentMethodRequired;
}
/**
* Builder for creating an {@link IsReadyToPayRequest}.
*
* @deprecated Use the JSON request format instead, see {@link #fromJson(String)}.
*/
publicclassBuilder{
/**
* Adds a card network for cards allowed in the purchase. See {@link WalletConstants.CardNetwork} for available options. If not explicitly set via this or {@link #addAllowedCardNetworks(Collection)}, the default supported networks will be {@link WalletConstants#CARD_NETWORK_AMEX}, {@link WalletConstants#CARD_NETWORK_DISCOVER}, {@link WalletConstants#CARD_NETWORK_MASTERCARD}, and {@link WalletConstants#CARD_NETWORK_VISA}.
* Adds a collection of card networks for cards allowed in the purchase. See {@link WalletConstants.CardNetwork} for available options. If not explicitly set via this or {@link #addAllowedCardNetwork(int)}, the default supported networks will be {@link WalletConstants#CARD_NETWORK_AMEX}, {@link WalletConstants#CARD_NETWORK_DISCOVER}, {@link WalletConstants#CARD_NETWORK_MASTERCARD}, and {@link WalletConstants#CARD_NETWORK_VISA}.
* Adds an allowed payment method. See {@link WalletConstants.PaymentMethod} for available options. If not explicitly set via this or {@link #addAllowedPaymentMethods(Collection)}, then the default allowed payment method will be {@link WalletConstants#PAYMENT_METHOD_TOKENIZED_CARD}.
* Adds a collection of allowed payment methods. See {@link WalletConstants.PaymentMethod} for available options. If not explicitly set via this or {@link #addAllowedPaymentMethod(int)}, then the default allowed payment method will be {@link WalletConstants#PAYMENT_METHOD_TOKENIZED_CARD}.
* @return The actual {@link IsReadyToPayRequest} created using the data passed to the Builder object.
*/
publicIsReadyToPayRequestbuild(){
returnIsReadyToPayRequest.this;
}
/**
* If set to true, then IsReadyToPay will only return true if the user has an existing payment method that matches the other criteria specified in the IsReadyToPayRequest.
* <p>
* If you set this to true, make sure to call {@link PaymentsClient#isReadyToPay(IsReadyToPayRequest)} as early as possible in your flow as the call may take longer to resolve due to the extra check for an existing payment method.