Package com.mercadopago.client.customer
Class CustomerClient
- java.lang.Object
-
- com.mercadopago.client.MercadoPagoClient
-
- com.mercadopago.client.customer.CustomerClient
-
public class CustomerClient extends MercadoPagoClient
Client responsible for performing customer actions.
-
-
Field Summary
-
Fields inherited from class com.mercadopago.client.MercadoPagoClient
defaultHeaders, httpClient
-
-
Constructor Summary
Constructors Constructor Description CustomerClient()
Default constructor.CustomerClient(MPHttpClient httpClient)
Constructor used for providing a custom http client.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Customer
create(CustomerRequest request)
Add new customer.Customer
create(CustomerRequest request, MPRequestOptions requestOptions)
Add new customer.CustomerCard
createCard(String customerId, CustomerCardCreateRequest request)
Associate new card with customer.CustomerCard
createCard(String customerId, CustomerCardCreateRequest request, MPRequestOptions requestOptions)
Associate new card with customer.Customer
delete(String customerId)
Delete customer.Customer
delete(String customerId, MPRequestOptions requestOptions)
Delete customer.CustomerCard
deleteCard(String customerId, String cardId)
Delete card.CustomerCard
deleteCard(String customerId, String cardId, MPRequestOptions requestOptions)
Delete card.Customer
get(String customerId)
Get customer.Customer
get(String customerId, MPRequestOptions requestOptions)
Get customer.CustomerCard
getCard(String customerId, String cardId)
Get customer card by id.CustomerCard
getCard(String customerId, String cardId, MPRequestOptions requestOptions)
Get customer card by id.MPResourceList<CustomerCard>
listCards(String customerId)
List customer cards.MPResourceList<CustomerCard>
listCards(String customerId, MPRequestOptions requestOptions)
List customer cards.MPResultsResourcesPage<Customer>
search(MPSearchRequest request)
Search customer.MPResultsResourcesPage<Customer>
search(MPSearchRequest request, MPRequestOptions requestOptions)
Search customer.Customer
update(String customerId, CustomerRequest request)
Update customer.Customer
update(String customerId, CustomerRequest request, MPRequestOptions requestOptions)
Update customer.
-
-
-
Constructor Detail
-
CustomerClient
public CustomerClient()
Default constructor. Uses the default http client used by the SDK
-
CustomerClient
public CustomerClient(MPHttpClient httpClient)
Constructor used for providing a custom http client.- Parameters:
httpClient
- http client used for performing requests
-
-
Method Detail
-
get
public Customer get(String customerId) throws MPException, MPApiException
Get customer.- Parameters:
customerId
- id of the customer to which the card belongs- Returns:
- the requested customer card
- Throws:
MPException
- an error if the request failsMPApiException
- See Also:
- api docs
-
get
public Customer get(String customerId, MPRequestOptions requestOptions) throws MPException, MPApiException
Get customer.- Parameters:
customerId
- id of the customerrequestOptions
- metadata to customize the request- Returns:
- the requested customer card
- Throws:
MPException
- an error if the request failsMPApiException
- See Also:
- api docs
-
create
public Customer create(CustomerRequest request) throws MPException, MPApiException
Add new customer.- Parameters:
request
- attributes used to perform the request- Returns:
- the customer just added
- Throws:
MPException
- an error if the request failsMPApiException
- See Also:
- api docs
-
create
public Customer create(CustomerRequest request, MPRequestOptions requestOptions) throws MPException, MPApiException
Add new customer.- Parameters:
request
- attributes used to perform the requestrequestOptions
- metadata to customize the request- Returns:
- the customer just added
- Throws:
MPException
- an error if the request failsMPApiException
- See Also:
- api docs
-
update
public Customer update(String customerId, CustomerRequest request) throws MPException, MPApiException
Update customer.- Parameters:
customerId
- id of the customerrequest
- attributes used to perform the request- Returns:
- the customer just updated
- Throws:
MPException
- an error if the request failsMPApiException
- See Also:
- api docs
-
update
public Customer update(String customerId, CustomerRequest request, MPRequestOptions requestOptions) throws MPException, MPApiException
Update customer.- Parameters:
customerId
- id of the customerrequest
- attributes used to perform the requestrequestOptions
- metadata to customize the request- Returns:
- the customer just updated
- Throws:
MPException
- an error if the request failsMPApiException
- See Also:
- api docs
-
delete
public Customer delete(String customerId) throws MPException, MPApiException
Delete customer.- Parameters:
customerId
- id of the customer- Returns:
- the customer just deleted
- Throws:
MPException
- an error if the request failsMPApiException
-
delete
public Customer delete(String customerId, MPRequestOptions requestOptions) throws MPException, MPApiException
Delete customer.- Parameters:
customerId
- id of the customerrequestOptions
- metadata to customize the request- Returns:
- the customer just deleted
- Throws:
MPException
- an error if the request failsMPApiException
-
search
public MPResultsResourcesPage<Customer> search(MPSearchRequest request) throws MPException, MPApiException
Search customer.- Parameters:
request
- attributes used to perform the request- Returns:
- search result
- Throws:
MPException
- an error if the request failsMPApiException
- See Also:
- api docs
-
search
public MPResultsResourcesPage<Customer> search(MPSearchRequest request, MPRequestOptions requestOptions) throws MPException, MPApiException
Search customer.- Parameters:
request
- attributes used to search for customerrequestOptions
- metadata to customize the request- Returns:
- search result
- Throws:
MPException
- an error if the request failsMPApiException
- See Also:
- api docs
-
getCard
public CustomerCard getCard(String customerId, String cardId) throws MPException, MPApiException
Get customer card by id.- Parameters:
customerId
- id of the customercardId
- id of the card- Returns:
- the requested card
- Throws:
MPException
- an error if the request failsMPApiException
- See Also:
- api docs
-
getCard
public CustomerCard getCard(String customerId, String cardId, MPRequestOptions requestOptions) throws MPException, MPApiException
Get customer card by id.- Parameters:
customerId
- id of the customercardId
- id of the cardrequestOptions
- metadata to customize the request- Returns:
- the requested card
- Throws:
MPException
- an error if the request failsMPApiException
- See Also:
- api docs
-
createCard
public CustomerCard createCard(String customerId, CustomerCardCreateRequest request) throws MPException, MPApiException
Associate new card with customer.- Parameters:
customerId
- id of the customerrequest
- attributes used to associate a new card with customer- Returns:
- the added card
- Throws:
MPException
- an error if the request failsMPApiException
- See Also:
- api docs
-
createCard
public CustomerCard createCard(String customerId, CustomerCardCreateRequest request, MPRequestOptions requestOptions) throws MPException, MPApiException
Associate new card with customer.- Parameters:
customerId
- id of the customerrequest
- attributes used to associate a new card with customerrequestOptions
- metadata to customize the request- Returns:
- the added card
- Throws:
MPException
- an error if the request failsMPApiException
- See Also:
- api docs
-
deleteCard
public CustomerCard deleteCard(String customerId, String cardId) throws MPException, MPApiException
Delete card.- Parameters:
customerId
- id of the customercardId
- id of the card being removed- Returns:
- the deleted card
- Throws:
MPException
- an error if the request failsMPApiException
- See Also:
- api docs
-
deleteCard
public CustomerCard deleteCard(String customerId, String cardId, MPRequestOptions requestOptions) throws MPException, MPApiException
Delete card.- Parameters:
customerId
- id of the customercardId
- id of the card being removedrequestOptions
- metadata to customize the request- Returns:
- the deleted card
- Throws:
MPException
- an error if the request failsMPApiException
- See Also:
- api docs
-
listCards
public MPResourceList<CustomerCard> listCards(String customerId) throws MPException, MPApiException
List customer cards.- Parameters:
customerId
- id of the customer- Returns:
- list of customer cards
- Throws:
MPException
- an error if the request failsMPApiException
- See Also:
- api docs
-
listCards
public MPResourceList<CustomerCard> listCards(String customerId, MPRequestOptions requestOptions) throws MPException, MPApiException
List customer cards.- Parameters:
customerId
- id of the customerrequestOptions
- metadata to customize the request- Returns:
- list of customer cards
- Throws:
MPException
- an error if the request failsMPApiException
- See Also:
- api docs
-
-