BokaMera.API.Host

<back to all web services

CreateRebateCodeTransaction

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin
The following routes are available for this service:
POST/rebatecodes/transactionsCreate transaction for the rebate codeCreate transaction for the rebate code
import 'package:servicestack/servicestack.dart';

class RebateCodeServiceResponse implements IConvertible
{
    int? Id;
    String? Name;
    String? Description;
    bool? Active;

    RebateCodeServiceResponse({this.Id,this.Name,this.Description,this.Active});
    RebateCodeServiceResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Id = json['Id'];
        Name = json['Name'];
        Description = json['Description'];
        Active = json['Active'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Id': Id,
        'Name': Name,
        'Description': Description,
        'Active': Active
    };

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

class RebateCodeCustomerResponse implements IConvertible
{
    String? Id;
    String? Firstname;
    String? Lastname;
    String? Email;
    String? Phone;
    String? ImageUrl;

    RebateCodeCustomerResponse({this.Id,this.Firstname,this.Lastname,this.Email,this.Phone,this.ImageUrl});
    RebateCodeCustomerResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Id = json['Id'];
        Firstname = json['Firstname'];
        Lastname = json['Lastname'];
        Email = json['Email'];
        Phone = json['Phone'];
        ImageUrl = json['ImageUrl'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Id': Id,
        'Firstname': Firstname,
        'Lastname': Lastname,
        'Email': Email,
        'Phone': Phone,
        'ImageUrl': ImageUrl
    };

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

class RebateCodeTransactionQueryResponse implements IConvertible
{
    int? Id;
    String? CompanyId;
    String? Note;
    int? RebateCodeId;
    String? RebateCodeSign;
    int? RebateCodeTypeId;
    String? RebateCodeTypeName;
    double? Amount;
    int? BookingId;
    DateTime? UpdatedDate;
    DateTime? CreatedDate;
    RebateCodeServiceResponse? Service;
    RebateCodeCustomerResponse? Customer;
    String? PriceSign;

    RebateCodeTransactionQueryResponse({this.Id,this.CompanyId,this.Note,this.RebateCodeId,this.RebateCodeSign,this.RebateCodeTypeId,this.RebateCodeTypeName,this.Amount,this.BookingId,this.UpdatedDate,this.CreatedDate,this.Service,this.Customer,this.PriceSign});
    RebateCodeTransactionQueryResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Id = json['Id'];
        CompanyId = json['CompanyId'];
        Note = json['Note'];
        RebateCodeId = json['RebateCodeId'];
        RebateCodeSign = json['RebateCodeSign'];
        RebateCodeTypeId = json['RebateCodeTypeId'];
        RebateCodeTypeName = json['RebateCodeTypeName'];
        Amount = JsonConverters.toDouble(json['Amount']);
        BookingId = json['BookingId'];
        UpdatedDate = JsonConverters.fromJson(json['UpdatedDate'],'DateTime',context!);
        CreatedDate = JsonConverters.fromJson(json['CreatedDate'],'DateTime',context!);
        Service = JsonConverters.fromJson(json['Service'],'RebateCodeServiceResponse',context!);
        Customer = JsonConverters.fromJson(json['Customer'],'RebateCodeCustomerResponse',context!);
        PriceSign = json['PriceSign'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Id': Id,
        'CompanyId': CompanyId,
        'Note': Note,
        'RebateCodeId': RebateCodeId,
        'RebateCodeSign': RebateCodeSign,
        'RebateCodeTypeId': RebateCodeTypeId,
        'RebateCodeTypeName': RebateCodeTypeName,
        'Amount': Amount,
        'BookingId': BookingId,
        'UpdatedDate': JsonConverters.toJson(UpdatedDate,'DateTime',context!),
        'CreatedDate': JsonConverters.toJson(CreatedDate,'DateTime',context!),
        'Service': JsonConverters.toJson(Service,'RebateCodeServiceResponse',context!),
        'Customer': JsonConverters.toJson(Customer,'RebateCodeCustomerResponse',context!),
        'PriceSign': PriceSign
    };

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

class RebateCodeTransactionResponse implements IConvertible
{
    ResponseStatus? ResponseStatus;
    RebateCodeTransactionQueryResponse? RebateCodeTransactionItem;

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

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

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

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

enum AmountChangeType
{
    Increase,
    Decrease,
}

// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
// @ValidateRequest(Validator="IsAuthenticated")
class CreateRebateCodeTransaction implements IConvertible
{
    /**
    * 
    */
    // @ApiMember(Description="", IsRequired=true)
    String? CompanyId;

    /**
    * Rebate code id to which you wish to add transaction
    */
    // @ApiMember(Description="Rebate code id to which you wish to add transaction", IsRequired=true)
    int? RebateCodeId;

    // @ApiMember(IsRequired=true)
    double? Amount;

    // @ApiMember(IsRequired=true)
    int? Usage;

    // @ApiMember()
    int? BookingId;

    /**
    * If you want to Increase = 0 or Decrease = 1 the value
    */
    // @ApiMember(Description="If you want to Increase = 0 or Decrease = 1 the value", IsRequired=true)
    AmountChangeType? ChangeType;

    CreateRebateCodeTransaction({this.CompanyId,this.RebateCodeId,this.Amount,this.Usage,this.BookingId,this.ChangeType});
    CreateRebateCodeTransaction.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        CompanyId = json['CompanyId'];
        RebateCodeId = json['RebateCodeId'];
        Amount = JsonConverters.toDouble(json['Amount']);
        Usage = json['Usage'];
        BookingId = json['BookingId'];
        ChangeType = JsonConverters.fromJson(json['ChangeType'],'AmountChangeType',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'CompanyId': CompanyId,
        'RebateCodeId': RebateCodeId,
        'Amount': Amount,
        'Usage': Usage,
        'BookingId': BookingId,
        'ChangeType': JsonConverters.toJson(ChangeType,'AmountChangeType',context!)
    };

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

TypeContext _ctx = TypeContext(library: 'api.bokamera.se', types: <String, TypeInfo> {
    'RebateCodeServiceResponse': TypeInfo(TypeOf.Class, create:() => RebateCodeServiceResponse()),
    'RebateCodeCustomerResponse': TypeInfo(TypeOf.Class, create:() => RebateCodeCustomerResponse()),
    'RebateCodeTransactionQueryResponse': TypeInfo(TypeOf.Class, create:() => RebateCodeTransactionQueryResponse()),
    'RebateCodeTransactionResponse': TypeInfo(TypeOf.Class, create:() => RebateCodeTransactionResponse()),
    'AmountChangeType': TypeInfo(TypeOf.Enum, enumValues:AmountChangeType.values),
    'CreateRebateCodeTransaction': TypeInfo(TypeOf.Class, create:() => CreateRebateCodeTransaction()),
});

Dart CreateRebateCodeTransaction 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 /rebatecodes/transactions HTTP/1.1 
Host: api.bokamera.se 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"CompanyId":"00000000-0000-0000-0000-000000000000","RebateCodeId":0,"Amount":0,"Usage":0,"BookingId":0,"ChangeType":"Increase"}
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"}},"RebateCodeTransactionItem":{"Id":0,"Note":"String","RebateCodeId":0,"RebateCodeSign":"String","RebateCodeTypeId":0,"RebateCodeTypeName":"String","Amount":0,"BookingId":0,"Service":{"Id":0,"Name":"String","Description":"String","Active":false},"Customer":{"Firstname":"String","Lastname":"String","Email":"String","Phone":"String","ImageUrl":"String"},"PriceSign":"String"}}