Package com.braintreegateway.util

Examples of com.braintreegateway.util.NodeWrapper


     * @param id the id of the {@link Address}.
     * @param request the request object containing the {@link AddressRequest} parameters.
     * @return the {@link Address} or raises a {@link com.braintreegateway.exceptions.NotFoundException}.
     */
    public Result<Address> update(String customerId, String id, AddressRequest request) {
        NodeWrapper node = http.put("/customers/" + customerId + "/addresses/" + id, request);
        return new Result<Address>(node, Address.class);
    }
View Full Code Here


    public MerchantAccount(NodeWrapper node) {
        this.id = node.findString("id");
        this.status = EnumUtils.findByName(Status.class, node.findString("status"));

        NodeWrapper masterNode = node.findFirst("master-merchant-account");
        if (masterNode != null)
            this.masterMerchantAccount = new MerchantAccount(masterNode);
        else
            this.masterMerchantAccount = null;
    }
View Full Code Here

    public WebhookNotification(NodeWrapper node) {
        this.kind = EnumUtils.findByName(Kind.class, node.findString("kind"));
        this.timestamp = node.findDateTime("timestamp");

        NodeWrapper wrapperNode = node.findFirst("subject");

        if (wrapperNode.findFirst("api-error-response") != null) {
            wrapperNode = wrapperNode.findFirst("api-error-response");
        }

        if (wrapperNode.findFirst("subscription") != null) {
            this.subscription = new Subscription(wrapperNode.findFirst("subscription"));
        }

        if (wrapperNode.findFirst("merchant-account") != null) {
            this.merchantAccount = new MerchantAccount(wrapperNode.findFirst("merchant-account"));
        }

        if (wrapperNode.findFirst("transaction") != null) {
            this.transaction = new Transaction(wrapperNode.findFirst("transaction"));
        }

        if (wrapperNode.findFirst("partner-merchant") != null) {
            this.partnerMerchant = new PartnerMerchant(wrapperNode.findFirst("partner-merchant"));
        }

        if (!wrapperNode.isSuccess()) {
            this.errors = new ValidationErrors(wrapperNode);
        }
    }
View Full Code Here

     * Please use gateway.transparentRedirect().confirmCreditCard() instead
     */
    @Deprecated
    public Result<CreditCard> confirmTransparentRedirect(String queryString) {
        TransparentRedirectRequest trRequest = new TransparentRedirectRequest(configuration, queryString);
        NodeWrapper node = http.post("/payment_methods/all/confirm_transparent_redirect_request", trRequest);
        return new Result<CreditCard>(node, CreditCard.class);
    }
View Full Code Here

     * @param request
     *            the request.
     * @return a {@link Result}.
     */
    public Result<CreditCard> create(CreditCardRequest request) {
        NodeWrapper node = http.post("/payment_methods", request);
        return new Result<CreditCard>(node, CreditCard.class);
    }
View Full Code Here

     * @param request
     *            the request.
     * @return a {@link Result}.
     */
    public Result<CreditCard> update(String token, CreditCardRequest request) {
        NodeWrapper node = http.put("/payment_methods/" + token, request);
        return new Result<CreditCard>(node, CreditCard.class);
    }
View Full Code Here

     * Returns a {@link ResourceCollection} of all expired credit cards.
     *
     * @return a {@link ResourceCollection}.
     */
    public ResourceCollection<CreditCard> expired() {
        NodeWrapper response = http.post("/payment_methods/all/expired_ids");
        return new ResourceCollection<CreditCard>(new ExpiredCreditCardPager(this), response);
    }
View Full Code Here

    }

    List<CreditCard> fetchExpiredCreditCards(List<String> ids) {
        IdsSearchRequest query = new IdsSearchRequest().ids().in(ids);

        NodeWrapper response = http.post("/payment_methods/all/expired", query);

        List<CreditCard> items = new ArrayList<CreditCard>();
        for (NodeWrapper node : response.findAll("credit-card")) {
            items.add(new CreditCard(node));
        }

        return items;
    }
View Full Code Here

        prepaid = node.findString("prepaid");
        countryOfIssuance = node.findString("country-of-issuance");
        issuingBank = node.findString("issuing-bank");
        uniqueNumberIdentifier = node.findString("unique-number-identifier");
        token = node.findString("token");
        NodeWrapper billingAddressResponse = node.findFirst("billing-address");
        if (billingAddressResponse != null) {
            billingAddress = new Address(billingAddressResponse);
        }
        subscriptions = new ArrayList<Subscription>();
        for (NodeWrapper subscriptionResponse : node.findAll("subscriptions/subscription")) {
View Full Code Here

    public MerchantAccountGateway(Http http) {
        this.http = http;
    }

    public Result<MerchantAccount> create(MerchantAccountRequest request) {
        final NodeWrapper response = http.post(CREATE_URL, request);
        return new Result<MerchantAccount>(response, MerchantAccount.class);
    }
View Full Code Here

TOP

Related Classes of com.braintreegateway.util.NodeWrapper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.