singnet / snet-daemon

Service Daemon exposes an AI application as an API that is accessible through the SingularityNET Network. It handles all interaction with the blockchain for authorization and payment using AGI tokens and passes through API calls to the AI application.
MIT License
46 stars 49 forks source link

Extract License Details from Service metadata ( Subscription + Tier Pricing) #524

Closed anandrgitnirman closed 3 years ago

anandrgitnirman commented 3 years ago
{
"licenses": {
    "tiers": [{
      "type": "Tier",
      "planName": "Tier AAA",
      "grpcServiceName": "ServiceA",
      "grpcMethodName": "MethodA",
      "range": [
        {
          "high": 100,
          "fixedPriceInCogs": 1
        },
        {
          "high": 200,
          "fixedPriceInCogs": 0.75
        },
        {
          "high": 300,
          "fixedPriceInCogs": 0.50
        }
      ],
      "detailsUrl": "http://abc.org/licenses/Tier.html",
      "isActive": "true/false"
    },
     {
      "type": "Tier",
      "planName": "Tier BBB Applicable for All service.methods",
      "range": [
        {
          "high": 100,
          "fixedPriceInCogs": 1
        },
        {
          "high": 200,
          "fixedPriceInCogs": 0.75
        },
        {
          "high": 300,
          "fixedPriceInCogs": 0.50
        }
      ],
      "detailsUrl": "http://abc.org/licenses/Tier.html",
      "isActive": "true/false"
    }],
    "subscriptions": {
      "type": "Subscription",
      "subscription": [
        {
          "periodInDays": 30,
          "creditsInAGI": 120,
          "planName": "Monthly For ServiceA/MethodA",
          "LicenseCost": 90,
          "grpcServiceName": "ServiceA",
          "grpcMethodName": "MethodA"
        },
        {
          "periodInDays": 30,
          "creditsInAGI": 123,
          "planName": "Monthly",
          "LicenseCost": 93
        },
        {
          "periodInDays": 120,
          "creditsInAGI": 160,
          "LicenseCost": 120,
          "planName": "Quarterly"
        },
        {
          "periodInDays": 365,
          "creditsInAGI": 430,
          "LicenseCost": 390,
          "planName": "Yearly"
        }
      ],
      "detailsUrl": "http://abc.org/licenses/Subscription.html",
      "isActive": "true/false"
    }
  }
}