Skip to content

Commit d1d11eb

Browse files
committed
Fix test & remove @JvmName annotations from CreateInvoiceLink fields
1 parent 71ae890 commit d1d11eb

File tree

2 files changed

+52
-18
lines changed

2 files changed

+52
-18
lines changed

library/src/main/java/com/pengrad/telegrambot/request/CreateInvoiceLink.kt

+51-17
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,56 @@ class CreateInvoiceLink(
3535
val currency: String by requestParameter(currency)
3636
val prices: Array<LabeledPrice> by requestParameter(arrayOf(*prices))
3737

38-
@set:JvmName("providerToken") var providerToken: String? by optionalRequestParameter(customParameterName = "provider_token")
39-
@set:JvmName("subscriptionPeriod") var subscriptionPeriod: Int? by optionalRequestParameter(customParameterName = "subscription_period")
40-
@set:JvmName("businessConnectionId") var businessConnectionId: String? by optionalRequestParameter(customParameterName = "business_connection_id")
41-
@set:JvmName("maxTipAmount") var maxTipAmount: Int? by optionalRequestParameter(customParameterName = "max_tip_amount")
42-
@set:JvmName("suggestedTipAmounts") var suggestedTipAmounts: Array<Int>? by optionalRequestParameter(customParameterName = "suggested_tip_amounts")
43-
@set:JvmName("providerData") var providerData: String? by optionalRequestParameter(customParameterName = "provider_data")
44-
@set:JvmName("photoUrl") var photoUrl: String? by optionalRequestParameter(customParameterName = "photo_url")
45-
@set:JvmName("photoSize") var photoSize: Int? by optionalRequestParameter(customParameterName = "photo_size")
46-
@set:JvmName("photoWidth") var photoWidth: Int? by optionalRequestParameter(customParameterName = "photo_width")
47-
@set:JvmName("photoHeight") var photoHeight: Int? by optionalRequestParameter(customParameterName = "photo_height")
48-
@set:JvmName("needName") var needName: Boolean? by optionalRequestParameter(customParameterName = "need_name")
49-
@set:JvmName("needPhoneNumber") var needPhoneNumber: Boolean? by optionalRequestParameter(customParameterName = "need_phone_number")
50-
@set:JvmName("needEmail") var needEmail: Boolean? by optionalRequestParameter(customParameterName = "need_email")
51-
@set:JvmName("needShippingAddress") var needShippingAddress: Boolean? by optionalRequestParameter(customParameterName = "need_shipping_address")
52-
@set:JvmName("sendEmailToProvider") var sendEmailToProvider: Boolean? by optionalRequestParameter(customParameterName = "send_email_to_provider")
53-
@set:JvmName("sendPhoneNumberToProvider") var sendPhoneNumberToProvider: Boolean? by optionalRequestParameter(customParameterName = "send_phone_number_to_provider")
54-
@set:JvmName("isFlexible") var isFlexible: Boolean? by optionalRequestParameter(customParameterName = "is_flexible")
38+
var providerToken: String? by optionalRequestParameter(customParameterName = "provider_token")
39+
var subscriptionPeriod: Int? by optionalRequestParameter(customParameterName = "subscription_period")
40+
var businessConnectionId: String? by optionalRequestParameter(customParameterName = "business_connection_id")
41+
var maxTipAmount: Int? by optionalRequestParameter(customParameterName = "max_tip_amount")
42+
var suggestedTipAmounts: Array<Int>? by optionalRequestParameter(customParameterName = "suggested_tip_amounts")
43+
var providerData: String? by optionalRequestParameter(customParameterName = "provider_data")
44+
var photoUrl: String? by optionalRequestParameter(customParameterName = "photo_url")
45+
var photoSize: Int? by optionalRequestParameter(customParameterName = "photo_size")
46+
var photoWidth: Int? by optionalRequestParameter(customParameterName = "photo_width")
47+
var photoHeight: Int? by optionalRequestParameter(customParameterName = "photo_height")
48+
var needName: Boolean? by optionalRequestParameter(customParameterName = "need_name")
49+
var needPhoneNumber: Boolean? by optionalRequestParameter(customParameterName = "need_phone_number")
50+
var needEmail: Boolean? by optionalRequestParameter(customParameterName = "need_email")
51+
var needShippingAddress: Boolean? by optionalRequestParameter(customParameterName = "need_shipping_address")
52+
var sendEmailToProvider: Boolean? by optionalRequestParameter(customParameterName = "send_email_to_provider")
53+
var sendPhoneNumberToProvider: Boolean? by optionalRequestParameter(customParameterName = "send_phone_number_to_provider")
54+
var isFlexible: Boolean? by optionalRequestParameter(customParameterName = "is_flexible")
55+
56+
fun providerToken(providerToken: String) = apply { this.providerToken = providerToken }
57+
58+
fun subscriptionPeriod(subscriptionPeriod: Int) = apply { this.subscriptionPeriod = subscriptionPeriod }
59+
60+
fun businessConnectionId(businessConnectionId: String) = apply { this.businessConnectionId = businessConnectionId }
61+
62+
fun maxTipAmount(maxTipAmount: Int) = apply { this.maxTipAmount = maxTipAmount }
63+
64+
fun suggestedTipAmounts(suggestedTipAmounts: Array<Int>) = apply { this.suggestedTipAmounts = suggestedTipAmounts }
65+
66+
fun providerData(providerData: String) = apply { this.providerData = providerData }
67+
68+
fun photoUrl(photoUrl: String) = apply { this.photoUrl = photoUrl }
69+
70+
fun photoSize(photoSize: Int) = apply { this.photoSize = photoSize }
71+
72+
fun photoWidth(photoWidth: Int) = apply { this.photoWidth = photoWidth }
73+
74+
fun photoHeight(photoHeight: Int) = apply { this.photoHeight = photoHeight }
75+
76+
fun needName(needName: Boolean) = apply { this.needName = needName }
77+
78+
fun needPhoneNumber(needPhoneNumber: Boolean) = apply { this.needPhoneNumber = needPhoneNumber }
79+
80+
fun needEmail(needEmail: Boolean) = apply { this.needEmail = needEmail }
81+
82+
fun needShippingAddress(needShippingAddress: Boolean) = apply { this.needShippingAddress = needShippingAddress }
83+
84+
fun sendEmailToProvider(sendEmailToProvider: Boolean) = apply { this.sendEmailToProvider = sendEmailToProvider }
85+
86+
fun sendPhoneNumberToProvider(sendPhoneNumberToProvider: Boolean) = apply { this.sendPhoneNumberToProvider = sendPhoneNumberToProvider }
87+
88+
fun isFlexible(isFlexible: Boolean) = apply { this.isFlexible = isFlexible }
5589

5690
}

library/src/test/java/com/pengrad/telegrambot/PaymentsTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public void testSuccessfulPayment() {
169169

170170
assertNotNull(payment);
171171
assertEquals("USD", payment.currency());
172-
assertEquals(Integer.valueOf(200), payment.totalAmount());
172+
assertEquals(200, payment.totalAmount());
173173
assertEquals("my_payload", payment.invoicePayload());
174174
assertEquals("2", payment.shippingOptionId());
175175
assertEquals("tcid", payment.telegramPaymentChargeId());

0 commit comments

Comments
 (0)