com.braintreegateway.DiscountGateway Maven / Gradle / Ivy
package com.braintreegateway;
import com.braintreegateway.util.Http;
import com.braintreegateway.util.NodeWrapper;
import java.util.ArrayList;
import java.util.List;
public class DiscountGateway {
private Http http;
private Configuration configuration;
public DiscountGateway(Http http, Configuration configuration) {
this.http = http;
this.configuration = configuration;
}
public List all() {
NodeWrapper node = http.get(configuration.getMerchantPath() + "/discounts");
List discounts = new ArrayList();
for (NodeWrapper discountResponse : node.findAll("discount")) {
discounts.add(new Discount(discountResponse));
}
return discounts;
}
}