Package com.braintreegateway
Class TransactionGateway
- java.lang.Object
-
- com.braintreegateway.TransactionGateway
-
public class TransactionGateway extends Object
Provides methods to interact withTransactions. E.g. sales, credits, refunds, searches, etc. This class does not need to be instantiated directly. Instead, useBraintreeGateway.transaction()to get an instance of this class:BraintreeGateway gateway = new BraintreeGateway(...); gateway.transaction().create(...)
For more detailed information onTransactions, see https://developer.paypal.com/braintree/docs/reference/response/transaction/java
-
-
Field Summary
Fields Modifier and Type Field Description private Configurationconfigurationprivate Httphttp
-
Constructor Summary
Constructors Constructor Description TransactionGateway(Http http, Configuration configuration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Result<Transaction>adjustAuthorization(String id, TransactionRequest request)Submits the transaction with the given id to be adjusted for the given amount which must be less than or equal to the authorization amount.Result<Transaction>adjustAuthorization(String id, BigDecimal amount)Submits the transaction with the given id to be adjusted for the given amount which must be less than or equal to the authorization amount.Result<Transaction>cancelRelease(String id)Cancels a pending release of a transaction with the given id from escrow.Result<Transaction>cloneTransaction(String id, TransactionCloneRequest request)Result<Transaction>credit(TransactionRequest request)Creates a creditTransaction.(package private) List<Transaction>fetchTransactions(TransactionSearchRequest query, List<String> ids)Transactionfind(String id)Finds aTransactionby id.Result<Transaction>holdInEscrow(String id)Holds the transaction with the given id for escrow.Result<Transaction>packageTracking(String id, PackageTrackingRequest packageTrackingRequest)Supplement the transaction with package tracking detailsResult<Transaction>refund(String id)Refunds all or part of a previous saleTransaction.Result<Transaction>refund(String id, TransactionRefundRequest request)Result<Transaction>refund(String id, BigDecimal amount)Result<Transaction>releaseFromEscrow(String id)Submits the transaction with the given id for release.Result<Transaction>sale(TransactionRequest request)Creates a saleTransaction.ResourceCollection<Transaction>search(TransactionSearchRequest query)Finds all Transactions that match the query and returns aResourceCollection.Result<Transaction>submitForPartialSettlement(String id, TransactionRequest request)Submits a partial settlement transaction for the given id.Result<Transaction>submitForPartialSettlement(String id, BigDecimal amount)Submits a partial settlement transaction for the given id.Result<Transaction>submitForSettlement(String id)Submits the transaction with the given id for settlement.Result<Transaction>submitForSettlement(String id, TransactionRequest request)Submits the transaction with the given id to be settled along with a TransactionRequest object.Result<Transaction>submitForSettlement(String id, BigDecimal amount)Submits the transaction with the given id to be settled for the given amount which must be less than or equal to the authorization amount.Result<Transaction>updateCustomFields(String id, TransactionRequest request)Updates custom field values for a given transactionResult<Transaction>updateDetails(String id, TransactionRequest request)Updates details for a transaction that has been submitted for settlement.Result<Transaction>voidTransaction(String id)Voids the transaction with the given id.
-
-
-
Field Detail
-
http
private Http http
-
configuration
private Configuration configuration
-
-
Constructor Detail
-
TransactionGateway
public TransactionGateway(Http http, Configuration configuration)
-
-
Method Detail
-
adjustAuthorization
public Result<Transaction> adjustAuthorization(String id, BigDecimal amount)
Submits the transaction with the given id to be adjusted for the given amount which must be less than or equal to the authorization amount.- Parameters:
id- of the transaction to to be adjusted.amount- to be adjusted.- Returns:
Result.
-
adjustAuthorization
public Result<Transaction> adjustAuthorization(String id, TransactionRequest request)
Submits the transaction with the given id to be adjusted for the given amount which must be less than or equal to the authorization amount.- Parameters:
id- of the transaction to to be adjusted.request- is the TransactionRequest object with amount details.- Returns:
Result.
-
cloneTransaction
public Result<Transaction> cloneTransaction(String id, TransactionCloneRequest request)
-
credit
public Result<Transaction> credit(TransactionRequest request)
Creates a creditTransaction.- Parameters:
request- the request.- Returns:
- a
Result
-
find
public Transaction find(String id)
Finds aTransactionby id.- Parameters:
id- the id of theTransaction.- Returns:
- the
Transactionor raises aNotFoundException.
-
refund
public Result<Transaction> refund(String id)
Refunds all or part of a previous saleTransaction.- Parameters:
id- the id of the (sale)Transactionto refund.- Returns:
- a
Result.
-
refund
public Result<Transaction> refund(String id, BigDecimal amount)
-
refund
public Result<Transaction> refund(String id, TransactionRefundRequest request)
-
sale
public Result<Transaction> sale(TransactionRequest request)
Creates a saleTransaction.- Parameters:
request- the request.- Returns:
- a
Result.
-
search
public ResourceCollection<Transaction> search(TransactionSearchRequest query)
Finds all Transactions that match the query and returns aResourceCollection. See: https://developer.paypal.com/braintree/docs/reference/request/transaction/search/java- Parameters:
query- the search query- Returns:
- a
ResourceCollectionor raises aUnexpectedException.
-
fetchTransactions
List<Transaction> fetchTransactions(TransactionSearchRequest query, List<String> ids)
-
cancelRelease
public Result<Transaction> cancelRelease(String id)
Cancels a pending release of a transaction with the given id from escrow.- Parameters:
id- of the transaction to cancel release from escrow of.- Returns:
- a
Result.
-
holdInEscrow
public Result<Transaction> holdInEscrow(String id)
Holds the transaction with the given id for escrow.- Parameters:
id- of the transaction to hold for escrow.- Returns:
- a
Result.
-
releaseFromEscrow
public Result<Transaction> releaseFromEscrow(String id)
Submits the transaction with the given id for release.- Parameters:
id- of the transaction to submit for release.- Returns:
- a
Result.
-
submitForSettlement
public Result<Transaction> submitForSettlement(String id)
Submits the transaction with the given id for settlement.- Parameters:
id- of the transaction to submit for settlement.- Returns:
- a
Result.
-
submitForSettlement
public Result<Transaction> submitForSettlement(String id, BigDecimal amount)
Submits the transaction with the given id to be settled for the given amount which must be less than or equal to the authorization amount.- Parameters:
id- of the transaction to submit for settlement.amount- to settle. must be less than or equal to the authorization amount.- Returns:
Result.
-
submitForSettlement
public Result<Transaction> submitForSettlement(String id, TransactionRequest request)
Submits the transaction with the given id to be settled along with a TransactionRequest object.- Parameters:
id- of the transaction to submit for settlement.request- the request.- Returns:
Result.
-
updateDetails
public Result<Transaction> updateDetails(String id, TransactionRequest request)
Updates details for a transaction that has been submitted for settlement.- Parameters:
id- of the transaction to update the details for.request- the request.- Returns:
Result.
-
voidTransaction
public Result<Transaction> voidTransaction(String id)
Voids the transaction with the given id.- Parameters:
id- of the transaction to void.- Returns:
Result.
-
submitForPartialSettlement
public Result<Transaction> submitForPartialSettlement(String id, BigDecimal amount)
Submits a partial settlement transaction for the given id.- Parameters:
id- of the transaction to add the partial settlement transaction for.amount- of the partial settlement- Returns:
Result.
-
submitForPartialSettlement
public Result<Transaction> submitForPartialSettlement(String id, TransactionRequest request)
Submits a partial settlement transaction for the given id.- Parameters:
id- of the transaction to add the partial settlement transaction for.request- the request.- Returns:
Result.
-
updateCustomFields
public Result<Transaction> updateCustomFields(String id, TransactionRequest request)
Updates custom field values for a given transaction- Parameters:
id- of the transaction being updated.request- a TransactionRequest object containing custom field info..- Returns:
Result.
-
packageTracking
public Result<Transaction> packageTracking(String id, PackageTrackingRequest packageTrackingRequest)
Supplement the transaction with package tracking details- Parameters:
id- of the transaction to supplement the package details forpackageTrackingRequest- the package tracking request related to the transaction- Returns:
Result
-
-