All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.braintreegateway.PaymentMethodNonceGateway Maven / Gradle / Ivy

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);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy