Billiecart API

<back to all web services

DistributeContributionRequest

Requires Authentication
Requires the role:manager
The following routes are available for this service:
POST/contributions/{Id}/distribute
import Foundation
import ServiceStack

public class DistributeContributionRequest : PostOperationTenanted<DistributeContributionResponse>
{
    public var id:String?
    public var salaryPackages:[ContributionSalaryPackage] = []

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case id
        case salaryPackages
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        id = try container.decodeIfPresent(String.self, forKey: .id)
        salaryPackages = try container.decodeIfPresent([ContributionSalaryPackage].self, forKey: .salaryPackages) ?? []
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if id != nil { try container.encode(id, forKey: .id) }
        if salaryPackages.count > 0 { try container.encode(salaryPackages, forKey: .salaryPackages) }
    }
}

public class PostOperationTenanted<TResponse : Codable> : PostOperationUnTenanted<TResponse>, ITenantedRequest
{
    public var organisationId:String?

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case organisationId
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        organisationId = try container.decodeIfPresent(String.self, forKey: .organisationId)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if organisationId != nil { try container.encode(organisationId, forKey: .organisationId) }
    }
}

public class PostOperationUnTenanted<TResponse : Codable> : IPost, Codable
{
    required public init(){}
}

public class DistributeContributionResponse : Codable
{
    public var responseStatus:ResponseStatus?

    required public init(){}
}

public class ContributionSalaryPackage : IIdentifiableResource, Codable
{
    public var preTaxDeduction:Double?
    public var postTaxDeduction:Double?
    public var salarySacrificeBreakdown:SalarySacrificeBreakdown?
    public var id:String?

    required public init(){}
}

public class SalarySacrificeBreakdown : Codable
{
    public var leaseAmount:Double?
    public var administrationFee:Double?
    public var fuel:Double?
    public var servicing:Double?
    public var tyres:Double?
    public var insurance:Double?
    public var carWash:Double?
    public var registration:Double?
    public var roadSideAssistance:Double?
    public var anythingExtra:Double?

    required public init(){}
}


Swift DistributeContributionRequest DTOs

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

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /contributions/{Id}/distribute HTTP/1.1 
Host: staging-api.billiecart.com.au 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"id":"String","salaryPackages":[{"preTaxDeduction":0,"postTaxDeduction":0,"salarySacrificeBreakdown":{"leaseAmount":0,"administrationFee":0,"fuel":0,"servicing":0,"tyres":0,"insurance":0,"carWash":0,"registration":0,"roadSideAssistance":0,"anythingExtra":0},"id":"String"}],"organisationId":"String"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}}