com.stripe.model.CustomerCardCollection Maven / Gradle / Ivy
package com.stripe.model;
import com.stripe.Stripe;
import com.stripe.exception.APIConnectionException;
import com.stripe.exception.APIException;
import com.stripe.exception.AuthenticationException;
import com.stripe.exception.CardException;
import com.stripe.exception.InvalidRequestException;
import com.stripe.net.APIResource;
import com.stripe.net.RequestOptions;
import java.util.Map;
public class CustomerCardCollection extends StripeCollection {
//
/**
* List all cards.
*
* @deprecated Use the {@link #list(Map)} method instead.
* This method will be removed in the next major version.
*/
@Deprecated
public CustomerCardCollection all(Map params)
throws AuthenticationException, InvalidRequestException,
APIConnectionException, CardException, APIException {
return list(params, null);
}
/**
* List all cards.
*
* @deprecated Use the {@link #list(Map, RequestOptions)} method instead.
* This method will be removed in the next major version.
*/
@Deprecated
public CustomerCardCollection all(Map params,
RequestOptions options) throws AuthenticationException,
InvalidRequestException, APIConnectionException, CardException,
APIException {
return list(params, options);
}
/**
* List all cards.
*
* @deprecated Use the {@link #list(Map, RequestOptions)} method instead.
* This method will be removed in the next major version.
*/
@Deprecated
public CustomerCardCollection all(Map params,
String apiKey) throws AuthenticationException,
InvalidRequestException, APIConnectionException, CardException,
APIException {
return list(params, RequestOptions.builder().setApiKey(apiKey).build());
}
//
//
/**
* Create a card.
*/
public Card create(Map params)
throws AuthenticationException, InvalidRequestException,
APIConnectionException, CardException, APIException {
return create(params, (RequestOptions) null);
}
/**
* Create a card.
*/
public Card create(Map params,
RequestOptions options) throws AuthenticationException,
InvalidRequestException, APIConnectionException, CardException,
APIException {
String url = String.format("%s%s", Stripe.getApiBase(), this.getURL());
return APIResource.request(APIResource.RequestMethod.POST, url, params, Card.class, options);
}
/**
* Create a card.
*
* @deprecated Use the {@link #create(Map, RequestOptions)} method instead.
* This method will be removed in the next major version.
*/
@Deprecated
public Card create(Map params,
String apiKey) throws AuthenticationException,
InvalidRequestException, APIConnectionException, CardException,
APIException {
return create(params, RequestOptions.builder().setApiKey(apiKey).build());
}
//
//
/**
* List all cards.
*/
public CustomerCardCollection list(Map params)
throws AuthenticationException, InvalidRequestException,
APIConnectionException, CardException, APIException {
return list(params, null);
}
/**
* List all cards.
*/
public CustomerCardCollection list(Map params,
RequestOptions options) throws AuthenticationException,
InvalidRequestException, APIConnectionException, CardException,
APIException {
String url = String.format("%s%s", Stripe.getApiBase(), this.getURL());
return APIResource.requestCollection(url, params, CustomerCardCollection.class, options);
}
//
//
/**
* Retrieve a card.
*/
public Card retrieve(String id)
throws AuthenticationException, InvalidRequestException,
APIConnectionException, CardException, APIException {
return retrieve(id, (RequestOptions) null);
}
/**
* Retrieve a card.
*/
public Card retrieve(String id, RequestOptions options) throws AuthenticationException,
InvalidRequestException, APIConnectionException, CardException,
APIException {
String url = String.format("%s%s/%s", Stripe.getApiBase(), this.getURL(), id);
return APIResource.request(APIResource.RequestMethod.GET, url, null, Card.class, options);
}
/**
* Retrieve a card.
*
* @deprecated Use the {@link #retrieve(String, RequestOptions)} method instead.
* This method will be removed in the next major version.
*/
@Deprecated
public Card retrieve(String id, String apiKey) throws AuthenticationException,
InvalidRequestException, APIConnectionException, CardException,
APIException {
return retrieve(id, RequestOptions.builder().setApiKey(apiKey).build());
}
//
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy