Logo
Developer SDK
Version 1.9.632.913d652c-152450467.
CommerceMessage Class Referenceabstract
Inheritance diagram for CommerceMessage:
CommerceApi CommerceAppMessage CommerceTrigger AppendReceiptRequest AppendReceiptResponse CardDataRequest CardDataResponse EncryptedCardRequest EncryptedCardResponse SendDataToPosRequest SendDataToPosResponse AlternatePaymentRequest AlternatePaymentResponse AmountAdjustmentRequest AmountAdjustmentResponse AmountFinalizedNotification AuthorizationCompletedNotification BasketAdjustmentRequest BasketAdjustmentResponse BasketFinalizedNotification CardBinReceivedNotification CardPresentedNotification LoyaltyRequest LoyaltyResponse PaymentAmountAdjustmentRequest PaymentAmountAdjustmentResponse PaymentCompletedNotification TransactionEndedNotification TransactionStartedNotification

Public Member Functions

abstract String getName ()
 
abstract String getMessageType ()
 
final String getHandle ()
 
final boolean isTypeOfMessage (@NonNull final String type)
 
boolean put (String key, Object value)
 
Object get (String key)
 
List< String > getKeys ()
 
Status send (@NonNull final Context context)
 

Static Public Member Functions

static Intent createIntentWithName (final String name)
 
static Intent createIntentForMessage (final CommerceMessage message)
 
static int getNumberOfReceivers (Context context, final CommerceMessage message)
 
static boolean isResponseMessage (String name)
 
static boolean isRequestMessage (String name)
 
static boolean isMessageFromCPAndroid (String name)
 

Static Public Attributes

static final String MESSAGE_TYPE_INTERAPP = "INTERAPP"
 
static final String MESSAGE_TYPE_PAYMENTTRIGGER = "PAYMENTTRIGGER"
 
static final String MESSAGE_TYPE_NONPAYMENTTRIGGER = "NONPAYMENTTRIGGER"
 
static final String MESSAGE_TYPE_PAYMENTAPI = "PAYMENTAPI"
 
static final String MESSAGE_TYPE_UNKNOWN = "UNKNOWN"
 
static final String INTENT_ACTION_PREFIX = "com.verifone.commerce.intent.action."
 
static final String INTENT_CATEGORY = "com.verifone.commerce.intent.category.CP_MESSAGE"
 
static final String INTENT_EXTRA_HANDLE = "com.verifone.commerce.intent.extra.HANDLE"
 
static final String INTENT_EXTRA_PAYLOAD = "com.verifone.commerce.intent.extra.PAYLOAD"
 
static final String CP_JSON_KEY_TRANS_AMOUNT = "Trans_Amount"
 
static final String CP_JSON_KEY_CURRENCY = "Currency"
 

Protected Member Functions

void populateMessageFromJson (@NonNull final JSONObject jsonObject)
 
void setHandle (@NonNull final String handle)
 
JSONObject getJsonObject ()
 
void setJsonObject (@NonNull final JSONObject jsonObject)
 
abstract String getAsJsonString ()
 
String getCpAppId ()
 
void setCpAppId (String cpAppId)
 
String getCpAppVersion ()
 
void setCpAppVersion (String cpAppVersion)
 

Detailed Description

This message provides the foundation for all messages sent between Android applications and the Terminal applications.

The SDK provides a Builder class, as described below, which builds the appropriate Message class from the Intent. Any extra key/value pairs in the payload that are not a part of the defined message must still be included, and are only exposed through the free-form functions described in Commerce Message.

Definition at line 36 of file CommerceMessage.java.

Member Function Documentation

◆ get()

Object get ( String  key)

Retrieves a specific object from the payload. This is primarily useful when storing custom values in the messages.

Parameters
keyThe key to refer to the information. This should be developer-specific to avoid possible data conflicts.
Returns
The value stored for the key. See put(String key, Object value) for more information.

Definition at line 316 of file CommerceMessage.java.

◆ getHandle()

final String getHandle ( )

A unique identifier for a sequence of messages, allowing a response to be linked to a request.

