Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
AddOns are wrapped inside License as they can be availed only when you have a license
  • Loading branch information
anandrgitnirman authored and anandrgitnirman committed Oct 13, 2021
1 parent 3cc4d78 commit b4ff279
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 77 deletions.
2 changes: 1 addition & 1 deletion blockchain/serviceMetadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ type Tier struct {
type Licenses struct {
Subscriptions Subscriptions `json:"subscriptions,omitempty"`
Tiers []Tier `json:"tiers"`
AddOns []AddOns `json:"addOns,omitempty"`
}

type OrganizationGroup struct {
Expand All @@ -207,7 +208,6 @@ type OrganizationGroup struct {
FreeCalls int `json:"free_calls"`
FreeCallSigner string `json:"free_call_signer_address"`
Licenses Licenses `json:"licenses,omitempty"`
AddOns []AddOns `json:"addOns,omitempty"`
}
type Pricing struct {
PriceModel string `json:"price_model"`
Expand Down
2 changes: 1 addition & 1 deletion blockchain/serviceMetadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,5 @@ func TestServiceMetadata_parseServiceProto(t *testing.T) {
func TestServiceMetadata_addOns(t *testing.T) {
metadata, err := ReadServiceMetaDataFromLocalFile("../service_metadata.json")
assert.Equal(t, err, nil)
assert.Equal(t, metadata.Groups[0].AddOns[0].DiscountInPercentage, 4.0)
assert.Equal(t, metadata.Groups[0].Licenses.AddOns[0].DiscountInPercentage, 4.0)
}
136 changes: 75 additions & 61 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,114 +5,128 @@ go 1.15
require (
github.com/BurntSushi/toml v0.3.1 // indirect
github.com/OneOfOne/go-utils v0.0.0-20180319162427-6019ff89a94e
github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412
github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412 // indirect
github.com/allegro/bigcache v1.2.1 // indirect
github.com/aristanetworks/goarista v0.0.0-20180607101720-59944ff78bc1
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973
github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32
github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803
github.com/aristanetworks/goarista v0.0.0-20180607101720-59944ff78bc1 // indirect
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 // indirect
github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32 // indirect
github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803 // indirect
github.com/census-instrumentation/opencensus-proto v0.2.1 // indirect
github.com/coreos/bbolt v1.3.1-etcd.8
github.com/cespare/cp v1.1.1 // indirect
github.com/coreos/bbolt v1.3.1-etcd.8 // indirect
github.com/coreos/etcd v3.3.10+incompatible
github.com/coreos/go-semver v0.3.0
github.com/coreos/go-systemd v0.0.0-20181031085051-9002847aa142
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd v0.0.0-20181031085051-9002847aa142 // indirect
github.com/coreos/pkg v0.0.0-20180108230652-97fdf19511ea
github.com/davecgh/go-spew v1.1.1
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/deckarep/golang-set v1.7.1 // indirect
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712
github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712 // indirect
github.com/emicklei/proto v1.9.1
github.com/envoyproxy/go-control-plane v0.7.1 // indirect
github.com/envoyproxy/protoc-gen-validate v0.1.0 // indirect
github.com/ethereum/go-ethereum v1.8.27
github.com/fsnotify/fsnotify v1.4.7
github.com/ghodss/yaml v1.0.0
github.com/go-stack/stack v1.7.0
github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239 // indirect
github.com/fjl/memsize v0.0.1 // indirect
github.com/fsnotify/fsnotify v1.4.7 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-stack/stack v1.7.0 // indirect
github.com/gogo/protobuf v1.2.1
github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.2.0
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db
github.com/google/btree v1.0.0
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db // indirect
github.com/google/btree v1.0.0 // indirect
github.com/google/go-cmp v0.5.0 // indirect
github.com/gorilla/handlers v1.3.0
github.com/gorilla/rpc v1.1.0
github.com/gorilla/websocket v1.2.0
github.com/gorilla/websocket v1.2.0 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
github.com/grpc-ecosystem/grpc-gateway v1.5.1
github.com/gxed/hashland v0.0.0-20180221191214-d9f6b97f8db2
github.com/hashicorp/golang-lru v0.5.0
github.com/hashicorp/hcl v0.0.0-20180404174102-ef8a98b0bbce
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.5.1 // indirect
github.com/gxed/hashland v0.0.0-20180221191214-d9f6b97f8db2 // indirect
github.com/hashicorp/golang-lru v0.5.0 // indirect
github.com/hashicorp/hcl v0.0.0-20180404174102-ef8a98b0bbce // indirect
github.com/huin/goupnp v1.0.2 // indirect
github.com/improbable-eng/grpc-web v0.0.0-20181031170435-f683dbb3b587
github.com/inconshreveable/mousetrap v1.0.0
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/ipfs/go-ipfs-api v0.0.2-0.20190404072909-740521c74b61
github.com/ipfs/go-ipfs-files v0.0.2
github.com/ipfs/go-ipfs-files v0.0.2 // indirect
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869 // indirect
github.com/jonboulle/clockwork v0.1.0
github.com/konsorten/go-windows-terminal-sequences v0.0.0-20180402223658-b729f2633dfe
github.com/karalabe/hid v1.0.0 // indirect
github.com/konsorten/go-windows-terminal-sequences v0.0.0-20180402223658-b729f2633dfe // indirect
github.com/lestrrat-go/envload v0.0.0-20180220234015-a3eb8ddeffcc // indirect
github.com/lestrrat-go/file-rotatelogs v2.2.0+incompatible
github.com/lestrrat-go/strftime v0.0.0-20180821113735-8b31f9c59b0f
github.com/lestrrat-go/strftime v0.0.0-20180821113735-8b31f9c59b0f // indirect
github.com/libp2p/go-flow-metrics v0.0.3 // indirect
github.com/libp2p/go-libp2p-crypto v0.1.0 // indirect
github.com/libp2p/go-libp2p-metrics v0.1.0 // indirect
github.com/libp2p/go-libp2p-peer v0.2.0 // indirect
github.com/libp2p/go-libp2p-protocol v0.1.0 // indirect
github.com/magiconair/properties v1.8.0
github.com/mattn/go-colorable v0.1.11 // indirect
github.com/mattn/goveralls v0.0.7 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1
github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771
github.com/mitchellh/go-homedir v1.1.0
github.com/mitchellh/mapstructure v0.0.0-20180511142126-bb74f1db0675
github.com/mr-tron/base58 v1.1.3
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect
github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v0.0.0-20180511142126-bb74f1db0675 // indirect
github.com/mr-tron/base58 v1.1.3 // indirect
github.com/multiformats/go-multiaddr v0.3.1 // indirect
github.com/multiformats/go-multiaddr-net v0.2.0 // indirect
github.com/multiformats/go-multihash v0.0.14 // indirect
github.com/pborman/uuid v0.0.0-20170612153648-e790cca94e6c
github.com/pelletier/go-toml v1.2.0
github.com/petar/GoLLRB v0.0.0-20130427215148-53be0d36a84c
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
github.com/pborman/uuid v0.0.0-20170612153648-e790cca94e6c // indirect
github.com/pelletier/go-toml v1.2.0 // indirect
github.com/petar/GoLLRB v0.0.0-20130427215148-53be0d36a84c // indirect
github.com/pkg/errors v0.8.0
github.com/pmezard/go-difflib v1.0.0
github.com/prometheus/client_golang v0.9.1
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4
github.com/prometheus/common v0.0.0-20181120120127-aeab699e26f4
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d
github.com/rjeczalik/notify v0.0.0-20180312213058-d152f3ce359a
github.com/rs/cors v1.4.0
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v0.9.1 // indirect
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 // indirect
github.com/prometheus/common v0.0.0-20181120120127-aeab699e26f4 // indirect
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d // indirect
github.com/rjeczalik/notify v0.0.0-20180312213058-d152f3ce359a // indirect
github.com/rs/cors v1.4.0 // indirect
github.com/rs/xid v1.2.1
github.com/sirupsen/logrus v1.1.0
github.com/soheilhy/cmux v0.1.4
github.com/spaolacci/murmur3 v1.1.0
github.com/spf13/afero v1.1.1
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/spf13/afero v1.1.1 // indirect
github.com/spf13/cast v1.2.0
github.com/spf13/cobra v0.0.3
github.com/spf13/jwalterweatherman v0.0.0-20180109140146-7c0cea34c8ec
github.com/spf13/jwalterweatherman v0.0.0-20180109140146-7c0cea34c8ec // indirect
github.com/spf13/pflag v1.0.1
github.com/spf13/viper v1.0.2
github.com/stretchr/testify v1.2.2
github.com/syndtr/goleveldb v0.0.0-20180609010929-e2150783cd35
github.com/tmc/grpc-websocket-proxy v0.0.0-20171017195756-830351dc03c6
github.com/tyler-smith/go-bip39 v0.0.0-20160629163856-8e7a99b3e716
github.com/ugorji/go v1.1.1
github.com/whyrusleeping/tar-utils v0.0.0-20180509141711-8c6c8ba81d5c
github.com/xiang90/probing v0.0.0-20160813154853-07dd2e8dfe18
github.com/syndtr/goleveldb v0.0.0-20180609010929-e2150783cd35 // indirect
github.com/tebeka/strftime v0.1.5 // indirect
github.com/tmc/grpc-websocket-proxy v0.0.0-20171017195756-830351dc03c6 // indirect
github.com/tyler-smith/go-bip39 v0.0.0-20160629163856-8e7a99b3e716 // indirect
github.com/ugorji/go v1.1.1 // indirect
github.com/whyrusleeping/tar-utils v0.0.0-20180509141711-8c6c8ba81d5c // indirect
github.com/xiang90/probing v0.0.0-20160813154853-07dd2e8dfe18 // indirect
github.com/zbindenren/logrus_mail v0.0.0-20170904205430-14351100bf70
go.etcd.io/bbolt v1.3.6 // indirect
go.etcd.io/etcd v3.3.10+incompatible
go.uber.org/atomic v1.3.2
go.uber.org/multierr v1.1.0
go.uber.org/zap v1.9.1
go.uber.org/atomic v1.3.2 // indirect
go.uber.org/multierr v1.1.0 // indirect
go.uber.org/zap v1.9.1 // indirect
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
golang.org/x/exp v0.0.0-20190121172915-509febef88a4 // indirect
golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5 // indirect
golang.org/x/net v0.0.0-20201209123823-ac852fbbde11
golang.org/x/sys v0.0.0-20201211090839-8ad439b19e0f
golang.org/x/text v0.3.4
golang.org/x/text v0.3.4 // indirect
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c
golang.org/x/tools v0.0.0-20201211185031-d93e913c1a58
golang.org/x/tools v0.0.0-20201211185031-d93e913c1a58 // indirect
google.golang.org/appengine v1.4.0 // indirect
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 // indirect
google.golang.org/grpc v1.16.0
gopkg.in/fatih/set.v0 v0.1.0
gopkg.in/karalabe/cookiejar.v2 v2.0.0-20150724131613-8dcd6a7f4951
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce
gopkg.in/yaml.v2 v2.2.1
gopkg.in/fatih/set.v0 v0.1.0 // indirect
gopkg.in/karalabe/cookiejar.v2 v2.0.0-20150724131613-8dcd6a7f4951 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
gopkg.in/urfave/cli.v1 v1.20.0 // indirect
gopkg.in/yaml.v2 v2.2.1 // indirect
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc // indirect
)
7 changes: 7 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,13 @@ github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDe
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8=
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-colorable v0.1.11 h1:nQ+aFkoE2TMGc0b68U2OKSexC+eq46+XwZzWXHRmPYs=
github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-isatty v0.0.13 h1:qdl+GuBjcsKKDco5BsxPJlId98mSWNKqYA+Co0SC1yA=
github.com/mattn/go-isatty v0.0.13/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/mattn/goveralls v0.0.7 h1:vzy0i4a2iDzEFMdXIxcanRadkr0FBvSBKUmj0P8SPlQ=
github.com/mattn/goveralls v0.0.7/go.mod h1:h8b4ow6FxSPMQHF6o2ve3qsclnffZjYTNEKmLesRwqw=
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
Expand Down Expand Up @@ -399,6 +403,9 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201211090839-8ad439b19e0f h1:QdHQnPce6K4XQewki9WNbG5KOROuDzqO3NaYjI1cXJ0=
golang.org/x/sys v0.0.0-20201211090839-8ad439b19e0f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6 h1:foEbQz/B0Oz6YIqu/69kfXPYeFQAuuMYFkjaqXzl5Wo=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down
37 changes: 23 additions & 14 deletions service_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,24 @@
"https://tz-services-1.snet.sh:8005"
],
"group_id": "EoFmN3nvaXpf6ew8jJbIPVghE5NXfYupFF7PkRmVyGQ=",
"addOns":[
{ "discountInPercentage": 4,
"addOnCostInAGIX":70,
"name": "Get Additional Calls worth 100 AGIX for 70 AGIX"
},
{ "discountInPercentage": 5,
"addOnCostInAGIX":80,
"name": "Get Additional Calls worth 120 AGIX for 80 AGIX"
}
],

"licenses": {
"addOns":[
{ "discountInPercentage": 4,
"addOnCostInAGIX":70,
"name": "Get Additional Calls worth 100 AGIX for 70 AGIX",
"id" : "XDDsdsdSomeRandomGeneratedUiqueString"
},
{ "discountInPercentage": 5,
"addOnCostInAGIX":80,
"name": "Get Additional Calls worth 120 AGIX for 80 AGIX",
"id" : "XDDsdsdSomeRandomGeneratedUiqueString"
}
],
"tiers": [
{
"type": "Tier",
"id" : "XDDsdsdSomeRandomGeneratedUiqueString",
"planName": "Tier AAA",
"grpcServiceName": "ServiceA",
"grpcMethodName": "MethodA",
Expand All @@ -105,6 +109,7 @@
},
{
"type": "Tier",
"id" : "XDDsdsdSomeRandomGeneratedUiqueString",
"planName": "Tier BBB Applicable for All service.methods",
"range": [
{
Expand Down Expand Up @@ -133,25 +138,29 @@
"planName": "Monthly For ServiceA/MethodA",
"LicenseCost": 90,
"grpcServiceName": "ServiceA",
"grpcMethodName": "MethodA"
"grpcMethodName": "MethodA",
"id" : "XDDsdsdSomeRandomGeneratedUiqueString"
},
{
"periodInDays": 30,
"discountInPercentage": 12,
"planName": "Monthly",
"LicenseCost": 93
"LicenseCost": 93,
"id" : "XDDsdsdSomeRandomGeneratedUiqueString"
},
{
"periodInDays": 120,
"discountInPercentage": 16,
"LicenseCost": 120,
"planName": "Quarterly"
"planName": "Quarterly",
"id" : "XDDsdsdSomeRandomGeneratedUiqueString"
},
{
"periodInDays": 365,
"discountInPercentage": 23,
"LicenseCost": 390,
"planName": "Yearly"
"planName": "Yearly",
"id" : "XDDsdsdSomeRandomGeneratedUiqueString"
}
],
"detailsUrl": "http://abc.org/licenses/Subscription.html",
Expand Down

0 comments on commit b4ff279

Please sign in to comment.