Ir para o conteúdo

Check Paystore for notifications.


These are notifications to obtain instructions for the terminal, such as: updates to the application store, data extraction, initialization, etc. This action is already executed automatically by the Terminal in a configurable time, however, using this method it is possible to call this action.

Methods

Signature Description
void getNotifications(PaymentCallback paymentCallback) Check for notifications on the Play Store.

Parameters

Name Type Mandatory Description
callback PaymentCallback Yes Interface that will be executed for success or error notifications.

Detail Parameters

callback

Name Type Mandatory Description
onSuccess Method for notification on success
onError Method for notification in case of error.
ErrorData.paymentsResponseCode String Yes Response code for the error that occurred. See Response Codes
ErrorData.responseMessage String Yes Descriptive message of the reason for the non-authorization. If the transaction was denied by the acquirer, it will contain the message returned by the acquirer.

Example

public class MyActivity extends Activity implements PaymentClient.PaymentCallback {

    private PaymentClient paymentClient;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_payment);

        paymentClient = new PaymentClientImpl();
    }

    @Override
    protected void onResume() {
        super.onResume();
        paymentClient.bind(this);
    }

    @Override
    protected void onDestroy() {
         try {
            paymentClient.unbind(this);
        } catch (Exception e) {
            Log.e(TAG, e.getMessage());
        }
        super.onDestroy();
    }

    public void doExecute(){
        ApplicationInfo appInfo = new ApplicationInfo();
        appInfo.setCredentials(new Credentials("demo-app", "TOKEN-KEY-DEMO"));
        appInfo.setSoftwareVersion("1.0.0.0");

        try {
            paymentClient.getNotifications(this);
        } catch (ClientException e) {
            Log.e(TAG, "Error while checking notifications.", e);
        }
    }

    @Override
    public void onError(Object data) {
        Log.e(TAG, "Error: " + errorData.getResponseMessage());
    }

    @Override
    public void onSuccess(Object data) {
        Log.i(TAG, "Success!");
    }
}