Definition at line 245 of file CommerceMessage.java.

◆ getKeys()

List<String> getKeys ( )

Retrieves all custom keys from the payload. This is primarily useful when storing extra context in the messages.

Returns
All of the custom keys in the payload.

Definition at line 333 of file CommerceMessage.java.

◆ getMessageType()

abstract String getMessageType ( )
abstract

Indicates the type of message to better enable message routing within a receiving application. This will only be set by the Builder, and readable afterwards. This is derived from the name/notification ID.

◆ getName()

abstract String getName ( )
abstract

The name of the message, useful for routing the message within an application.

◆ isMessageFromCPAndroid()

static boolean isMessageFromCPAndroid ( String  name)
static

Detects if message goes from android CP app outside: responses for triggers and requests for APIs

Definition at line 280 of file CommerceMessage.java.

◆ isTypeOfMessage()

final boolean isTypeOfMessage ( @NonNull final String  type)

Another way of handling message types. Refer to getMessageType() for more information.

Definition at line 253 of file CommerceMessage.java.

◆ populateMessageFromJson()

void populateMessageFromJson ( @NonNull final JSONObject  jsonObject)
protected

Optional method, called when building the message from an intent.

Definition at line 389 of file CommerceMessage.java.

◆ put()

boolean put ( String  key,
Object  value 
)

Allows putting custom values in the payload, which can provide additional context.

Parameters
keyThe key to refer to the information. This should be developer-specific to avoid possible data conflicts.
valueThe value to transmit. This value must be able to be added to a JSON object.
Returns
True if the value was successfully added for the key, false if the addition failed.

Definition at line 294 of file CommerceMessage.java.

◆ send()

Status send ( @NonNull final Context  context)

Sends the message.

Returns
A Status object indicating that the underlying service received the call and will make an attempt to deliver, or an error if there are immediate issues detected.

Definition at line 348 of file CommerceMessage.java.

Member Data Documentation

◆ MESSAGE_TYPE_INTERAPP

final String MESSAGE_TYPE_INTERAPP = "INTERAPP"
static

Messages communicating with a companion application and the corresponding responses.

Definition at line 41 of file CommerceMessage.java.

◆ MESSAGE_TYPE_NONPAYMENTTRIGGER

final String MESSAGE_TYPE_NONPAYMENTTRIGGER = "NONPAYMENTTRIGGER"
static

Triggers created by the Terminal Payment application outside of the context of a transaction and the corresponding responses.

Definition at line 51 of file CommerceMessage.java.

◆ MESSAGE_TYPE_PAYMENTAPI

final String MESSAGE_TYPE_PAYMENTAPI = "PAYMENTAPI"
static

Messages created by an Android application and sent to the Terminal Payment application within the context of a transaction and the corresponding responses.

Definition at line 56 of file CommerceMessage.java.

◆ MESSAGE_TYPE_PAYMENTTRIGGER

final String MESSAGE_TYPE_PAYMENTTRIGGER = "PAYMENTTRIGGER"
static

Triggers created by the Terminal Payment application within the context of a transaction and the corresponding responses.

Definition at line 46 of file CommerceMessage.java.

◆ MESSAGE_TYPE_UNKNOWN

final String MESSAGE_TYPE_UNKNOWN = "UNKNOWN"
static

Allows for future extensions.

Definition at line 60 of file CommerceMessage.java.


The documentation for this class was generated from the following file:

This document is the confidential property of Verifone, Inc. Any reproduction or distribution of this document, in whole or in part, or the disclosure of any of the information contained herein, without the prior written consent of Verifone, Inc. is prohibited. This document and any supplemental material supplied as part of any review must be returned to Verifone, Inc. upon request. Notice: This document may go through material revisions over time. While the Company will make every effort to keep readers updated as changes occur, care must be taken by the reader to make sure they are reading the latest version. Version numbers appear in the title page and revision history page of this document. All rights reserved. Verifone, the Verifone logo are either trademarks or registered trademarks of Verifone in the United States and/or other countries. All other trademarks or brand names are properties of their respective holders.