| Requires any of the roles: | Agent, Administrator, Agent, Administrator, Agent, Administrator, Agent, Administrator |
| GET,OPTIONS | /v1/Ledger/{LedgerId} | ||
|---|---|---|---|
| GET,POST,OPTIONS | /v1/Ledger |
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Ledger:
ledger_id: int = 0
agent_id: int = 0
commission_batch_id: int = 0
rank: Optional[str] = None
commissions: Decimal = decimal.Decimal(0)
clawbacks: Decimal = decimal.Decimal(0)
adjustments: Decimal = decimal.Decimal(0)
previous_balance: Decimal = decimal.Decimal(0)
asap_charges: Decimal = decimal.Decimal(0)
payout: Decimal = decimal.Decimal(0)
balance_forward: Decimal = decimal.Decimal(0)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class LedgerExtended(Ledger):
agent_first_name: Optional[str] = None
agent_last_name: Optional[str] = None
agent_name: Optional[str] = None
agent_level: Decimal = decimal.Decimal(0)
pay_chex_id: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class LedgerResponse:
response_status: Optional[ResponseStatus] = None
ledger: List[LedgerExtended] = field(default_factory=list)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class LedgerRequest:
ledger: List[LedgerExtended] = field(default_factory=list)
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /v1/Ledger HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
Ledger:
[
{
AgentFirstName: String,
AgentLastName: String,
AgentName: String,
AgentLevel: 0,
PayChexId: String,
LedgerId: 0,
AgentId: 0,
CommissionBatchId: 0,
Rank: String,
Commissions: 0,
Clawbacks: 0,
Adjustments: 0,
PreviousBalance: 0,
ASAPCharges: 0,
Payout: 0,
BalanceForward: 0
}
]
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
ResponseStatus:
{
ErrorCode: String,
Message: String,
StackTrace: String,
Errors:
[
{
ErrorCode: String,
FieldName: String,
Message: String,
Meta:
{
String: String
}
}
],
Meta:
{
String: String
}
},
Ledger:
[
{
AgentFirstName: String,
AgentLastName: String,
AgentName: String,
AgentLevel: 0,
PayChexId: String,
LedgerId: 0,
AgentId: 0,
CommissionBatchId: 0,
Rank: String,
Commissions: 0,
Clawbacks: 0,
Adjustments: 0,
PreviousBalance: 0,
ASAPCharges: 0,
Payout: 0,
BalanceForward: 0
}
]
}