omnata-plugin-runtime 0.3.25a78__tar.gz → 0.3.26a79__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: omnata-plugin-runtime
3
- Version: 0.3.25a78
3
+ Version: 0.3.26a79
4
4
  Summary: Classes and common runtime components for building and running Omnata Plugins
5
5
  Author: James Weakley
6
6
  Author-email: james.weakley@omnata.com
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "omnata-plugin-runtime"
3
- version = "0.3.25-a78"
3
+ version = "0.3.26-a79"
4
4
  description = "Classes and common runtime components for building and running Omnata Plugins"
5
5
  authors = ["James Weakley <james.weakley@omnata.com>"]
6
6
  readme = "README.md"
@@ -1415,6 +1415,10 @@ class MonthlyBillingEventRequest(BaseModel):
1415
1415
  # below is deprecated
1416
1416
  has_active_inbound: bool = False
1417
1417
  has_active_outbound: bool = False
1418
+ # had to add these because the old version of the standard billing events assumed a daily billing event
1419
+ # TODO: deprecate all of these once the plugins are all on 0.3.26 or higher
1420
+ billable_connections_inbound: int = 0
1421
+ billable_connections_outbound: int = 0
1418
1422
 
1419
1423
 
1420
1424
  BillingEventRequest = Annotated[Union[DailyBillingEventRequest,MonthlyBillingEventRequest],Field(discriminator='billing_schedule')]
@@ -1622,27 +1626,29 @@ class OmnataPlugin(ABC):
1622
1626
  """
1623
1627
  sent_initial = False
1624
1628
  events: List[SnowflakeBillingEvent] = []
1625
- for i in range(request.billable_connections_inbound + request.billable_connections_outbound):
1626
- if sent_initial is False:
1627
- events.append(
1628
- SnowflakeBillingEvent(
1629
- billing_class="DAILY_ACTIVE_INITIAL",
1630
- billing_subclass="",
1631
- timestamp=datetime.datetime.now(tz=datetime.timezone.utc),
1632
- base_charge=initial_charge,
1633
- )
1634
- )
1635
- sent_initial = True
1636
- else:
1637
- if additional_charge is not None and additional_charge > 0:
1629
+ if request.billing_schedule == "DAILY":
1630
+ for i in range(request.billable_connections_inbound + request.billable_connections_outbound):
1631
+ if sent_initial is False:
1638
1632
  events.append(
1639
1633
  SnowflakeBillingEvent(
1640
- billing_class="DAILY_ACTIVE_ADDITIONAL",
1634
+ billing_class="DAILY_ACTIVE_INITIAL",
1641
1635
  billing_subclass="",
1642
1636
  timestamp=datetime.datetime.now(tz=datetime.timezone.utc),
1643
- base_charge=additional_charge,
1637
+ base_charge=initial_charge,
1644
1638
  )
1645
1639
  )
1640
+ sent_initial = True
1641
+ else:
1642
+ if additional_charge is not None and additional_charge > 0:
1643
+ events.append(
1644
+ SnowflakeBillingEvent(
1645
+ billing_class="DAILY_ACTIVE_ADDITIONAL",
1646
+ billing_subclass="",
1647
+ timestamp=datetime.datetime.now(tz=datetime.timezone.utc),
1648
+ base_charge=additional_charge,
1649
+ )
1650
+ )
1651
+ # handle monthly billing events inside the plugins for now
1646
1652
  return events
1647
1653
 
1648
1654
  def additional_loggers(self) -> List[str]: