com.braintreegateway.TransactionRefundRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.apache.servicemix.bundles.braintree-java
Show all versions of org.apache.servicemix.bundles.braintree-java
This OSGi bundle wraps ${pkgArtifactId} ${pkgVersion} jar file.
The newest version!
package com.braintreegateway;
import java.math.BigDecimal;
/**
* Provides a fluent interface to build up refund requests around {@link Transaction Transactions}.
*/
public class TransactionRefundRequest extends Request {
private BigDecimal amount;
private String merchantAccountId;
private String orderId;
public TransactionRefundRequest() {
}
public TransactionRefundRequest amount(BigDecimal amount) {
this.amount = amount;
return this;
}
public TransactionRefundRequest orderId(String orderId) {
this.orderId = orderId;
return this;
}
public TransactionRefundRequest merchantAccountId(String merchantAccountId) {
this.merchantAccountId = merchantAccountId;
return this;
}
@Override
public String toQueryString() {
return toQueryString("transaction");
}
@Override
public String toQueryString(String root) {
return buildRequest(root).toQueryString();
}
@Override
public String toXML() {
return buildRequest("transaction").toXML();
}
protected RequestBuilder buildRequest(String root) {
RequestBuilder builder = new RequestBuilder(root)
.addElement("amount", amount)
.addElement("merchantAccountId", merchantAccountId)
.addElement("orderId", orderId);
return builder;
}
}