Betting.WebApi

<back to all web services

IssueSelfServiceDevice

Requires Authentication
The following routes are available for this service:
POST/cmd/self-service-device-betting-sessions/issue
# frozen_string_literal: true
# encoding: utf-8


require 'json'
require 'servicestack'


module IdentificationDocumentType
    IDENTITY_CARD = 1
    PASSPORT = 2
end

class Money
    include ServiceStack::DTO

    # @return [BigDecimal]
    attr_accessor :amount
    # @return [String]
    attr_accessor :currency

    def self.properties
        {
            amount: { name: 'amount' },
            currency: { name: 'currency' },
        }
    end

end

class PatronIdentity
    include ServiceStack::DTO

    # @return [String]
    attr_accessor :full_name
    # @return [String]
    attr_accessor :identification_number
    # @return [IdentificationDocumentType]
    attr_accessor :identification_document_type

    def self.properties
        {
            full_name: { name: 'fullName' },
            identification_number: { name: 'identificationNumber' },
            identification_document_type: { name: 'identificationDocumentType' },
        }
    end

end

class BettingApp
    include ServiceStack::DTO

    # @return [String]
    attr_accessor :name
    # @return [String]
    attr_accessor :version

    def self.properties
        {
            name: { name: 'name' },
            version: { name: 'version' },
        }
    end

end

class Ref
    include ServiceStack::DTO

    # @return [String]
    attr_accessor :id
    # @return [String]
    attr_accessor :val

    def self.properties
        {
            id: { name: 'id' },
            val: { name: 'val' },
        }
    end

end

class RefEx < Ref
    # @return [RecordDictionary]
    attr_accessor :data

    def self.properties
        {
            data: { name: 'data', type: RecordDictionary },
        }
    end

end

class Origin
    include ServiceStack::DTO

    # @return [BettingApp]
    attr_accessor :application
    # @return [String]
    attr_accessor :ip
    # @return [RefEx]
    attr_accessor :organization
    # @return [Ref]
    attr_accessor :region
    # @return [Ref]
    attr_accessor :location_group
    # @return [RefEx]
    attr_accessor :location
    # @return [RefEx]
    attr_accessor :device
    # @return [Ref]
    attr_accessor :clerk

    def self.properties
        {
            application: { name: 'application', type: BettingApp },
            ip: { name: 'ip' },
            organization: { name: 'organization', type: RefEx },
            region: { name: 'region', type: Ref },
            location_group: { name: 'locationGroup', type: Ref },
            location: { name: 'location', type: RefEx },
            device: { name: 'device', type: RefEx },
            clerk: { name: 'clerk', type: Ref },
        }
    end

end

class IssueSelfServiceDevice
    include ServiceStack::DTO

    # @return [String]
    attr_accessor :session_id
    # @return [String]
    attr_accessor :device_id
    # @return [Money]
    attr_accessor :initial_credit
    # @return [PatronIdentity]
    attr_accessor :patron
    # @return [Origin]
    attr_accessor :origin

    def self.properties
        {
            session_id: { name: 'sessionId' },
            device_id: { name: 'deviceId' },
            initial_credit: { name: 'initialCredit', type: Money },
            patron: { name: 'patron', type: PatronIdentity },
            origin: { name: 'origin', type: Origin },
        }
    end

    def response_type() = ServiceStack::ResponseStatus
    def get_type_name() = 'IssueSelfServiceDevice'
end

class RecordDictionary < Hash
end

Ruby IssueSelfServiceDevice 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 /cmd/self-service-device-betting-sessions/issue HTTP/1.1 
Host: api.testenv.webhop.biz 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	sessionId: String,
	deviceId: String,
	initialCredit: 
	{
		amount: 0,
		currency: String
	},
	patron: 
	{
		fullName: String,
		identificationNumber: String,
		identificationDocumentType: 1
	},
	origin: 
	{
		application: 
		{
			name: String,
			version: String
		},
		ip: String,
		organization: 
		{
			data: 
			{
				String: String
			},
			id: String,
			val: String
		},
		region: 
		{
			id: String,
			val: String
		},
		locationGroup: 
		{
			id: String,
			val: String
		},
		location: 
		{
			data: 
			{
				String: String
			},
			id: String,
			val: String
		},
		device: 
		{
			data: 
			{
				String: String
			},
			id: String,
			val: String
		},
		clerk: 
		{
			id: String,
			val: String
		}
	}
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

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