@@ -62,6 +62,11 @@ func serializeLicenseDetailsKey(key interface{}) (serialized string, err error)
62
62
63
63
type LicenseDetailsData struct {
64
64
License License
65
+ //This is to capture the fixed price at the time of purchasing the license
66
+ //If there is no Dynamic Pricing involved , we will need to fall back on the fixed price
67
+ //that is available
68
+ // Keep this flexible to ensure we also support method level pricing in to the future
69
+ FixedPricing ServiceMethodCostDetails
65
70
}
66
71
type LicenseUsageTrackerKey struct {
67
72
ChannelID * big.Int
@@ -102,6 +107,7 @@ type Usage interface {
102
107
}
103
108
104
109
type License interface {
110
+ GetName () string
105
111
GetType () string
106
112
IsActive () bool
107
113
IsCallEligible () (bool , error )
@@ -206,14 +212,14 @@ type Tier struct {
206
212
AuthorizedAddresses []string
207
213
}
208
214
209
- type ServiceMethodDetails struct {
215
+ type ServiceMethodCostDetails struct {
210
216
PlanName string
211
217
ServiceName string
212
218
MethodName string
213
219
Price * big.Int
214
220
}
215
221
216
- func (s ServiceMethodDetails ) String () string {
222
+ func (s ServiceMethodCostDetails ) String () string {
217
223
return fmt .Sprintf ("{Valididty:%v,Details:%v,Discount:%v}" ,
218
224
s .PlanName , s .ServiceName , s .MethodName )
219
225
}
@@ -248,16 +254,20 @@ type PricingDetails struct {
248
254
PlanName string
249
255
ValidityInDays uint8
250
256
ActualAmountSigned * big.Int
251
- ServiceMethodDetails * ServiceMethodDetails //If this is null , implies it applies to all methods of the Service or just the one defined here
257
+ ServiceMethodDetails * ServiceMethodCostDetails //If this is null , implies it applies to all methods of the Service or just the one defined here
252
258
}
253
259
254
260
func (s PricingDetails ) String () string {
255
261
return fmt .Sprintf ("{CreditsInCogs:%v,FeeInCogs:%v,PlanName:%v" +
256
- ",ValidityInDays:%v,ActualAmountSigned:%v,ServiceMethodDetails :%v}" ,
262
+ ",ValidityInDays:%v,ActualAmountSigned:%v,ServiceMethodCostDetails :%v}" ,
257
263
s .CreditsInCogs , s .FeeInCogs , s .PlanName , s .ValidityInDays , s .ActualAmountSigned ,
258
264
s .ServiceMethodDetails )
259
265
}
260
266
267
+ func (s Subscription ) GetName () string {
268
+ return s .GetName ()
269
+ }
270
+
261
271
func (s Subscription ) ValidFrom () time.Time {
262
272
return s .Validity .StartTimeUTC
263
273
}
@@ -294,6 +304,9 @@ func (s Subscription) String() string {
294
304
s .Validity .String (), s .Details .String (), s .Discount .String ())
295
305
}
296
306
307
+ func (s Tier ) GetName () string {
308
+ return s .GetName ()
309
+ }
297
310
func (s Tier ) GetType () string {
298
311
return TIER
299
312
}
@@ -338,7 +351,7 @@ func serializeLicenseDetailsData(value interface{}) (slice string, err error) {
338
351
gob .Register (& PricingDetails {})
339
352
gob .Register (& TierPricingDetails {})
340
353
gob .Register (& DiscountPercentage {})
341
- gob .Register (& ServiceMethodDetails {})
354
+ gob .Register (& ServiceMethodCostDetails {})
342
355
343
356
err = e .Encode (value )
344
357
@@ -356,7 +369,7 @@ func deserializeLicenseDetailsData(slice string, value interface{}) (err error)
356
369
gob .Register (& PricingDetails {})
357
370
gob .Register (& TierPricingDetails {})
358
371
gob .Register (& DiscountPercentage {})
359
- gob .Register (& ServiceMethodDetails {})
372
+ gob .Register (& ServiceMethodCostDetails {})
360
373
361
374
d := gob .NewDecoder (b )
362
375
err = d .Decode (value )
0 commit comments