@@ -44,13 +44,21 @@ func (s *transactionServer) GetLimits(ctx context.Context, req *transactionpb.Ge
44
44
MaxPerTransaction : 0 ,
45
45
MaxPerDay : 0 ,
46
46
}
47
+ zeroBuyModuleLimits [string (currency )] = & transactionpb.BuyModuleLimit {
48
+ MaxPerTransaction : 0 ,
49
+ MinPerTransaction : 0 ,
50
+ }
51
+ }
52
+ for currency := range limit .MicroPaymentLimits {
47
53
zeroMicroPaymentLimits [string (currency )] = & transactionpb.MicroPaymentLimit {
48
54
MaxPerTransaction : 0 ,
49
55
MinPerTransaction : 0 ,
50
56
}
51
57
}
52
58
zeroSendLimits [string (currency_lib .KIN )] = & transactionpb.SendLimit {
53
- NextTransaction : 0 ,
59
+ NextTransaction : 0 ,
60
+ MaxPerTransaction : 0 ,
61
+ MaxPerDay : 0 ,
54
62
}
55
63
zeroMicroPaymentLimits [string (currency_lib .KIN )] = & transactionpb.MicroPaymentLimit {
56
64
MaxPerTransaction : 0 ,
@@ -154,7 +162,31 @@ func (s *transactionServer) GetLimits(ctx context.Context, req *transactionpb.Ge
154
162
}
155
163
156
164
//
157
- // Part 2: Calculate deposit limits
165
+ // Part 2: Calculate micro payment limits
166
+ //
167
+
168
+ microPaymentLimits := make (map [string ]* transactionpb.MicroPaymentLimit )
169
+ for currency , limits := range limit .MicroPaymentLimits {
170
+ microPaymentLimits [string (currency )] = & transactionpb.MicroPaymentLimit {
171
+ MaxPerTransaction : float32 (limits .Max ),
172
+ MinPerTransaction : float32 (limits .Min ),
173
+ }
174
+ }
175
+
176
+ //
177
+ // Part 3: Calculate buy module limits
178
+ //
179
+
180
+ buyModuleLimits := make (map [string ]* transactionpb.BuyModuleLimit )
181
+ for currency , limits := range limit .SendLimits {
182
+ buyModuleLimits [string (currency )] = & transactionpb.BuyModuleLimit {
183
+ MaxPerTransaction : float32 (limits .PerTransaction ),
184
+ MinPerTransaction : float32 (limits .PerTransaction / 10 ),
185
+ }
186
+ }
187
+
188
+ //
189
+ // Part 4: Calculate deposit limits
158
190
//
159
191
160
192
usdForNextDeposit := limit .MaxPerDepositUsdAmount
@@ -179,35 +211,11 @@ func (s *transactionServer) GetLimits(ctx context.Context, req *transactionpb.Ge
179
211
usdForNextDeposit = 0
180
212
}
181
213
182
- //
183
- // Part 3: Calculate micro payment limits
184
- //
185
-
186
- convertedMicroPaymentLimits := make (map [string ]* transactionpb.MicroPaymentLimit )
187
- for currency , limits := range limit .MicroPaymentLimits {
188
- convertedMicroPaymentLimits [string (currency )] = & transactionpb.MicroPaymentLimit {
189
- MaxPerTransaction : float32 (limits .Max ),
190
- MinPerTransaction : float32 (limits .Min ),
191
- }
192
- }
193
-
194
- //
195
- // Part 4: Calculate buy module limits
196
- //
197
-
198
- convertedBuyModuleLimits := make (map [string ]* transactionpb.BuyModuleLimit )
199
- for currency , limits := range limit .SendLimits {
200
- convertedBuyModuleLimits [string (currency )] = & transactionpb.BuyModuleLimit {
201
- MaxPerTransaction : float32 (limits .PerTransaction ),
202
- MinPerTransaction : float32 (limits .PerTransaction / 10 ),
203
- }
204
- }
205
-
206
214
return & transactionpb.GetLimitsResponse {
207
215
Result : transactionpb .GetLimitsResponse_OK ,
208
216
SendLimitsByCurrency : sendLimits ,
209
- MicroPaymentLimitsByCurrency : convertedMicroPaymentLimits ,
210
- BuyModuleLimitsByCurrency : convertedBuyModuleLimits ,
217
+ MicroPaymentLimitsByCurrency : microPaymentLimits ,
218
+ BuyModuleLimitsByCurrency : buyModuleLimits ,
211
219
DepositLimit : & transactionpb.DepositLimit {
212
220
MaxQuarks : kin .ToQuarks (uint64 (usdForNextDeposit / usdRate )),
213
221
},
0 commit comments