Package com.meawallet.mpp
Class MeaPushProvisioning.SamsungPay
java.lang.Object
com.meawallet.mpp.MeaPushProvisioning.SamsungPay
- Enclosing class:
- MeaPushProvisioning
Methods which can be used to simplify Samsung Pay Push Provisioning flow.
https://pay.samsung.com/developers
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Decline activation type. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
activate()
Deprecated.static void
Returns the user to Google Wallet after the activation process is completestatic void
Passes Activation Code to to Samsung Pay.static void
activate
(com.samsung.android.sdk.samsungpay.v2.card.Card card, Activity activity, MppActivateListener listener) Activates token using TSP and returns back to the Google Wallet.static void
activate
(String tokenUniqueReference, MppPaymentNetwork paymentNetwork) Activate using TSP.static void
activate
(String tokenUniqueReference, MppPaymentNetwork paymentNetwork, MppActivateListener listener) Activate using TSP.static void
Activates the Samsung Pay App.static void
checkWalletForCardSuffix
(String cardSuffix, SamsungPayTokenInfoListListener listener) Checks if the Samsung Pay token with provided PAN suffix is available in the Samsung Pay Wallet.static void
checkWalletForCardToken
(MppCardDataParameters cardData, SamsungPayTokenListener listener) Checks if the Samsung Pay token for the corresponding card is available in the Samsung Pay Wallet.static void
checkWalletForToken
(String tokenId, SamsungPayTokenListener listener) Checks if the Samsung Pay token with tokenId is available in the Samsung Pay Wallet.static void
declineActivation
(Activity activity, MeaPushProvisioning.SamsungPay.ActivationResult activationResult) Declines activation with status.static String
getActivationCode
(MppCardDataParameters cardData, String walletId, String deviceId, Context context) Gets activation code (authentication code, TAV) for app-to-app verification.static void
getActivationCode
(MppCardDataParameters cardData, String walletId, String deviceId, Context context, MppActivationCodeListener listener) Gets activation code (authentication code, TAV) for app-to-app verification.static void
getCard
(Intent intent, SamsungPayCardListener listener) Gets SamsungPay Card using Token Unique Reference from Intent's data.static void
Get a list of tokens and associated metadata registered to the active wallet.static void
getStatus
(SamsungPayStatusListener listener) Method to get the Samsung Pay status on the device.getTokenizationData
(MppCardDataParameters cardData, String walletId, String deviceId, Context context) Get Samsung Pay Push Provisioning tokenization data which includes Opaque Payment Card (OPC) - a binary blob of information which needs to be shared with Samsung Pay 'as is' and will be presented to TSP to receive a token.static void
getTokenizationData
(MppCardDataParameters cardData, String walletId, String deviceId, Context context, MppGetOemTokenizationDataListener listener) Get Samsung Pay Push Provisioning tokenization data.static MppGetTokensResponseData
getTokens
(MppCardDataParameters cardData, String walletId, String deviceId, Context context) Get Samsung Pay tokens for the specified card.static void
getTokens
(MppCardDataParameters cardData, String walletId, String deviceId, Context context, MppGetTokensListener listener) Get Samsung Pay tokens for the specified card.static void
getWalletInfo
(SamsungPayWalletInfoListener walletInfoListener) Gets Samsung Pay Wallet information: device management ID, device ID, and Wallet User ID.static boolean
isDefaultPaymentApplication
(Context context) Issuer app should check if Samsung Pay is the default NFC payment app after card tokenization.static boolean
isWalletAvailable
(Context context) Checks if Samsung Pay is installed on device.static void
pushCard
(MppCardDataParameters cardData, Activity activity, MppPushCardToSamsungPayListener listener) Push card to Samsung Paystatic void
sendUserToSamsungPay
(Activity activity) Sends user to the Samsung Pay app to see the tokenized card.static void
setAsDefaultPaymentApplication
(Activity activity, int requestCode) Set Samsung Pay as a default app for NFC payments.static void
setServiceId
(String serviceId) Sets Samsung Pay service Id (SID).static void
update()
Initiates Samsung Pay App's update.static void
verifyCardIdv
(String cardId, String activationCode, Bundle cardInfoData, MppListener listener) Verifies and activates a card in Samsung Pay.
-
Constructor Details
-
SamsungPay
public SamsungPay()
-
-
Method Details
-
setServiceId
Sets Samsung Pay service Id (SID).- Parameters:
serviceId
- Unique ID to represent the service.- Throws:
MppException
-
getStatus
Method to get the Samsung Pay status on the device. Partner applications must call this Method to check the current status of Samsung Pay before doing any operation.- Parameters:
listener
- The listener asSamsungPayStatusListener
instance.- Throws:
MppException
- UseMppException.getMppError()
to get error object with error code and error description.
-
activatePay
Activates the Samsung Pay App. Issuer application must check Samsung Pay status first with agetStatus(SamsungPayStatusListener)
call. If the status isSamsungPayStatus.SAMSUNG_PAY_SETUP_NOT_COMPLETED
, partner app should display an appropriate message to user, then call this method to launch the Samsung Pay app so the user can sign in.- Throws:
MppException
- UseMppException.getMppError()
to get error object with error code and error description.
-
activate
Deprecated.- Throws:
MppException
-
update
Initiates Samsung Pay App's update. Issuer application must check Samsung Pay status first with agetStatus(SamsungPayStatusListener)
call. If the status isSamsungPayStatus.SAMSUNG_PAY_APP_NEED_TO_UPDATE
, partner app should display an appropriate message to user, then callupdate()
.- Throws:
MppException
- UseMppException.getMppError()
to get error object with error code and error description.
-
pushCard
public static void pushCard(@NonNull MppCardDataParameters cardData, @NonNull Activity activity, @NonNull MppPushCardToSamsungPayListener listener) throws MppException Push card to Samsung Pay- Parameters:
activity
- TheActivity
which will handleActivity.onActivityResult(int, int, Intent)
callback.cardData
- Card data object containing the card information to be provisioned by the token requester.listener
- The listener asMppPushCardToSamsungPayListener
instance.- Throws:
MppException
- UseMppException.getMppError()
()} to get error object with error code and error description.
-
checkWalletForToken
public static void checkWalletForToken(@NonNull String tokenId, @NonNull SamsungPayTokenListener listener) throws MppException Checks if the Samsung Pay token with tokenId is available in the Samsung Pay Wallet.- Parameters:
tokenId
- token Idlistener
- The listener asSamsungPayTokenListener
instance.- Throws:
MppException
- UseMppException.getMppError()
()} to get error object with error code and error description.
-
checkWalletForCardToken
public static void checkWalletForCardToken(@NonNull MppCardDataParameters cardData, @NonNull SamsungPayTokenListener listener) throws MppException Checks if the Samsung Pay token for the corresponding card is available in the Samsung Pay Wallet. This check requires a network call, therefore it is recommended to usecheckWalletForToken(String, SamsungPayTokenListener)
whenever the data required for this method call is available.- Parameters:
cardData
- Card data object containing the card information to be provisioned by the token requester.listener
- The listener asSamsungPayTokenListener
instance.- Throws:
MppException
- UseMppException.getMppError()
()} to get error object with error code and error description.
-
getRegisteredTokens
public static void getRegisteredTokens(@NonNull SamsungPayRegisteredTokensListener listener) throws MppException Get a list of tokens and associated metadata registered to the active wallet.- Parameters:
listener
- The listener asGooglePayRegisteredTokensListener
interface.- Throws:
MppException
- UseMppException.getMppError()
()} to get error object with error code and error description.
-
checkWalletForCardSuffix
public static void checkWalletForCardSuffix(@NonNull String cardSuffix, @NonNull SamsungPayTokenInfoListListener listener) throws MppException Checks if the Samsung Pay token with provided PAN suffix is available in the Samsung Pay Wallet.- Parameters:
cardSuffix
- Card suffix.listener
- The listener asSamsungPayTokenInfoListListener
instance.- Throws:
MppException
- UseMppException.getMppError()
()} to get error object with error code and error description.
-
getWalletInfo
public static void getWalletInfo(@NonNull SamsungPayWalletInfoListener walletInfoListener) throws MppException Gets Samsung Pay Wallet information: device management ID, device ID, and Wallet User ID.- Parameters:
walletInfoListener
- The listener asSamsungPayWalletInfoListener
instance.- Throws:
MppException
- UseMppException.getMppError()
()} to get error object with error code and error description.
-
getActivationCode
public static void getActivationCode(@NonNull MppCardDataParameters cardData, @Nullable String walletId, @Nullable String deviceId, @NonNull Context context, @NonNull MppActivationCodeListener listener) Gets activation code (authentication code, TAV) for app-to-app verification.- Parameters:
cardData
- Card data object containing the card information to be provisioned by the token requester.walletId
- Wallet ID of the active wallet.deviceId
- Device ID of the active wallet.context
- Application context.listener
- The listener asMppActivationCodeListener
interface.
-
getActivationCode
public static String getActivationCode(@NonNull MppCardDataParameters cardData, @Nullable String walletId, @Nullable String deviceId, @NonNull Context context) throws MppException, NetworkOnMainThreadException Gets activation code (authentication code, TAV) for app-to-app verification.- Parameters:
cardData
- Card data object containing the card information to be provisioned by the token requester.walletId
- Wallet ID of the active wallet.deviceId
- Device ID of the active wallet.context
- Application context.- Returns:
- Activation code;
- Throws:
MppException
- UseMppException.getMppError()
()} to get error object with error code and error description.NetworkOnMainThreadException
- Method should not be called on the Main thread.
-
verifyCardIdv
public static void verifyCardIdv(@NonNull String cardId, @NonNull String activationCode, @NonNull Bundle cardInfoData, @NonNull MppListener listener) throws MppException Verifies and activates a card in Samsung Pay. Issuer app uses this API to send verification code back to token network to activate a card on Samsung Pay. When adding a card to Samsung Pay, the issuer/card network may request secondary authentication(IDV). The user can verify IDV via issuer app and after user verification (by logging to issuer app), issuer app sends some information back to issuer/card network via Samsung Pay to activate the card.- Parameters:
cardId
- Unique card identification provided by Samsung Pay.activationCode
- Issuer provided verification code.cardInfoData
- Extra verification data issuer wants to pass to issuer server or card network.listener
- The listener asMppListener
interface.- Throws:
MppException
- UseMppException.getMppError()
()} to get error object with error code and error description.
-
activate
public static void activate(@NonNull Activity activity, @NonNull String activationCode) throws MppException Passes Activation Code to to Samsung Pay.- Parameters:
activity
- Token activation activity.activationCode
- Activation code.- Throws:
MppException
- UseMppException.getMppError()
()} to get error object with error code and error description.
-
activate
Returns the user to Google Wallet after the activation process is complete- Parameters:
activity
- Token activation activity.- Throws:
MppException
- UseMppException.getMppError()
()} to get error object with error code and error description.
-
declineActivation
public static void declineActivation(@NonNull Activity activity, MeaPushProvisioning.SamsungPay.ActivationResult activationResult) throws MppException Declines activation with status.- Parameters:
activity
- Token activation activity.activationResult
- Activation result.- Throws:
MppException
- UseMppException.getMppError()
()} to get error object with error code and error description.
-
getCard
public static void getCard(@NonNull Intent intent, @NonNull SamsungPayCardListener listener) throws MppException Gets SamsungPay Card using Token Unique Reference from Intent's data.- Parameters:
intent
- Intentlistener
- The listener asGooglePayTokenInfoListener
interface.- Throws:
MppException
- UseMppException.getMppError()
()} to get error object with error code and error description.
-
activate
public static void activate(@NonNull com.samsung.android.sdk.samsungpay.v2.card.Card card, @Nullable Activity activity, @Nullable MppActivateListener listener) Activates token using TSP and returns back to the Google Wallet.- Parameters:
card
- Samsung Card object's instance.activity
- Activity.- Throws:
NetworkOnMainThreadException
- Method should not be called on the Main thread.
-
activate
public static void activate(String tokenUniqueReference, MppPaymentNetwork paymentNetwork) throws MppException Activate using TSP.- Parameters:
tokenUniqueReference
- Token Unique Reference, correspond to the token ID in TSP.paymentNetwork
- Payment network- Throws:
MppException
- UseMppException.getMppError()
()} to get error object with error code and error description.NetworkOnMainThreadException
- Method should not be called on the Main thread.
-
activate
public static void activate(String tokenUniqueReference, MppPaymentNetwork paymentNetwork, MppActivateListener listener) Activate using TSP.- Parameters:
tokenUniqueReference
- Token Unique Reference, correspond to the token ID in TSP.paymentNetwork
- Payment networklistener
- The listener asMppActivateListener
interface.
-
isDefaultPaymentApplication
Issuer app should check if Samsung Pay is the default NFC payment app after card tokenization. This will ensure that the users who provision a token will be able to use it in Samsung Pay.- Parameters:
context
- Context needed for check.- Returns:
- true if Samsung Pay is the default application for contactless, false otherwise
- Throws:
MppException
- UseMppException.getMppError()
()} to get error object with error code and error description.
-
setAsDefaultPaymentApplication
Set Samsung Pay as a default app for NFC payments.- Parameters:
activity
- Activity to be used forActivity.startActivityForResult(Intent, int)
call.requestCode
- a request code value to be passed intoActivity.startActivityForResult(Intent, int)
call.
-
sendUserToSamsungPay
Sends user to the Samsung Pay app to see the tokenized card.- Parameters:
activity
- Activity to be used for launching Samsung Pay app.
-
isWalletAvailable
Checks if Samsung Pay is installed on device.- Parameters:
context
- Application context.- Returns:
- true Google Wallet is installed on device, false otherwise.
- Throws:
MppException
- UseMppException.getMppError()
to get error object with error code and error description.
-
getTokens
public static MppGetTokensResponseData getTokens(@NonNull MppCardDataParameters cardData, @Nullable String walletId, @Nullable String deviceId, @NonNull Context context) throws MppException, NetworkOnMainThreadException Get Samsung Pay tokens for the specified card. Synchronous method.- Parameters:
cardData
- Card data object containing the card information.walletId
- Wallet ID of the active wallet.deviceId
- Device ID of the active wallet.context
- Application context.- Returns:
- Returns data containing card payment network, last four digits and related tokens.
- Throws:
MppException
- UseMppException.getMppError()
()} to get error object with error code and error description.NetworkOnMainThreadException
- Method should not be called on the Main thread.
-
getTokens
public static void getTokens(@NonNull MppCardDataParameters cardData, @Nullable String walletId, @Nullable String deviceId, @NonNull Context context, @NonNull MppGetTokensListener listener) Get Samsung Pay tokens for the specified card. Asynchronous method.- Parameters:
cardData
- Card data object containing the card information.walletId
- Wallet ID of the active wallet.deviceId
- Device ID of the active wallet.context
- Application context.listener
- The listener asMppGetTokensListener
interface.
-
getTokenizationData
public static MppGetOemTokenizationDataResponseData getTokenizationData(@NonNull MppCardDataParameters cardData, @Nullable String walletId, @Nullable String deviceId, @NonNull Context context) throws MppException, NetworkOnMainThreadException Get Samsung Pay Push Provisioning tokenization data which includes Opaque Payment Card (OPC) - a binary blob of information which needs to be shared with Samsung Pay 'as is' and will be presented to TSP to receive a token.- Parameters:
cardData
- Card data object containing the card information.walletId
- Wallet ID of the active wallet.deviceId
- Device ID of the active wallet.context
- Application context.- Returns:
- return Opaque Payment Card (OPC) - a binary blob of information which needs to be shared with Google Pay 'as is' and will be presented to TSP to receive a token.
- Throws:
MppException
- UseMppException.getMppError()
()} to get error object with error code and error description.NetworkOnMainThreadException
- Method should not be called on the Main thread.
-
getTokenizationData
public static void getTokenizationData(@NonNull MppCardDataParameters cardData, @Nullable String walletId, @Nullable String deviceId, @NonNull Context context, @NonNull MppGetOemTokenizationDataListener listener) Get Samsung Pay Push Provisioning tokenization data. In listener onSuccess() callback return Opaque Payment Card (OPC) - a binary blob of information which needs to be shared with Google Pay 'as is' and will be presented to TSP to receive a token.- Parameters:
cardData
- Card data object containing the card information.walletId
- Wallet ID of the active wallet.deviceId
- Device ID of the active wallet.context
- Application context.listener
- The listener asMppGetOemTokenizationDataListener
interface.
-