Class 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 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.
      • 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.