Skip to content

Commit

Permalink
Create TransactionPartnerAffiliateProgram
Browse files Browse the repository at this point in the history
  • Loading branch information
anfanik committed Dec 8, 2024
1 parent 243a570 commit e195926
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.pengrad.telegrambot.model.stars.partner

import com.pengrad.telegrambot.model.User
import com.pengrad.telegrambot.model.stars.partner.TransactionPartnerType.AFFILIATE_PROGRAM

data class TransactionPartnerAffiliateProgram(
@get:JvmName("sponsorUser") val sponsorUser: User? = null,
@get:JvmName("commissionPerMille") val commissionPerMille: Int
) : TransactionPartner {

override val type: String
get() = AFFILIATE_PROGRAM

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.pengrad.telegrambot.model.stars.partner
object TransactionPartnerType {

const val USER = "user"
const val AFFILIATE_PROGRAM = "affiliate_program"
const val FRAGMENT = "fragment"
const val TELEGRAM_ADS = "telegram_ads"
const val TELEGRAM_API = "telegram_api"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.pengrad.telegrambot.utility.gson

import com.google.gson.*
import com.pengrad.telegrambot.model.stars.partner.*
import com.pengrad.telegrambot.model.stars.partner.TransactionPartnerType.AFFILIATE_PROGRAM
import com.pengrad.telegrambot.model.stars.partner.TransactionPartnerType.FRAGMENT
import com.pengrad.telegrambot.model.stars.partner.TransactionPartnerType.OTHER
import com.pengrad.telegrambot.model.stars.partner.TransactionPartnerType.TELEGRAM_ADS
Expand All @@ -14,6 +15,7 @@ object TransactionPartnerTypeAdapter : JsonDeserializer<TransactionPartner> {

private val typeMapping = mapOf(
USER to TransactionPartnerUser::class,
AFFILIATE_PROGRAM to TransactionPartnerAffiliateProgram::class,
FRAGMENT to TransactionPartnerFragment::class,
TELEGRAM_ADS to TransactionPartnerTelegramAds::class,
TELEGRAM_API to TransactionPartnerTelegramApi::class,
Expand Down

0 comments on commit e195926

Please sign in to comment.