All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.stripe.service.CustomerPaymentMethodService Maven / Gradle / Ivy
// File generated from our OpenAPI spec
package com.stripe.service;
import com.google.gson.reflect.TypeToken;
import com.stripe.exception.StripeException;
import com.stripe.model.PaymentMethod;
import com.stripe.model.StripeCollection;
import com.stripe.net.ApiMode;
import com.stripe.net.ApiRequest;
import com.stripe.net.ApiRequestParams;
import com.stripe.net.ApiResource;
import com.stripe.net.ApiService;
import com.stripe.net.BaseAddress;
import com.stripe.net.RequestOptions;
import com.stripe.net.StripeResponseGetter;
import com.stripe.param.CustomerPaymentMethodListParams;
import com.stripe.param.CustomerPaymentMethodRetrieveParams;
public final class CustomerPaymentMethodService extends ApiService {
public CustomerPaymentMethodService(StripeResponseGetter responseGetter) {
super(responseGetter);
}
/** Returns a list of PaymentMethods for a given Customer. */
public StripeCollection list(
String customer, CustomerPaymentMethodListParams params) throws StripeException {
return list(customer, params, (RequestOptions) null);
}
/** Returns a list of PaymentMethods for a given Customer. */
public StripeCollection list(String customer, RequestOptions options)
throws StripeException {
return list(customer, (CustomerPaymentMethodListParams) null, options);
}
/** Returns a list of PaymentMethods for a given Customer. */
public StripeCollection list(String customer) throws StripeException {
return list(customer, (CustomerPaymentMethodListParams) null, (RequestOptions) null);
}
/** Returns a list of PaymentMethods for a given Customer. */
public StripeCollection list(
String customer, CustomerPaymentMethodListParams params, RequestOptions options)
throws StripeException {
String path =
String.format("/v1/customers/%s/payment_methods", ApiResource.urlEncodeId(customer));
ApiRequest request =
new ApiRequest(
BaseAddress.API,
ApiResource.RequestMethod.GET,
path,
ApiRequestParams.paramsToMap(params),
options,
ApiMode.V1);
return this.request(request, new TypeToken>() {}.getType());
}
/** Retrieves a PaymentMethod object for a given Customer. */
public PaymentMethod retrieve(
String customer, String paymentMethod, CustomerPaymentMethodRetrieveParams params)
throws StripeException {
return retrieve(customer, paymentMethod, params, (RequestOptions) null);
}
/** Retrieves a PaymentMethod object for a given Customer. */
public PaymentMethod retrieve(String customer, String paymentMethod, RequestOptions options)
throws StripeException {
return retrieve(customer, paymentMethod, (CustomerPaymentMethodRetrieveParams) null, options);
}
/** Retrieves a PaymentMethod object for a given Customer. */
public PaymentMethod retrieve(String customer, String paymentMethod) throws StripeException {
return retrieve(
customer, paymentMethod, (CustomerPaymentMethodRetrieveParams) null, (RequestOptions) null);
}
/** Retrieves a PaymentMethod object for a given Customer. */
public PaymentMethod retrieve(
String customer,
String paymentMethod,
CustomerPaymentMethodRetrieveParams params,
RequestOptions options)
throws StripeException {
String path =
String.format(
"/v1/customers/%s/payment_methods/%s",
ApiResource.urlEncodeId(customer), ApiResource.urlEncodeId(paymentMethod));
ApiRequest request =
new ApiRequest(
BaseAddress.API,
ApiResource.RequestMethod.GET,
path,
ApiRequestParams.paramsToMap(params),
options,
ApiMode.V1);
return this.request(request, PaymentMethod.class);
}
}