Ir para o conteúdo

[DEPRECATED] Performs the pending resolution process QR Code - Specific Payment


This method must be called to perform the QR Code - Specific Payment issue resolution.

Methods

Signature Description
void resolveQRCodePendencies(QRCodePendencyRequest settlementRequest, PaymentCallback paymentCallback) Performs the QR Code pending resolution process for a specific payment.

Parameters

Name Type Mandatory Description
request QRCodePendencyRequest Yes Data transfer object that will contain the information of the request for the resolution of pending issues for specific payment QR Code.
callback PaymentCallback Yes Interface that will be executed for notifications of success or error of the pending resolution process for specific payment QR Code.

Parameter details request (QRCodePendencyRequest)

Name Type Mandatory Description
applicationId Credentials Yes Identification of the application that is requesting the query.
secretToken Credentials Yes Access token of the application requesting the query.
softwareVersion String Yes Version of the application that is requesting the query.
date Date Yes Payment date/time.
qrId String Yes QrCode identifier generated by the capture terminal.

response (QRCodePendencyResponse)

Name Type Description
status QRCodeIntentStatus Indicates transaction status with QR.
type QRCodeIntentType QR type (sale, cancellation, return).
payment PaymentV2 Object representing payment data.
reversePayment ReversePayment Object representing chargeback data.
QRCodeIntentStatus
Name Id Description
CREATED 1 Transaction created.
PENDING 2 Pending transaction.
WAITING 3 Transaction on hold.
PROCESSING 4 Transaction in process.
PROCESSED 5 Transaction processed.
CONFIRMED 6 Request confirmed.
CANCELED 7 Transaction cancelled.
REVERSED 8 Transaction reversed.
DENIED 9 Transaction Denied.
EXPIRED 10 Transaction expired.
UNREACHABLE 11 Transaction inaccessible.
QRCodeIntentType
Name Id Description
PAYMENT 0 Indicates that the QR type is a payment.
REVERSAL 1 Indicates that the QR type is a chargeback.
DEVOLUTION 2 Indicates that the QR type is a bounce.
Example
import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import com.jakewharton.threetenabp.AndroidThreeTen;

import java.math.BigDecimal;

import java.text.SimpleDateFormat;
import java.util.Arrays;

import java.util.Date;
import java.util.List;
import java.util.TimeZone;

import br.com.phoebus.android.payments.api.ApplicationInfo;
import br.com.phoebus.android.payments.api.Credentials;

import br.com.phoebus.android.payments.api.Payment;
import br.com.phoebus.android.payments.api.PaymentClient;
import br.com.phoebus.android.payments.api.PaymentStatus;
import br.com.phoebus.android.payments.api.provider.PaymentContract;
import br.com.phoebus.android.payments.api.provider.PaymentProviderApi;
import br.com.phoebus.android.payments.api.provider.PaymentProviderRequest;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    Button bt_start;
    private PaymentClient paymentClient;
    public static final String TEST_APPLICATION_ID = "0";
    public static final String TEST_SECRET_TOKEN = "000000000000000000000000";
    public static final String TAG = "TAG_DEMO";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        bt_start = (Button) this.findViewById(R.id.button);
        bt_start.setOnClickListener(this);
        paymentClient = new PaymentClient();
        AndroidThreeTen.init(getApplication());

    }


    @Override
    public void onClick(View view) {
        doExecute();
    }


    public void doExecute() {
        //setting the credentials
        Credentials credentials = new Credentials();
        credentials.setApplicationId(TEST_APPLICATION_ID);
        credentials.setSecretToken(TEST_SECRET_TOKEN);

        ApplicationInfo applicationInfo = new ApplicationInfo();
        applicationInfo.setCredentials(credentials);
        applicationInfo.setSoftwareVersion("1.0");

        //creating request object for payment
        QRCodePendencyRequest request = createRequest(applicationInfo);

    }

    private QRCodePendencyRequest createRequest(ApplicationInfo appInfo) {

        QRCodePendencyRequest request = new QRCodePendencyRequest();
        request.setApplicationInfo(appInfo);

        request.setSecretToken(appInfo.getCredentials());
        request.setApplicationId(appInfo.getCredentials());
        request.setSoftwareVersion(appInfo.getSoftwareVersion());
        request.setQrId("123");

        SimpleDateFormat isoFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS");
        isoFormat.setTimeZone(TimeZone.getTimeZone("UTC"));

        try {
            Date date = isoFormat.parse("2021-07-27T00:00:00.000");
            request.setDate(date);

        } catch (Exception e) {
            Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
            Log.e(TAG, e.getMessage(), e);

        }

        return request;
    }
}