Skip to content

Commit 718a312

Browse files
committed
Added the new field provider_data to sendInvoice for sharing information about the invoice with the payment provider
1 parent b860d34 commit 718a312

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

library/src/main/java/com/pengrad/telegrambot/request/SendInvoice.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ public SendInvoice(Integer chatId, String title, String description, String payl
1515
.add("start_parameter", startParameter).add("currency", currency).add("prices", serialize(prices));
1616
}
1717

18+
public SendInvoice providerData(String providerData) {
19+
return add("provider_data", providerData);
20+
}
21+
1822
public SendInvoice photoUrl(String photoUrl) {
1923
return add("photo_url", photoUrl);
2024
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,7 @@ public void sendVideoNoteFile() throws IOException {
718718
public void sendInvoice() {
719719
SendResponse response = bot.execute(new SendInvoice(chatId, "title", "desc", "my_payload",
720720
"284685063:TEST:NThlNWQ3NDk0ZDQ5", "my_start_param", "USD", new LabeledPrice("label", 200))
721+
.providerData("{\"foo\" : \"bar\"}")
721722
.photoUrl("https://telegram.org/img/t_logo.png").photoSize(100).photoHeight(100).photoWidth(100)
722723
.needPhoneNumber(true).needShippingAddress(true).needEmail(true).needName(true)
723724
.isFlexible(true)

0 commit comments

Comments
 (0)