Agent-Recipient

[!info] Overview The Agent-Recipient REST API manages the relationship between agents and service providers (recipients). This entity defines which recipients are available to which agents and controls commission structures, fees, and integration parameters.

📋 Table of Contents

  • [[#Quick Reference|Quick Reference]]

  • [[#Data Models|Data Models]]

  • [[#API Endpoints|API Endpoints]]

    • [[#Create Agent-Recipient|Create Agent-Recipient]]

    • [[#Update Agent-Recipient|Update Agent-Recipient]]

    • [[#Partial Update|Partial Update]]

    • [[#Get All Agent-Recipients|Get All Agent-Recipients]]

    • [[#Get with Criteria|Get with Criteria]]

    • [[#Get V2 (Projection)|Get V2 (Projection)]]

    • [[#Export to Excel|Export to Excel]]

    • [[#Get Single Agent-Recipient|Get Single Agent-Recipient]]

    • [[#Count Agent-Recipients|Count Agent-Recipients]]

    • [[#Delete Agent-Recipient|Delete Agent-Recipient]]

  • [[#Examples|Request & Response Examples]]

  • [[#Error Handling|Error Handling]]

  • [[#Validation Rules|Validation Rules]]

  • [[#Commission System|Commission System]]


Quick Reference

[!abstract] API Configuration

  • Base URL: /api

  • Entity Name: pkbillmsAgentRecipient

  • Controller: AgentRecipientResource

  • Framework: Spring Boot + JHipster

  • Auth: Required (Spring Security)

  • Content-Type: application/json

Endpoints Summary

Method
Endpoint
Description
Status

POST

/api/agent-recipients

Create new relationship

201

PUT

/api/agent-recipients/{id}

Full update

200

PATCH

/api/agent-recipients/{id}

Partial update

200

GET

/api/agent-recipients

Get all with criteria

200

GET

/api/agent-recipients/v2

Get with projection

200

GET

/api/agent-recipients/excel

Get for Excel export

200

GET

/api/agent-recipients/criteria

Get by agent/recipient name

200

GET

/api/agent-recipients/{id}

Get by ID

200

GET

/api/agent-recipients/count

Count by criteria

200

DELETE

/api/agent-recipients/{id}

Delete relationship

204


Data Models

Agent-Recipient DTO Structure

[!note] Data Transfer Object Defines agent-to-recipient relationship with commission configuration and integration parameters.

Field Specifications

Field
Type
Required
Range/Max
DB Column
Description

id

Long

❌ Auto

-

id

Primary key

agentCommission

Double

0-100

agent_commission

Agent commission % from customer payment

agentFee

Double

0-100

agent_fee

Agent reward % from system

systemCommissionUp

Double

max 100

system_commission_up

System commission added on top

systemCommissionDown

Double

0-100

system_commission_down

System commission from customer payment

systemFee

Double

0-100

system_fee

System reward % from provider

active

Boolean

-

active

Active/Inactive status

eposPort

Integer

0-65535

epos_port

SvGate EPOS port

eposMerchant

String

32

epos_merchant

SvGate Merchant ID

eposTerminal

String

32

epos_terminal

SvGate Terminal ID

requestGroup

String

64

request_group

Request grouping identifier

jsonParams

String

LOB

json_params

Additional JSON parameters

agent

AgentDTO

-

agent_id

Associated agent

recipient

RecipientDTO

-

recipient_id

Associated recipient

setting

SettingDTO

-

setting_id

Configuration settings

settingType

SettingTypeDTO

-

-

Setting type reference

recipientGroup

RecipientGroupDTO

-

recipient_group_id

Recipient group

Audit Fields (Inherited)

[!success] Auto-managed These fields are automatically populated by the system.

Field
Type
Description

createdBy

String

Creator username

createdDate

Instant

Creation timestamp

lastModifiedBy

String

Last modifier

lastModifiedDate

Instant

Last modification

[!info] Relationships

  • Agent: @ManyToOne - Each relationship belongs to one agent

  • Recipient: @ManyToOne - Each relationship provides access to one recipient

  • Setting: @ManyToOne (Optional) - Configuration settings

  • RecipientGroup: @ManyToOne (Optional) - Group categorization


API Endpoints

Create Agent-Recipient

[!example] POST /api/agent-recipients Creates a new agent-recipient relationship with commission configuration.

Request

Headers:

Body:

[!warning] Validation Rules

  • id must be null (auto-generated)

  • active is required

  • Commission values must be between 0-100 (except systemCommissionUp which can be negative for discounts)

  • eposPort must be 0-65535

  • String fields must respect max length

  • Agent and Recipient should exist if specified

Response

✅ Success (201 Created):

❌ Error (400 - ID exists):

❌ Error (400 - Validation):


Update Agent-Recipient

[!example] PUT /api/agent-recipients/{id} Completely updates an existing agent-recipient relationship.

Path Parameters

  • id (Long) - Agent-Recipient relationship identifier

Request

Headers:

Body:

[!warning] Validation

  • Body id must not be null

  • Path id must match body id

  • Agent-Recipient must exist in database

  • All commission ranges must be valid

Response

✅ Success (200 OK):

❌ Errors:

Status
Detail
Message

400

Invalid id

error.idnull

400

Invalid ID

error.idinvalid

400

Entity not found

error.idnotfound


Partial Update

[!example] PATCH /api/agent-recipients/{id} Updates only specified fields. Null fields are ignored.

Path Parameters

  • id (Long) - Agent-Recipient identifier

Request

Headers:

Body (Example - toggle active and update commissions):

[!tip] Partial Update Behavior

  • Only non-null fields are updated

  • Other fields remain unchanged

  • Perfect for status toggles or commission adjustments

  • Relationships can be partially updated

Response

✅ Success (200 OK):


Get All Agent-Recipients

[!example] GET /api/agent-recipients Retrieves paginated list with filtering criteria.

Query Parameters

Pagination:

  • page - Page number (0-indexed, default: 0)

  • size - Items per page (default: 20)

  • sort - Sort criteria (e.g., id,asc)

  • unPaged - Boolean for unpaged results

Filters (AgentRecipientCriteria):

  • id.equals, id.in

  • agentId.equals - Filter by agent ID

  • recipientId.equals - Filter by recipient ID

  • active.equals - Filter by status

  • agentCommission.greaterThan, agentCommission.lessThan

  • settingId.equals

  • recipientGroupId.equals

Example Requests

Response

✅ Success (200 OK):


Get V2 (Projection)

[!example] GET /api/agent-recipients/v2 Retrieves paginated list with projection interface for optimized queries.

Query Parameters

Pagination only:

  • page - Page number (0-indexed)

  • size - Items per page

  • sort - Sort criteria

Example Request

Response

✅ Success (200 OK):

[!info] Projection Interface This endpoint uses AgentRecipientInfo projection for better performance. Returns minimal fields without full relationship objects.


Export to Excel

[!example] GET /api/agent-recipients/excel Retrieves all agent-recipients for Excel export with read-only DTO.

Query Parameters

Same as [[#Get All Agent-Recipients]] but returns AgentRecipientReadOnlyDto.

Example Request

Response

✅ Success (200 OK):

[!tip] Use Case Use this endpoint when exporting data to Excel or other reporting formats.


Get Single Agent-Recipient

[!example] GET /api/agent-recipients/{id} Retrieves a single agent-recipient relationship by ID.

Path Parameters

  • id (Long) - Agent-Recipient identifier

Request

Response

✅ Success (200 OK):

❌ Error (404 Not Found):


Count Agent-Recipients

[!example] GET /api/agent-recipients/count Returns count of agent-recipients matching criteria.

Query Parameters

Same filtering parameters as [[#Get All Agent-Recipients]]

Example Requests

Response

✅ Success (200 OK):


Delete Agent-Recipient

[!example] DELETE /api/agent-recipients/{id} Deletes an agent-recipient relationship by ID.

Path Parameters

  • id (Long) - Agent-Recipient identifier

Request

Response

✅ Success (204 No Content):

[!danger] Delete Warning Deleting an agent-recipient relationship will:

  • Remove agent's access to the recipient

  • Affect commission calculations for future transactions

  • Not affect historical transactions


Examples

Example 1: Create Agent-Recipient for Financial Service

[!example]- Setup Uzcard for Agent Request:

Example 2: Update Commission Rates

[!example]- Adjust Agent Commission Request:

Response:

Example 3: Find Agent's Recipients

[!example]- Get All Active Recipients for Agent Request:


Error Handling

Error Response Format

[!failure] RFC 7807 Problem Details All errors follow standardized format.

HTTP Status Codes

Code
Type
Description
Common Causes

400

Bad Request

Invalid request

Validation failure, ID mismatch, invalid commission

401

Unauthorized

Auth required

Missing/invalid token

403

Forbidden

Access denied

Insufficient permissions

404

Not Found

Resource missing

Invalid ID, deleted entity

409

Conflict

Resource conflict

Duplicate agent-recipient pair

500

Server Error

Internal error

Database error, exception

Validation Error Example

[!bug] Commission Validation Error


Validation Rules

Required Fields

[!check] Mandatory Fields

  • active - Active status flag (true/false)

Field Constraints

Field
Rules
Error Messages

id

Null for POST

"A new agentRecipient cannot already have an ID"

id

Not null for PUT/PATCH

"Invalid id"

agentCommission

@DecimalMin(0), @DecimalMax(100)

"must be greater than or equal to 0", "must be less than or equal to 100"

agentFee

@DecimalMin(0), @DecimalMax(100)

"must be greater than or equal to 0", "must be less than or equal to 100"

systemCommissionUp

@DecimalMax(100)

"must be less than or equal to 100" (can be negative)

systemCommissionDown

@DecimalMin(0), @DecimalMax(100)

"must be greater than or equal to 0", "must be less than or equal to 100"

systemFee

@DecimalMin(0), @DecimalMax(100)

"must be greater than or equal to 0", "must be less than or equal to 100"

active

@NotNull

"must not be null"

eposPort

@Min(0), @Max(65535)

"must be greater than or equal to 0", "must be less than or equal to 65535"

eposMerchant

@Size(max=32)

"size must be between 0 and 32"

eposTerminal

@Size(max=32)

"size must be between 0 and 32"

requestGroup

@Size(max=64)

"size must be between 0 and 64"

Business Rules

[!info] Business Validation

  • Agent and Recipient combination should be unique

  • At least one commission/fee should be configured

  • EPOS parameters are required if integration is enabled

  • Commission values should make business sense (total shouldn't exceed 100%)


🔧 cURL Command Reference

Create

Update

Partial Update

Get All

Get V2 (Projection)

Get Single

Count

Delete

Last updated