@@ -5,10 +5,10 @@ import "time"
5
5
type TransactionType = string
6
6
7
7
const (
8
- TransactionTypeFragment TransactionType = "fragment"
9
8
TransactionTypeUser TransactionType = "user"
10
- TransactionTypeOther TransactionType = "other "
9
+ TransactionTypeFragment TransactionType = "fragment "
11
10
TransactionPartnerTelegramAds TransactionType = "telegram_ads"
11
+ TransactionTypeOther TransactionType = "other"
12
12
)
13
13
14
14
type RevenueState = string
@@ -19,33 +19,8 @@ const (
19
19
RevenueStateFailed RevenueState = "failed"
20
20
)
21
21
22
- type TransactionPartner struct {
23
- // Type of the state
24
- Type TransactionType `json:"type"`
25
-
26
- // (Optional) State of the transaction if the transaction is outgoing$$
27
- WithdrawalState RevenueWithdrawalState `json:"withdrawal_state,omitempty"`
28
-
29
- // Information about the user
30
- Partner * User `json:"user,omitempty"`
31
-
32
- // (Optional) Bot-specified invoice payload
33
- InvoicePayload string `json:"invoice_payload"`
34
- }
35
-
36
- type RevenueWithdrawalState struct {
37
- // Type of the state
38
- Type RevenueState `json:"type"`
39
-
40
- // Date the withdrawal was completed in Unix time
41
- Date int `json:"date,omitempty"`
42
-
43
- // An HTTPS URL that can be used to see transaction details
44
- URL string `json:"url,omitempty"`
45
- }
46
-
47
22
type StarTransaction struct {
48
- // Unique identifier of the transaction. Coincides with the identifer of the
23
+ // Unique identifier of the transaction. Coincides with the identifier of the
49
24
// original transaction for refund transactions. Coincides with
50
25
// SuccessfulPayment.telegram_payment_charge_id for successful incoming
51
26
// payments from users.
@@ -66,7 +41,33 @@ type StarTransaction struct {
66
41
Receiver TransactionPartner `json:"receiver"`
67
42
}
68
43
69
- // Date returns the local datetime.
70
- func (c * StarTransaction ) Date () time.Time {
44
+ type TransactionPartner struct {
45
+ // Type of the state
46
+ Type TransactionType `json:"type"`
47
+ User * User `json:"user,omitempty"`
48
+ Payload string `json:"invoice_payload"`
49
+
50
+ // (Optional) State of the transaction if the transaction is outgoing$$
51
+ Withdrawal RevenueWithdrawal `json:"withdrawal_state,omitempty"`
52
+ }
53
+
54
+ type RevenueWithdrawal struct {
55
+ // Type of the state
56
+ Type RevenueState `json:"type"`
57
+
58
+ // Date the withdrawal was completed in Unix time
59
+ Unixtime int `json:"date,omitempty"`
60
+
61
+ // An HTTPS URL that can be used to see transaction details
62
+ URL string `json:"url,omitempty"`
63
+ }
64
+
65
+ // Time returns the date of the transaction.
66
+ func (c * StarTransaction ) Time () time.Time {
71
67
return time .Unix (c .Unixtime , 0 )
72
68
}
69
+
70
+ // Time returns the date of the withdrawal.
71
+ func (s * RevenueWithdrawal ) Time () time.Time {
72
+ return time .Unix (int64 (s .Unixtime ), 0 )
73
+ }
0 commit comments