TransactionPartner.user constructor

  1. @Assert('type == TransactionPartnerType.user', 'type must be TransactionPartnerType.user')
const TransactionPartner.user({
  1. @JsonKey(name: 'type') @Default(TransactionPartnerType.user) TransactionPartnerType type,
  2. @JsonKey(name: 'transaction_type') required TransactionType transactionType,
  3. @JsonKey(name: 'user') required User user,
  4. @JsonKey(name: 'affiliate') AffiliateInfo? affiliate,
  5. @JsonKey(name: 'invoice_payload') String? invoicePayload,
  6. @JsonKey(name: 'subscription_period') int? subscriptionPeriod,
  7. @JsonKey(name: 'paid_media') List<PaidMedia>? paidMedia,
  8. @JsonKey(name: 'paid_media_payload') String? paidMediaPayload,
  9. @JsonKey(name: 'gift') Gift? gift,
  10. @JsonKey(name: 'premium_subscription_duration') int? premiumSubscriptionDuration,
})

Represents a transaction with a user

Implementation

@Assert(
  'type == TransactionPartnerType.user',
  'type must be TransactionPartnerType.user',
)
const factory TransactionPartner.user({
  /// Type of the transaction partner, always "user"
  @JsonKey(name: 'type')
  @Default(TransactionPartnerType.user)
  TransactionPartnerType type,

  /// Type of the transaction, currently one of "invoice_payment" for payments via invoices,
  /// "paid_media_payment" for payments for paid media, "gift_purchase" for gifts sent by the bot,
  /// "premium_purchase" for Telegram Premium subscriptions gifted by the bot,
  /// "business_account_transfer" for direct transfers from managed business accounts
  @JsonKey(name: 'transaction_type') required TransactionType transactionType,

  /// Information about the user.
  @JsonKey(name: 'user') required final User user,

  /// Optional. Information about the affiliate that received a commission via this transaction.
  /// Can be available only for "invoice_payment" and "paid_media_payment" transactions.
  @JsonKey(name: 'affiliate') final AffiliateInfo? affiliate,

  /// Optional. Bot-specified invoice payload.
  /// Can be available only for "invoice_payment" transactions.
  @JsonKey(name: 'invoice_payload') final String? invoicePayload,

  /// Optional. The duration of the paid subscription.
  /// Can be available only for "invoice_payment" transactions.
  @JsonKey(name: 'subscription_period') final int? subscriptionPeriod,

  /// Optional. Information about the paid media bought by the user;
  /// for "paid_media_payment" transactions only
  @JsonKey(name: 'paid_media') final List<PaidMedia>? paidMedia,

  /// Optional. Bot-specified paid media payload.
  /// Can be available only for "paid_media_payment" transactions.
  @JsonKey(name: 'paid_media_payload') final String? paidMediaPayload,

  /// Optional. The gift sent to the user by the bot;
  /// for "gift_purchase" transactions only
  @JsonKey(name: 'gift') final Gift? gift,

  /// Optional. Number of months the gifted Telegram Premium subscription
  /// will be active for; for "premium_purchase" transactions only
  @JsonKey(name: 'premium_subscription_duration')
  final int? premiumSubscriptionDuration,
}) = TransactionPartnerUser;