@RequiredArgsConstructor
public class Refund {
private final BraintreeTransactionService braintreeTransactionService;
public void performRefund() {
MonetaryAmount transactionTotal = Monetary.getDefaultAmountFactory().setNumber(amount).create();
PaymentRequest paymentRequest = new PaymentRequest()
.additionalField("TRANSACTION_ID", transactionId) // The Braintree transaction id gathered from the Authorize transaction.
.transactionTotal(transactionTotal);
paymentResponse.isSuccessful();
paymentResponse.getGatewayResponseCode(); // The Braintree response code
paymentResponse.getFailureType(); // Failure type in case the transaction was not successful.
paymentResponse.getRawResponse(); // Braintree raw response stored as a JSON object.
paymentResponse.getGatewayTransactionId(); // gatewayTransaction Id from Braintree.
paymentResponse.getGatewayTransactionType(); // Braintree gateway transaction type.
paymentResponse.getResponseMap().get("TRANSACTION_ID"); // Braintree transaction Id.
paymentResponse.getResponseMap().get("TRANSACTION_STATUS"); // Braintree transaction status.
}
}