Skip to content

Commerce Context models

Adrian McPhee edited this page Oct 19, 2024 · 7 revisions
classDiagram
    class Organisation {
        +name: CharField
        +country: CharField
        +tax_id: CharField
    }
    class OrganisationWallet {
        +balance_usd_cents: IntegerField
    }
    class OrganisationWalletTransaction {
        +amount_cents: IntegerField
        +transaction_type: CharField
        +payment_method: CharField
        +transaction_id: CharField
    }
    class OrganisationPointAccount {
        +balance: PositiveIntegerField
    }
    class ProductPointAccount {
        +balance: PositiveIntegerField
    }
    class PointTransaction {
        +amount: PositiveIntegerField
        +transaction_type: CharField
    }
    class OrganisationPointGrant {
        +amount: PositiveIntegerField
        +rationale: TextField
    }
    class OrganisationPointGrantRequest {
        +amount_points: PositiveIntegerField
        +rationale: TextField
        +status: CharField
    }
    class ProductPointRequest {
        +amount_points: PositiveIntegerField
        +status: CharField
    }
    class Cart {
        +status: CharField
        +country: CharField
    }
    class CartLineItem {
        +item_type: CharField
        +quantity: PositiveIntegerField
        +unit_price_cents: IntegerField
        +unit_price_points: PositiveIntegerField
    }
    class SalesOrder {
        +status: CharField
        +total_usd_cents_excluding_fees_and_taxes: PositiveIntegerField
        +total_fees_usd_cents: PositiveIntegerField
        +total_taxes_usd_cents: PositiveIntegerField
        +total_usd_cents_including_fees_and_taxes: PositiveIntegerField
    }
    class SalesOrderLineItem {
        +item_type: CharField
        +quantity: PositiveIntegerField
        +unit_price_cents: IntegerField
    }
    class PointOrder {
        +total_points: PositiveIntegerField
        +status: CharField
    }
    class ContributorWallet {
        +balance_usd_in_cents: IntegerField
    }
    class ContributorPointAccount {
        +balance_points: IntegerField
    }
    class ContributorWalletTransaction {
        +amount_cents: IntegerField
        +transaction_type: CharField
        +payment_method: CharField
        +transaction_id: CharField
    }
    class ContributorPointTransaction {
        +amount_points: IntegerField
        +transaction_type: CharField
    }
    class PlatformFeeConfiguration {
        +percentage: PositiveIntegerField
        +applies_from_date: DateTimeField
    }
    class ContributorWithdrawalRequest {
        +amount_cents: PositiveIntegerField
        +status: CharField
        +payment_method: CharField
    }

    %% Relationships within commerce models
    Organisation "1" -- "1" OrganisationWallet
    Organisation "1" -- "1" OrganisationPointAccount
    Organisation "1" -- "*" OrganisationPointGrant
    Organisation "1" -- "*" OrganisationPointGrantRequest
    OrganisationWallet "1" -- "*" OrganisationWalletTransaction
    OrganisationPointAccount "1" -- "*" PointTransaction
    ProductPointAccount "1" -- "*" PointTransaction
    Cart "1" -- "*" CartLineItem
    Cart "1" -- "1" SalesOrder
    Cart "1" -- "1" PointOrder
    SalesOrder "1" -- "*" SalesOrderLineItem
    PointOrder "1" -- "0..1" PointOrder : parent_order
    ContributorWallet "1" -- "*" ContributorWalletTransaction
    ContributorPointAccount "1" -- "*" ContributorPointTransaction

    %% Relationships with models outside commerce
    Organisation "0..1" -- "*" Cart
    Cart "0..1" -- "1" Person
    CartLineItem "*" -- "0..1" Bounty
    CartLineItem "*" -- "0..1" BountyBid
    SalesOrderLineItem "*" -- "0..1" Bounty
    SalesOrderLineItem "*" -- "0..1" BountyBid
    ProductPointAccount "1" -- "1" Product
    ProductPointRequest "*" -- "1" Product
    ContributorWallet "1" -- "1" Person
    ContributorPointAccount "1" -- "1" Person
    ContributorWithdrawalRequest "*" -- "1" ContributorWallet
    OrganisationPointGrant "*" -- "1" Person : granted_by
    OrganisationPointGrantRequest "*" -- "1" Person : requested_by
    ProductPointRequest "*" -- "1" Person : requested_by

    %% External models (simplified)
    class Person {
        +full_name: CharField
    }
    class Bounty {
        +title: CharField
    }
    class BountyBid {
        +amount: DecimalField
    }
    class Product {
        +name: CharField
    }
Loading

Clone this wiki locally