Trendsic Platform Service

<back to all web services

LedgerRequest

Requires Authentication
Requires any of the roles:Agent, Administrator, Agent, Administrator, Agent, Administrator, Agent, Administrator
The following routes are available for this service:
GET,OPTIONS/v1/Ledger/{LedgerId}
GET,POST,OPTIONS/v1/Ledger
import 'package:servicestack/servicestack.dart';
import 'dart:typed_data';

class Ledger implements IConvertible
{
    int? LedgerId;
    int? AgentId;
    int? CommissionBatchId;
    String? Rank;
    double? Commissions;
    double? Clawbacks;
    double? Adjustments;
    double? PreviousBalance;
    double? ASAPCharges;
    double? Payout;
    double? BalanceForward;

    Ledger({this.LedgerId,this.AgentId,this.CommissionBatchId,this.Rank,this.Commissions,this.Clawbacks,this.Adjustments,this.PreviousBalance,this.ASAPCharges,this.Payout,this.BalanceForward});
    Ledger.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        LedgerId = json['LedgerId'];
        AgentId = json['AgentId'];
        CommissionBatchId = json['CommissionBatchId'];
        Rank = json['Rank'];
        Commissions = JsonConverters.toDouble(json['Commissions']);
        Clawbacks = JsonConverters.toDouble(json['Clawbacks']);
        Adjustments = JsonConverters.toDouble(json['Adjustments']);
        PreviousBalance = JsonConverters.toDouble(json['PreviousBalance']);
        ASAPCharges = JsonConverters.toDouble(json['ASAPCharges']);
        Payout = JsonConverters.toDouble(json['Payout']);
        BalanceForward = JsonConverters.toDouble(json['BalanceForward']);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'LedgerId': LedgerId,
        'AgentId': AgentId,
        'CommissionBatchId': CommissionBatchId,
        'Rank': Rank,
        'Commissions': Commissions,
        'Clawbacks': Clawbacks,
        'Adjustments': Adjustments,
        'PreviousBalance': PreviousBalance,
        'ASAPCharges': ASAPCharges,
        'Payout': Payout,
        'BalanceForward': BalanceForward
    };

    getTypeName() => "Ledger";
    TypeContext? context = _ctx;
}

class LedgerExtended extends Ledger implements IConvertible
{
    String? AgentFirstName;
    String? AgentLastName;
    String? AgentName;
    double? AgentLevel;
    String? PayChexId;

    LedgerExtended({this.AgentFirstName,this.AgentLastName,this.AgentName,this.AgentLevel,this.PayChexId});
    LedgerExtended.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        AgentFirstName = json['AgentFirstName'];
        AgentLastName = json['AgentLastName'];
        AgentName = json['AgentName'];
        AgentLevel = JsonConverters.toDouble(json['AgentLevel']);
        PayChexId = json['PayChexId'];
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'AgentFirstName': AgentFirstName,
        'AgentLastName': AgentLastName,
        'AgentName': AgentName,
        'AgentLevel': AgentLevel,
        'PayChexId': PayChexId
    });

    getTypeName() => "LedgerExtended";
    TypeContext? context = _ctx;
}

class LedgerResponse implements IConvertible
{
    ResponseStatus? ResponseStatus;
    List<LedgerExtended>? Ledger = [];

    LedgerResponse({this.ResponseStatus,this.Ledger});
    LedgerResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        ResponseStatus = JsonConverters.fromJson(json['ResponseStatus'],'ResponseStatus',context!);
        Ledger = JsonConverters.fromJson(json['Ledger'],'List<LedgerExtended>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'ResponseStatus': JsonConverters.toJson(ResponseStatus,'ResponseStatus',context!),
        'Ledger': JsonConverters.toJson(Ledger,'List<LedgerExtended>',context!)
    };

    getTypeName() => "LedgerResponse";
    TypeContext? context = _ctx;
}

class LedgerRequest implements IConvertible
{
    List<LedgerExtended>? Ledger = [];

    LedgerRequest({this.Ledger});
    LedgerRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Ledger = JsonConverters.fromJson(json['Ledger'],'List<LedgerExtended>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Ledger': JsonConverters.toJson(Ledger,'List<LedgerExtended>',context!)
    };

    getTypeName() => "LedgerRequest";
    TypeContext? context = _ctx;
}

TypeContext _ctx = TypeContext(library: 'api.dev.dynamics.trendsic.com', types: <String, TypeInfo> {
    'Ledger': TypeInfo(TypeOf.Class, create:() => Ledger()),
    'LedgerExtended': TypeInfo(TypeOf.Class, create:() => LedgerExtended()),
    'LedgerResponse': TypeInfo(TypeOf.Class, create:() => LedgerResponse()),
    'List<LedgerExtended>': TypeInfo(TypeOf.Class, create:() => <LedgerExtended>[]),
    'LedgerRequest': TypeInfo(TypeOf.Class, create:() => LedgerRequest()),
});

Dart LedgerRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + 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
		}
	]
}