Skip to content

Commit

Permalink
add invoices
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry-sinina committed Dec 29, 2023
1 parent 7267018 commit 3c80cae
Show file tree
Hide file tree
Showing 10 changed files with 175 additions and 0 deletions.
6 changes: 6 additions & 0 deletions yeti_switch_api/orm/billing/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
from .contact import Contact # noqa: F401
from .invoice.py import Invoice # noqa: F401
from .invoice_originated_destination import InvoiceOriginatedDestination # noqa: F401
from .invoice_originated_network import InvoiceOriginatedNetwork # noqa: F401
from .invoice_terminated_destination import InvoiceTerminatedDestination # noqa: F401
from .invoice_terminated_network import InvoiceTerminatedNetwork # noqa: F401

46 changes: 46 additions & 0 deletions yeti_switch_api/orm/billing/invoice.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
from ..base_model import BaseModel, AttributeField, RelationField


class Invoice(BaseModel):
class Meta:
path = "billing/invoices"
type = "invoices"

account = RelationField("account")
originated_destinations = RelationField("originated-destinations")
originated_networks = RelationField("originated-networks")
terminated_destinations = RelationField("terminated-destinations")
terminated_networks = RelationField("terminated-networks")

reference = AttributeField("reference")
state = AttributeField("state")
invoice_type = AttributeField("invoice-type")
start_date = AttributeField("start-date")
end_date = AttributeField("end-date")
amount_spent = AttributeField("amount-spent")
amount_earned = AttributeField("amount-earned")

originated_amount_spent = AttributeField("originated-amount-spent")
originated_amount_earned = AttributeField("originated-amount-earned")
originated_calls_count = AttributeField("originated-calls-count")
originated_successful_calls_count = AttributeField("originated-successful-calls-count")
originated_calls_duration = AttributeField("originated-calls-duration")
originated_billing_duration = AttributeField("originated-billing-duration")
originated_first_call_at = AttributeField("originated-first-call-at")
originated_last_call_at = AttributeField("originated-last-call-at")

terminated_amount_spent = AttributeField("terminated-amount-spent")
terminated_amount_earned = AttributeField("terminated-amount-earned")
terminated_calls_count = AttributeField("terminated-calls-count")
terminated_successful_calls_count = AttributeField("terminated-successful-calls-count")
terminated_calls_duration = AttributeField("terminated-calls-duration")
terminated_billing_duration = AttributeField("terminated-billing-duration")
terminated_first_call_at = AttributeField("terminated-first-call-at")
terminated_last_call_at = AttributeField("terminated-last-call-at")

def creatable_fields(self):
return [
"account",
"start_date",
"end_date"
]
23 changes: 23 additions & 0 deletions yeti_switch_api/orm/billing/invoice_originated_destination.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from ..base_model import BaseModel, AttributeField, RelationField


class InvoiceOriginatedDestination(BaseModel):
class Meta:
path = "billing/invoice-originated-destinations"
type = "invoice-originated-destinations"

invoice = RelationField("invoice")
country = RelationField("country")
network = RelationField("network")

amount = AttributeField("amount")
billing_duration = AttributeField("billing-duration")
calls_count = AttributeField("calls-count")
successful_calls_count = AttributeField("successful-calls-count")
calls_duration = AttributeField("calls-duration")
dst_prefix = AttributeField("dst-prefix")
first_call_at = AttributeField("first-call-at")
last_call_at = AttributeField("last-call-at")
rate = AttributeField("rate")
spent = AttributeField("spent")

22 changes: 22 additions & 0 deletions yeti_switch_api/orm/billing/invoice_originated_network.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from ..base_model import BaseModel, AttributeField, RelationField


class InvoiceOriginatedNetwork(BaseModel):
class Meta:
path = "billing/invoice-originated-networks"
type = "invoice-originated-networks"

invoice = RelationField("invoice")
country = RelationField("country")
network = RelationField("network")

amount = AttributeField("amount")
billing_duration = AttributeField("billing-duration")
calls_count = AttributeField("calls-count")
successful_calls_count = AttributeField("successful-calls-count")
calls_duration = AttributeField("calls-duration")
first_call_at = AttributeField("first-call-at")
last_call_at = AttributeField("last-call-at")
rate = AttributeField("rate")
spent = AttributeField("spent")

23 changes: 23 additions & 0 deletions yeti_switch_api/orm/billing/invoice_terminated_destination.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from ..base_model import BaseModel, AttributeField, RelationField


class InvoiceTerminatedDestination(BaseModel):
class Meta:
path = "billing/invoice-terminated-destinations"
type = "invoice-terminated-destinations"

invoice = RelationField("invoice")
country = RelationField("country")
network = RelationField("network")

amount = AttributeField("amount")
billing_duration = AttributeField("billing-duration")
calls_count = AttributeField("calls-count")
successful_calls_count = AttributeField("successful-calls-count")
calls_duration = AttributeField("calls-duration")
dst_prefix = AttributeField("dst-prefix")
first_call_at = AttributeField("first-call-at")
last_call_at = AttributeField("last-call-at")
rate = AttributeField("rate")
spent = AttributeField("spent")

22 changes: 22 additions & 0 deletions yeti_switch_api/orm/billing/invoice_terminated_network.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from ..base_model import BaseModel, AttributeField, RelationField


class InvoiceTerminatedNetwork(BaseModel):
class Meta:
path = "billing/invoice-terminated-networks"
type = "invoice-terminated-networks"

invoice = RelationField("invoice")
country = RelationField("country")
network = RelationField("network")

amount = AttributeField("amount")
billing_duration = AttributeField("billing-duration")
calls_count = AttributeField("calls-count")
successful_calls_count = AttributeField("successful-calls-count")
calls_duration = AttributeField("calls-duration")
first_call_at = AttributeField("first-call-at")
last_call_at = AttributeField("last-call-at")
rate = AttributeField("rate")
spent = AttributeField("spent")

3 changes: 3 additions & 0 deletions yeti_switch_api/orm/system/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
from .smtp_connection import SmtpConnection # noqa: F401
from .country import Country # noqa: F401
from .network import Network # noqa: F401
from .network_type import NetworkType # noqa: F401
11 changes: 11 additions & 0 deletions yeti_switch_api/orm/system/country.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from ..base_model import BaseModel, AttributeField, RelationField # noqa: F401


class Country(BaseModel):
class Meta:
path = "system/countries"
type = "countries"

name = AttributeField("name")
host = AttributeField("iso2")

10 changes: 10 additions & 0 deletions yeti_switch_api/orm/system/network.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from ..base_model import BaseModel, AttributeField, RelationField # noqa: F401


class Network(BaseModel):
class Meta:
path = "system/networks"
type = "networks"

name = AttributeField("name")
type = RelationField("network-type")
9 changes: 9 additions & 0 deletions yeti_switch_api/orm/system/network_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from ..base_model import BaseModel, AttributeField, RelationField # noqa: F401


class NetworkType(BaseModel):
class Meta:
path = "system/network-types"
type = "network-types"

name = AttributeField("name")

0 comments on commit 3c80cae

Please sign in to comment.