Class PendingPaymentBuilder
- java.lang.Object
-
- ru.easydonate.easydonate4j.api.v3.data.model.shop.payment.pending.PendingPaymentBuilder
-
public final class PendingPaymentBuilder extends Object
The pending payment builder that can be used to customize the generating payment.- Author:
- soknight
- See Also:
EasyDonateClient.createPayment()
-
-
Constructor Summary
Constructors Constructor Description PendingPaymentBuilder(@NotNull EasyDonateClient client)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull PendingPaymentBuilderaddProduct(int productId)Add a new product x1 for this payment.@NotNull PendingPaymentBuilderaddProduct(int productId, int amount)Add a new product with custom amount for this payment.@NotNull PendingPaymentcreate()Create a payment with current configuration.@NotNull EasyDonateClientgetClient()Get the owning API client instance.@NotNull PendingPaymentBuilderremoveProduct(int productId)Remove an added product from the shopcart.@NotNull PendingPaymentBuildersetCoupon(@NotNull String coupon)Set a new coupon used for this payment.@NotNull PendingPaymentBuildersetCustomer(@NotNull String customer)Set a new customer for this payment.@NotNull PendingPaymentBuildersetEmail(@NotNull String email)Set a new customer email for this payment.@NotNull PendingPaymentBuildersetProducts(@NotNull Map<String,Integer> products)Set a new products shopcart for this payment.@NotNull PendingPaymentBuildersetRedirectUrl(@NotNull String redirectUrl)Set a new redirect URL for this payment.@NotNull PendingPaymentBuildersetServerId(int serverId)Set a new server ID for this payment.@NotNull QueryParamstoQueryParams()Convert current payment configuration to the query params.@NotNull StringtoString()
-
-
-
Constructor Detail
-
PendingPaymentBuilder
public PendingPaymentBuilder(@NotNull @NotNull EasyDonateClient client)
-
-
Method Detail
-
getClient
@NotNull public @NotNull EasyDonateClient getClient()
Get the owning API client instance.- Returns:
- The API client instance.
-
create
@NotNull public @NotNull PendingPayment create() throws HttpRequestException, HttpResponseException
Create a payment with current configuration.- Returns:
- The generated pending payment instance.
- Throws:
HttpRequestException- when any errors with request sending has occured.HttpResponseException- when any errors with response handling has occured.- See Also:
PendingPayment,EasyDonateClient.createPayment(PendingPaymentBuilder)
-
toQueryParams
@NotNull public @NotNull QueryParams toQueryParams()
Convert current payment configuration to the query params.- Returns:
- The created query params instance.
-
setCustomer
@NotNull public @NotNull PendingPaymentBuilder setCustomer(@NotNull @NotNull String customer)
Set a new customer for this payment.- Parameters:
customer- a new customer.- Returns:
- The builder instance for method chaining continuation.
-
setServerId
@NotNull public @NotNull PendingPaymentBuilder setServerId(int serverId)
Set a new server ID for this payment.- Parameters:
serverId- a new server ID.- Returns:
- The builder instance for method chaining continuation.
-
addProduct
@NotNull public @NotNull PendingPaymentBuilder addProduct(int productId)
Add a new product x1 for this payment.- Parameters:
productId- the ID of an adding product.- Returns:
- The builder instance for method chaining continuation.
-
addProduct
@NotNull public @NotNull PendingPaymentBuilder addProduct(int productId, int amount)
Add a new product with custom amount for this payment.- Parameters:
productId- the ID of an adding product.amount- an amount of this product.- Returns:
- The builder instance for method chaining continuation.
-
setProducts
@NotNull public @NotNull PendingPaymentBuilder setProducts(@NotNull @NotNull Map<String,Integer> products)
Set a new products shopcart for this payment.- Parameters:
products- a new products shopcart.- Returns:
- The builder instance for method chaining continuation.
-
removeProduct
@NotNull public @NotNull PendingPaymentBuilder removeProduct(int productId)
Remove an added product from the shopcart.- Parameters:
productId- the ID of added product.- Returns:
- The builder instance for method chaining continuation.
-
setEmail
@NotNull public @NotNull PendingPaymentBuilder setEmail(@NotNull @NotNull String email)
Set a new customer email for this payment.- Parameters:
email- a new customer email.- Returns:
- The builder instance for method chaining continuation.
-
setCoupon
@NotNull public @NotNull PendingPaymentBuilder setCoupon(@NotNull @NotNull String coupon)
Set a new coupon used for this payment.- Parameters:
coupon- a new coupon code.- Returns:
- The builder instance for method chaining continuation.
-
setRedirectUrl
@NotNull public @NotNull PendingPaymentBuilder setRedirectUrl(@NotNull @NotNull String redirectUrl)
Set a new redirect URL for this payment.- Parameters:
redirectUrl- a new redirect URL.- Returns:
- The builder instance for method chaining continuation.
-
-