-
Notifications
You must be signed in to change notification settings - Fork 0
/
type.go
121 lines (102 loc) · 4.81 KB
/
type.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
package wallet
import "time"
type ResponseStatus string
type ResponseStatusCode string
const (
ResponseStatusCodeSuccess ResponseStatusCode = "SUCCESS"
ResponseStatusCodeALREADY ResponseStatusCode = "ALREADY"
ResponseStatusCodeConflict ResponseStatusCode = "CONFLICT"
ResponseStatusCodeAccessDenied ResponseStatusCode = "ACCESS_DENIED"
ResponseStatusCodeInvalidRequest ResponseStatusCode = "ACCESS_DENIED"
ResponseStatusCodeInternalError ResponseStatusCode = "INTERNAL_ERROR"
)
type Amount struct {
Amount string `json:"amount"` // 1.000
CurrencyCode string `json:"currencyCode"` //"TON" "BTC" "USDT" "EUR" "USD" "RUB"
}
type SelectedPaymentOption struct {
Amount *Amount `json:"amount"`
AmountFee *Amount `json:"amountFee"`
AmountNet *Amount `json:"amountNet"`
ExchangeRate string `json:"exchangeRate"`
}
type Order struct {
Id string `json:"id"` //2703383946854401
Status string `json:"status"` // "ACTIVE" "EXPIRED" "PAID" "CANCELLED"
Number string `json:"number"` // 9aeb581c
Amount *Amount `json:"amount"`
AutoConversionCurrency string `json:"autoConversionCurrency"` // "USDT"
ExternalId string `json:"externalId"` //"ORD-5023-4E89"
CustomerTelegramUserId int `json:"customerTelegramUserId"` //"0"
CreatedDateTime time.Time `json:"createdDateTime"`
ExpirationDateTime time.Time `json:"expirationDateTime"`
CompletedDateTime time.Time `json:"completedDateTime"`
PaymentDateTime time.Time `json:"paymentDateTime"`
PayLink string `json:"payLink"`
DirectPayLink string `json:"directPayLink"`
SelectedPaymentOption *SelectedPaymentOption `json:"selectedPaymentOption"`
}
type Items struct {
Items []Order `json:"items"`
}
type CreateParams struct {
Amount Amount `json:"amount"`
AutoConversionCurrency string `json:"autoConversionCurrency,omitempty"` //USDT,TON,BTC
Description string `json:"description"` //"VPN for 1 month"
ReturnUrl string `json:"returnUrl"` //"https://t.me/wallet/start?startapp"
FailReturnUrl string `json:"failReturnUrl"` //"https://t.me/wallet"
CustomData string `json:"customData,omitempty"` //"client_ref=4E89"
ExternalId string `json:"externalId"` //"ORD-5023-4E89"
TimeoutSeconds int `json:"timeoutSeconds"` //"10800"
CustomerTelegramUserId int64 `json:"customerTelegramUserId"` //"0"
}
type CreateResponse struct {
Status string `json:"status"` //"SUCCESS" "ALREADY" "CONFLICT" "ACCESS_DENIED" "INVALID_REQUEST" "INTERNAL_ERROR"
Message string `json:"message"`
Data *Order `json:"data"`
}
//type PreviewParams struct {
// Id string `json:"id"`
//}
type PreviewResponse struct {
Status string `json:"status"` //"SUCCESS" "INVALID_REQUEST" "INTERNAL_ERROR"
Message string `json:"message"`
Data *Order `json:"data"`
}
//type OrderListParams struct {
// Offset int64 `json:"offset"`
// Count int32 `json:"count"`
//}
type OrderListResponse struct {
Status string `json:"status"` //"SUCCESS" "ALREADY" "CONFLICT" "ACCESS_DENIED" "INVALID_REQUEST" "INTERNAL_ERROR"
Message string `json:"message"`
Data *Items `json:"data"`
}
type TotalAmount struct {
TotalAmount int `json:"totalAmount"`
}
type OrderAmountResponse struct {
Status string `json:"status"` //"SUCCESS" "ALREADY" "CONFLICT" "ACCESS_DENIED" "INVALID_REQUEST" "INTERNAL_ERROR"
Message string `json:"message"`
Data TotalAmount `json:"data"`
}
type WebhookRequestHeader struct {
Timestamp string `json:"timestamp"`
Signature string `json:"signature"`
}
type WebhookRequestBody struct {
EventDateTime string `json:"eventDateTime"`
EventId int `json:"eventId"`
Type string `json:"type"`
Payload WebhookRequestBodyPayLoad `json:"payload"`
}
type WebhookRequestBodyPayLoad struct {
Id int64 `json:"id"`
Number string `json:"number"`
Status string `json:"status,omitempty"`
CustomData string `json:"customData,omitempty"`
ExternalId string `json:"externalId"`
OrderAmount Amount `json:"orderAmount"`
SelectedPaymentOption SelectedPaymentOption `json:"selectedPaymentOption,omitempty"`
OrderCompletedDateTime string `json:"orderCompletedDateTime,omitempty"`
}