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

com.braintreegateway.UsBankAccountVerificationGateway Maven / Gradle / Ivy

There is a newer version: 3.32.0_1
Show newest version
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 UsBankAccountVerificationGateway {
    private Http http;
    private Configuration configuration;

    public UsBankAccountVerificationGateway(Http http, Configuration configuration) {
        this.http = http;
        this.configuration = configuration;
    }

    public UsBankAccountVerification find(String id) {
        if (id == null || id.trim().equals("")) {
            throw new NotFoundException();
        }

        return new UsBankAccountVerification(http.get(configuration.getMerchantPath() + "/us_bank_account_verifications/" + id));
    }

    public ResourceCollection search(UsBankAccountVerificationSearchRequest query) {
        NodeWrapper node = http.post(configuration.getMerchantPath() + "/us_bank_account_verifications/advanced_search_ids", query);
        return new ResourceCollection(new UsBankAccountVerificationPager(this, query), node);
    }

    public Result confirmMicroTransferAmounts(String id, UsBankAccountVerificationConfirmRequest request) {
        NodeWrapper nodeWrapper = http.put(configuration.getMerchantPath() + "/us_bank_account_verifications/" + id + "/confirm_micro_transfer_amounts", request);
        return new Result(nodeWrapper, UsBankAccountVerification.class);
    }

    List fetchUsBankAccountVerifications(UsBankAccountVerificationSearchRequest query, List ids) {
        query.ids().in(ids);
        NodeWrapper response = http.post(configuration.getMerchantPath() + "/us_bank_account_verifications/advanced_search", query);

        List items = new ArrayList();
        for (NodeWrapper node : response.findAll("us-bank-account-verification")) {
            items.add(new UsBankAccountVerification(node));
        }

        return items;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy