Skip to content

Commit

Permalink
feat: re-generate avro schemas for renamed events
Browse files Browse the repository at this point in the history
  • Loading branch information
iloveagent57 committed Jun 18, 2024
1 parent f51905f commit 13fd321
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 19 deletions.
32 changes: 17 additions & 15 deletions openedx_events/enterprise/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,23 @@ class SubsidyRedemption:


@attr.s(frozen=True)
class LedgerTransactionReversal:
class BaseLedgerTransaction:
"""
Defines the common attributes of the transaction classes below.
"""
uuid = attr.ib(type=UUID)
created = attr.ib(type=datetime)
modified = attr.ib(type=datetime)
idempotency_key = attr.ib(type=str)
quantity = attr.ib(type=int)
state = attr.ib(type=str)


@attr.s(frozen=True)
class LedgerTransactionReversal(BaseLedgerTransaction):
"""
Attributes of an ``openedx_ledger.Reversal`` record.
A ``Reversal`` is a model that represents the "undo-ing" of a ``Transaction`` (see below). It's primarily
used within the domain of edX Enterprise for recording unenrollments and refunds of subsidized
enterprise enrollments.
Expand All @@ -45,18 +59,12 @@ class LedgerTransactionReversal:
state (str): Current lifecyle state of the record, one of (created, pending, committed, failed).
"""

uuid = attr.ib(type=UUID)
created = attr.ib(type=datetime)
modified = attr.ib(type=datetime)
idempotency_key = attr.ib(type=str)
quantity = attr.ib(type=int)
state = attr.ib(type=str)


@attr.s(frozen=True)
class LedgerTransaction:
class LedgerTransaction(BaseLedgerTransaction):
"""
Attributes of an ``openedx_ledger.Transaction`` record.
A ``Transaction`` is a model that represents value moving in or out of a ``Ledger``. It's primarily
used within the domain of edX Enterprise for recording the redemption of subsidized enrollments.
https://github.com/openedx/openedx-ledger/blob/master/openedx_ledger/models.py
Expand All @@ -78,12 +86,6 @@ class LedgerTransaction:
reversal (LedgerTransactionReversal): Any reversal associated with this transaction.
"""

uuid = attr.ib(type=UUID)
created = attr.ib(type=datetime)
modified = attr.ib(type=datetime)
idempotency_key = attr.ib(type=str)
quantity = attr.ib(type=int)
state = attr.ib(type=str)
ledger_uuid = attr.ib(type=UUID)
subsidy_access_policy_uuid = attr.ib(type=UUID)
lms_user_id = attr.ib(type=int)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,5 @@
}
}
],
"namespace": "org.openedx.enterprise_subsidies.ledger_transaction.created.v1"
"namespace": "org.openedx.enterprise.subsidy_ledger_transaction.committed.v1"
}
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,5 @@
}
}
],
"namespace": "org.openedx.enterprise_subsidies.ledger_transaction.failed.v1"
"namespace": "org.openedx.enterprise.subsidy_ledger_transaction.created.v1"
}
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,5 @@
}
}
],
"namespace": "org.openedx.enterprise_subsidies.ledger_transaction.reversed.v1"
"namespace": "org.openedx.enterprise.subsidy_ledger_transaction.failed.v1"
}
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,5 @@
}
}
],
"namespace": "org.openedx.enterprise_subsidies.ledger_transaction.committed.v1"
"namespace": "org.openedx.enterprise.subsidy_ledger_transaction.reversed.v1"
}

0 comments on commit 13fd321

Please sign in to comment.