Package com.braintreegateway.util

Examples of com.braintreegateway.util.NodeWrapper


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

    public Result<? extends PaymentMethod> create(PaymentMethodRequest request) {
        NodeWrapper response = http.post("/payment_methods", request);
        return parseResponse(response);
    }
View Full Code Here


        NodeWrapper response = http.post("/payment_methods", request);
        return parseResponse(response);
    }

    public Result<? extends PaymentMethod> update(String token, PaymentMethodRequest request) {
        NodeWrapper response = http.put("/payment_methods/any/" + token, request);
        return parseResponse(response);
    }
View Full Code Here

    public PaymentMethod find(String token) {
        if(token.trim().equals("") || token == null)
            throw new NotFoundException();

        NodeWrapper response = http.get("/payment_methods/any/" + token);

        if (response.getElementName() == "paypal-account") {
            return new PayPalAccount(response);
        } else if (response.getElementName() == "credit-card") {
            return new CreditCard(response);
        } else if (response.getElementName() == "sepa-bank-account") {
            return new SEPABankAccount(response);
        } else {
            return new UnknownPaymentMethod(response);
        }
    }
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

            throw new NotFoundException("Token is required");
        if(receivingMerchantId.trim().equals("") || receivingMerchantId == null)
            throw new NotFoundException("Receiving merchant ID is required");

        try {
          NodeWrapper node = http.post("/payment_methods/forward", forwardRequest);
          return new Result<PaymentMethodNonce>(node, PaymentMethodNonce.class);
        } catch (NotFoundException e) {
          throw new NotFoundException("Receiving merchant or payment metod not found");
        }
    }
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/credit_card/" + 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

     *
     * @return a {@link ResourceCollection}.
     */
    public ResourceCollection<CreditCard> expiringBetween(Calendar start, Calendar end) {
        String queryString = dateQueryString(start, end);
        NodeWrapper response = http.post("/payment_methods/all/expiring_ids?" + queryString);
        return new ResourceCollection<CreditCard>(new ExpiringCreditCardPager(this, queryString), response);
    }
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.