Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support of all Subscriptions-related features #407

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ public class SuccessfulPayment implements Serializable {
private OrderInfo order_info;
private String telegram_payment_charge_id;
private String provider_payment_charge_id;
private Integer subscription_expiration_date;
private Boolean is_recurring;
private Boolean is_first_recurring;

public String currency() {
return currency;
Expand All @@ -41,6 +44,18 @@ public String telegramPaymentChargeId() {
return telegram_payment_charge_id;
}

public Integer subscriptionExpirationDate() {
return subscription_expiration_date;
}

public Boolean isRecurring() {
return is_recurring;
}

public Boolean isFirstRecurring() {
return is_first_recurring;
}

public String providerPaymentChargeId() {
return provider_payment_charge_id;
}
Expand All @@ -61,6 +76,13 @@ public boolean equals(Object o) {
if (order_info != null ? !order_info.equals(that.order_info) : that.order_info != null) return false;
if (telegram_payment_charge_id != null ? !telegram_payment_charge_id.equals(that.telegram_payment_charge_id) : that.telegram_payment_charge_id != null)
return false;
if (subscription_expiration_date != null ? !subscription_expiration_date.equals(that.subscription_expiration_date) : that.subscription_expiration_date != null)
return false;
if (is_recurring != null ? !is_recurring.equals(that.is_recurring) : that.is_recurring != null)
return false;
if (is_first_recurring != null ? !is_first_recurring.equals(that.is_first_recurring) : that.is_first_recurring != null)
return false;

return provider_payment_charge_id != null ? provider_payment_charge_id.equals(that.provider_payment_charge_id) : that.provider_payment_charge_id == null;

}
Expand All @@ -74,6 +96,9 @@ public int hashCode() {
result = 31 * result + (order_info != null ? order_info.hashCode() : 0);
result = 31 * result + (telegram_payment_charge_id != null ? telegram_payment_charge_id.hashCode() : 0);
result = 31 * result + (provider_payment_charge_id != null ? provider_payment_charge_id.hashCode() : 0);
result = 31 * result + (subscription_expiration_date != null ? subscription_expiration_date.hashCode() : 0);
result = 31 * result + (is_recurring != null ? is_recurring.hashCode() : 0);
result = 31 * result + (is_first_recurring != null ? is_first_recurring.hashCode() : 0);
return result;
}

Expand All @@ -87,6 +112,9 @@ public String toString() {
", order_info=" + order_info +
", telegram_payment_charge_id='" + telegram_payment_charge_id + '\'' +
", provider_payment_charge_id='" + provider_payment_charge_id + '\'' +
", subscription_expiration_date='" + subscription_expiration_date + '\'' +
", is_recurring='" + is_recurring + '\'' +
", is_first_recurring='" + is_first_recurring + '\'' +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ public CreateInvoiceLink suggestedTipAmounts(Integer[] suggestedTipAmounts) {
return add("suggested_tip_amounts", suggestedTipAmounts);
}

public CreateInvoiceLink subscriptionPeriod(int subscriptionPeriod) {
return add("subscription_period", subscriptionPeriod);
}

public CreateInvoiceLink providerData(String providerData) {
return add("provider_data", providerData);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.pengrad.telegrambot.request;

import com.pengrad.telegrambot.response.BaseResponse;


public class EditUserStarSubscription extends BaseRequest<EditUserStarSubscription, BaseResponse> {

/**
*
* @param userId Identifier of the user whose subscription will be edited
* @param telegramPaymentChargeId Telegram payment identifier for the subscription
* @param isCanceled Pass True to cancel extension of the user subscription;
* the subscription must be active up to the end of the current subscription period.
* Pass False to allow the user to re-enable a subscription
* that was previously canceled by the bot.
*/
public EditUserStarSubscription(Long userId, String telegramPaymentChargeId, boolean isCanceled) {
super(BaseResponse.class);
add("user_id", userId).add("telegram_payment_charge_id", telegramPaymentChargeId).add("is_canceled", isCanceled);
}
}
Loading