Пример #1
0
  public static String createOAuthGrant(BraintreeGateway gateway, String merchantId, String scope) {
    Http http = new Http(gateway.getConfiguration());
    OAuthGrantRequest request = new OAuthGrantRequest().scope(scope).merchantId(merchantId);

    NodeWrapper node = http.post("/oauth_testing/grants", request);
    return node.findString("code");
  }
 /** 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);
 }
  List<CreditCard> fetchExpiringCreditCards(List<String> ids, String queryString) {
    IdsSearchRequest query = new IdsSearchRequest().ids().in(ids);

    NodeWrapper response = http.post("/payment_methods/all/expiring?" + queryString, query);

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

    return items;
  }
 /**
  * Creates an {@link CreditCard}.
  *
  * @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);
 }
 /**
  * Returns a {@link ResourceCollection} of all credit cards expiring between the given calendars.
  *
  * @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);
 }
 /**
  * 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);
 }