com.braintreegateway.CreditCardVerificationGateway 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.
package com.braintreegateway;
import com.braintreegateway.exceptions.NotFoundException;
import com.braintreegateway.util.Http;
import com.braintreegateway.util.NodeWrapper;
import java.util.ArrayList;
import java.util.List;
public class CreditCardVerificationGateway {
private Configuration configuration;
private Http http;
public CreditCardVerificationGateway(Http http, Configuration configuration) {
this.configuration = configuration;
this.http = http;
}
List fetchCreditCardVerifications(CreditCardVerificationSearchRequest query, List ids) {
query.ids().in(ids);
NodeWrapper response = http.post(configuration.getMerchantPath() + "/verifications/advanced_search", query);
List items = new ArrayList();
for (NodeWrapper node : response.findAll("verification")) {
items.add(new CreditCardVerification(node));
}
return items;
}
public CreditCardVerification find(String id) {
if (id == null || id.trim().equals("")) {
throw new NotFoundException();
}
return new CreditCardVerification(http.get(configuration.getMerchantPath() + "/verifications/" + id));
}
public ResourceCollection search(CreditCardVerificationSearchRequest query) {
NodeWrapper node = http.post(configuration.getMerchantPath() + "/verifications/advanced_search_ids", query);
return new ResourceCollection(new CreditCardVerificationPager(this, query), node);
}
public Result create(CreditCardVerificationRequest request) {
NodeWrapper response = http.post(configuration.getMerchantPath() + "/verifications", request);
return new Result(response, CreditCardVerification.class);
}
}