com.braintreegateway.PaymentMethodNonceGateway 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.util.Http;
import com.braintreegateway.util.NodeWrapper;
public class PaymentMethodNonceGateway {
private Http http;
private Configuration configuration;
public PaymentMethodNonceGateway(Http http, Configuration configuration) {
this.http = http;
this.configuration = configuration;
}
public Result create(String paymentMethodToken) {
NodeWrapper response = http.post(configuration.getMerchantPath() + "/payment_methods/" + paymentMethodToken + "/nonces");
return parseResponse(response);
}
public Result create(PaymentMethodNonceRequest request) {
NodeWrapper response = http.post(configuration.getMerchantPath() + "/payment_methods/" + request.getPaymentMethodToken() + "/nonces", request);
return parseResponse(response);
}
public PaymentMethodNonce find(String paymentMethodNonce) {
NodeWrapper response = http.get(configuration.getMerchantPath() + "/payment_method_nonces/" + paymentMethodNonce);
return new PaymentMethodNonce(response);
}
public Result parseResponse(NodeWrapper response) {
return new Result(response, PaymentMethodNonce.class);
}
}