Ir para o conteúdo

Update transaction

updateTransaction()


Method to perform the process of updating a transaction, used in testing scenarios.

Methods

Assinatura Description
void updateTransaction(UpdateTransactionRequest removeTransactionRequest, PaymentCallback<Void> insertTransactionCallback) Performs the process of updating a transaction.

Parameters

Name Type Mandatory Description
request RemoveTransactionRequest Yes Data transfer object that will contain the information for the transaction request.
callback PaymentCallback Yes Interface that will be executed for notifications of success or failure of the transaction process.

Detail Parameters request (UpdateTransactionRequest)

Name Type Mandatory Description
id String Yes Unique identifier for the transaction.
value BigDecimal Yes Transaction amount.
productType Integer Yes Type of product involved in the transaction.
installmentQuantity Integer Yes Number of installments for the payment.
acquirerName String Yes Name of the acquirer.
cardBrandId String Yes Identifier for the brand of the card used.
maskedPan String Yes Masked Primary Account Number (PAN) of the card.
panLast4Digits String Yes Last 4 digits of the card PAN.
captureType Integer Yes Type of capture for the transaction.
paymentStatus Integer Yes Status of the payment (e.g., approved, pending, or rejected).
paymentDate Date Yes Date and time when the payment was made.
acquirerId String Yes Identifier for the transaction provided by the acquirer.
acquirerResponseCode String Yes Response code from the acquirer for the transaction.
acquirerResponseDate Date Yes Date and time when the acquirer responded to the transaction.
authCode String Yes Authorization code provided by the acquirer for the transaction.
paymentClientReceipt String Yes Client receipt for the payment.
paymentMerchantReceipt String Yes Merchant receipt for the payment.
additionalValueType Integer Yes Type of additional value applied to the transaction (e.g., tax or fee).
cashbackValue BigDecimal Yes Cashback amount applied to the transaction.
accountTypeId String Yes Type of account used for the transaction (e.g., checking or savings).
planId String Yes Identifier for the payment plan used.
productShortName String Yes Short name for the product involved in the transaction.
batchId String Yes Identifier for the batch in which the transaction is processed.
nsu String Yes Unique identifier for the transaction, used by the acquirer.
cardHolder String Yes Name of the cardholder associated with the transaction.
trxType Integer Yes Type of transaction (e.g., purchase, refund, or reversal).
terminalSpecificId String Yes Unique identifier for the terminal used in the transaction.
originalValue String Yes The original value of the transaction before any changes (e.g., refund or chargeback).
externalAppId String Yes Identifier for the external application involved in the transaction.
acquirerNsu String Yes Acquirer’s unique transaction identifier (NSU).
ticketNumber String Yes Unique number associated with the transaction ticket.
rawAdditionalMessage String Yes Raw message sent by the acquirer for additional transaction details.
notes String Yes Additional notes or remarks related to the transaction.
dni String Yes Identification number of the cardholder or payer.
qrId String Yes QR code identifier associated with the transaction.
aid String Yes Application Identifier used in the transaction (usually for EMV or NFC transactions).
appLabel String Yes Label for the application used in the transaction.
acquirerPackage String Yes Package or set of information describing the payment method used by the acquirer.
terminalAcquirerSpecificId String Yes Specific identifier for the terminal provided by the acquirer.

callback (PaymentCallback)

Name Type Mandatory Description
onSuccess Method for notification in case of success.
onError Method for notification in case of failure.
ErrorData.paymentsResponseCode String Yes Response code for the error that occurred. See Vide Response Codes
ErrorData.acquirerResponseCode String No Response code for the error returned by the acquirer. Note that this error will only be returned if the transaction is not authorized by the acquirer.
ErrorData.responseMessage String Yes Descriptive message of the cause of the non-authorization. If the transaction was denied by the acquirer, it will contain the message returned by the acquirer.
ErrorData.acquirerAdditionalMessage String No Message sent in field 63 of EPS response, to be printed or displayed at the end of the transaction flow. The payment application is responsible for displaying this on the screen or verifying the content in this field, but it must also send the value received to the integrated application so it can apply its business rules based on this field's content.

Exemplo

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() {

    UpdateTransactionRequest updateTransactionRequest = new UpdateTransactionRequest();
    // set mandatory information of the request

    try {
      paymentClient.updateTransaction(updateTransactionRequest, this);
    } catch (ClientException e) {
      Log.e(TAG, "Error", e);
    }
  }

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

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