Package com.braintreegateway.util

Examples of com.braintreegateway.util.NodeWrapper


        return new TrUtil(configuration).buildTrData(trData, redirectURL);
    }
   
    private <T> Result<T> confirmTr(Class<T> klass, String queryString) {
        TransparentRedirectRequest trRequest = new TransparentRedirectRequest(configuration, queryString);
        NodeWrapper node = http.post("/transparent_redirect_requests/" + trRequest.getId() + "/confirm", trRequest);
        if (!node.getElementName().equals(StringUtils.classToXMLName(klass)) && !node.getElementName().equals("api-error-response")) {
            throw new IllegalArgumentException("You attemped to confirm a " + StringUtils.classToXMLName(klass) + ", but received a " + node.getElementName() + ".");
        }
       
        return new Result<T>(node, klass);
    }
View Full Code Here


    public String generate() {
      return generate(new ClientTokenRequest());
    }

    public String generate(ClientTokenRequest request) {
      NodeWrapper response = null;
      verifyOptions(request);
      response = http.post("/client_token", request);

      String token = response.findString("value");
      if (token != null) {
          token = StringUtils.unescapeUtf8(token);
      }
      return token;
    }
View Full Code Here

        firstName = node.findString("first-name");
        lastName = node.findString("last-name");
        dateOfBirth = node.findString("date-of-birth");
        email = node.findString("email");
        phone = node.findString("phone");
        NodeWrapper addressNode = node.findFirst("address");
        if (addressNode != null)
            this.address = new Address(addressNode);
        else
            this.address = null;
    }
View Full Code Here

        this.http = http;
    }

    List<CreditCardVerification> fetchCreditCardVerifications(CreditCardVerificationSearchRequest query, List<String> ids) {
        query.ids().in(ids);
        NodeWrapper response = http.post("/verifications/advanced_search", query);

        List<CreditCardVerification> items = new ArrayList<CreditCardVerification>();
        for (NodeWrapper node : response.findAll("verification")) {
            items.add(new CreditCardVerification(node));
        }

        return items;
    }
View Full Code Here

        return new CreditCardVerification(http.get("/verifications/" + id));
    }

    public ResourceCollection<CreditCardVerification> search(CreditCardVerificationSearchRequest query) {
        NodeWrapper node = http.post("/verifications/advanced_search_ids", query);
        return new ResourceCollection<CreditCardVerification>(new CreditCardVerificationPager(this, query), node);
    }
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

            throw new NotFoundException();
        return new MerchantAccount(http.get("/merchant_accounts/" + id));
    }

    public Result<MerchantAccount> update(String id, MerchantAccountRequest request) {
        final NodeWrapper response = http.put("/merchant_accounts/" + id + "/update_via_api", request);
        return new Result<MerchantAccount>(response, MerchantAccount.class);
    }
View Full Code Here

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

    public List<Discount> all() {
        NodeWrapper node = http.get("/discounts");

        List<Discount> discounts = new ArrayList<Discount>();

        for (NodeWrapper discountResponse : node.findAll("discount")) {
            discounts.add(new Discount(discountResponse));
        }

        return discounts;
    }
View Full Code Here

        if (m.find()) {
          throw new InvalidSignatureException("payload contains illegal characters");
        }
        validateSignature(signature, payload);
        String xmlPayload = new String(Base64.decodeBase64(payload));
        NodeWrapper node = NodeWrapperFactory.instance.create(xmlPayload);
        return new WebhookNotification(node);
    }
View Full Code Here

     * @param customerId the id of the {@link Customer}.
     * @param request the request object.
     * @return a {@link Result} object.
     */
    public Result<Address> create(String customerId, AddressRequest request) {
        NodeWrapper node = http.post("/customers/" + customerId + "/addresses", request);
        return new Result<Address>(node, Address.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.