P2p commission part

[!info] Overview The P2P Commission Part REST API manages individual commission parts in the BMMS billing system. Commission parts define the components of transaction fees, including fixed amounts and percentage-based charges that can be combined into commission groups.

📋 Table of Contents


Quick Reference

[!abstract] API Configuration

  • Base URL: /api

  • Entity Name: P2PCommissionPart

  • Controller: P2pCommissionPartResource

  • Framework: Spring Boot + JHipster

  • Auth: Required (Spring Security)

  • Content-Type: application/json

Endpoints Summary

Method
Endpoint
Description
Status

POST

/api/p-2-p-commission-parts

Create new commission part

201

PUT

/api/p-2-p-commission-parts/{id}

Full update

200

PATCH

/api/p-2-p-commission-parts/{id}

Partial update

200

GET

/api/p-2-p-commission-parts

Get all with criteria

200

GET

/api/p-2-p-commission-parts/{id}

Get by ID

200

GET

/api/p-2-p-commission-parts/count

Count by criteria

200

DELETE

/api/p-2-p-commission-parts/{id}

Delete commission part

204

DELETE

/api/p-2-p-commission-parts/{partId}/{groupId}

Delete part from specific group

204


Data Models

P2pCommissionPartDTO Structure

[!note] Data Transfer Object Represents a commission part with amount and calculation type.

Field Specifications

Field
Type
Required
Max/Range
DB Column
Description

id

Long

❌ Auto

-

id

Primary key

name

String

-

name

Part name (unique)

description

String

-

description

Optional description

amount

BigDecimal

-

amount

Commission amount

commMultiplierType

CommMultiplierType

ENUM

comm_multiplier_type

Calculation type

partDetails

String

-

part_details

Additional details

code

String

16

code

Part code (alphanumeric)

isResidualReceiver

Boolean

-

is_residual_receiver

Residual receiver flag

CommMultiplierType Enum

[!info] Commission Calculation Types Defines how the commission amount is applied.

Usage Examples:

  • PERCENT with amount = 1.5 → 1.5% of transaction

  • FIXED with amount = 1000 → 1000 UZS fixed fee


API Endpoints

Create Commission Part

POST /api/p-2-p-commission-parts

Creates a new commission part entity.

Request

Headers:

Body:

[!warning] Validation Rules

  • id must be null (auto-generated)

  • name must be non-empty and unique

  • amount must be non-null

  • commMultiplierType must be non-null (PERCENT or FIXED)

  • code must match pattern ^[a-zA-Z0-9]{1,15}$ (max 16 chars)

Response

✅ Success (201 Created):

❌ Error (400 - Name exists):

❌ Error (400 - ID exists):


Update Commission Part

PUT /api/p-2-p-commission-parts/{id}

Completely updates an existing commission part.

Path Parameters

  • id (Long) - Commission part identifier

Request

Headers:

Body:

[!warning] Validation

  • Body id must not be null

  • Path id must match body id

  • Commission part must exist in database

  • New name must be unique (if changed)

Response

✅ Success (200 OK):

❌ Errors:

Status
Detail
Message

400

Invalid id

error.not.null

400

Invalid ID

error.not.equal.id

400

Entity not found

error.entity.not.found

400

Name already exists

error.existed.name


Partial Update Commission Part

PATCH /api/p-2-p-commission-parts/{id}

Updates only specified fields. Null fields are ignored.

Path Parameters

  • id (Long) - Commission part identifier

Request

Headers:

Body (Example - update only amount):

Body (Example - update name and description):

[!tip] Partial Update Behavior

  • Only non-null fields are updated

  • Other fields remain unchanged

  • Perfect for updating single fields without affecting others

  • Name uniqueness is validated if name is being changed

Response

✅ Success (200 OK):


Get All Commission Parts

GET /api/p-2-p-commission-parts

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., name,asc)

  • unPaged - Boolean for unpaged results

Filters (P2pCommissionPartCriteria):

  • id.equals, id.in

  • name.contains, name.equals

  • code.equals, code.contains

  • commMultiplierType.equals - Filter by type

  • isResidualReceiver.equals - Filter by residual flag

Example Requests

Response

✅ Success (200 OK):


Get Single Commission Part

GET /api/p-2-p-commission-parts/{id}

Retrieves a single commission part by ID with all relationships.

Path Parameters

  • id (Long) - Commission part identifier

Request

Response

✅ Success (200 OK):

❌ Error (404 Not Found):


Count Commission Parts

GET /api/p-2-p-commission-parts/count

Returns count of commission parts matching criteria.

Query Parameters

Same filtering parameters as [[#Get All Commission Parts]]

Example Requests

Response

✅ Success (200 OK):


Delete Commission Part

DELETE /api/p-2-p-commission-parts/{id}

Deletes a commission part from the system.

Path Parameters

  • id (Long) - Commission part identifier

Request

Response

✅ Success (204 No Content):

❌ Error (400 - Part is in use):

[!danger] Deletion Constraint Warning A commission part cannot be deleted if:

  • It is referenced by any commission part group

The system performs this check before deletion:

Workaround: Remove the part from all commission groups before attempting deletion.


Delete Commission Part from Group

DELETE /api/p-2-p-commission-parts/{partId}/{groupId}

Removes a specific commission part from a specific group.

Path Parameters

  • partId (Long) - Commission part identifier

  • groupId (Long) - Commission part group identifier

Request

Response

✅ Success (204 No Content):

[!info] Use Case This endpoint is useful for:

  • Removing a part from a specific group without deleting the part entirely

  • Maintaining the part for use in other groups

  • Precise group membership management


Examples

Example 1: Create Percentage-Based Commission Part

  • Setup Percentage Fee Request:

Example 2: Create Fixed Amount Commission Part

  • Setup Fixed Fee Request:

Example 3: Create Residual Receiver Part

  • Setup Residual Receiver Request:

Example 4: Update Commission Amount

  • Update Fee Amount Request:

Response:

Example 5: Change Commission Type

[!example]- Convert from Percent to Fixed Request:

Example 6: Remove Part from Specific Group

[!example]- Remove from Group 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, duplicate name, part in use

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 name

500

Server Error

Internal error

Database error, exception

Validation Error Example

[!bug] Field Validation Errors


Validation Rules

Required Fields

[!check] Mandatory Fields

  • name - Part name (unique)

  • amount - Commission amount

  • commMultiplierType - Calculation type (PERCENT or FIXED)

Field Constraints

Field
Rules
Error Messages

id

Null for POST

"A new commission part cannot already have an ID"

id

Not null for PUT/PATCH

"Invalid id"

name

@NotEmpty, Unique

"must not be empty", "name already exists"

description

Optional

-

amount

@NotNull

"P2pCommissionPart amount can not be null"

commMultiplierType

@NotNull, ENUM

"P2pCommissionPart multiplier type can not be null"

partDetails

Optional

-

code

@Size(max=16), @Pattern

"size must be between 0 and 16", "must match pattern"

isResidualReceiver

Optional

-

Code Pattern Validation

[!info] Code Field Rules

  • Pattern: ^[a-zA-Z0-9]{1,15}$

  • Max Length: 16 characters

  • Allowed Characters: Letters (a-z, A-Z) and numbers (0-9)

  • Examples:

    • ✅ Valid: TXN_FEE, FEE123, COMMISSION1

    • ❌ Invalid: TXN-FEE (contains hyphen), FEE_123 (contains underscore)

Business Rules

[!info] Business Validation

  • name must be globally unique across all commission parts

  • amount must be a valid positive number

  • commMultiplierType determines how amount is interpreted:

    • PERCENT: amount is percentage (e.g., 1.5 = 1.5%)

    • FIXED: amount is fixed sum (e.g., 1000 = 1000 UZS)

  • Commission part cannot be deleted if referenced by any group

  • Only one isResidualReceiver part recommended per configuration

  • code should be unique (recommended but not enforced)


🔧 cURL Command Reference

Create

Update

Partial Update

Get All

Get Single

Count

Delete

Delete from Group



Last updated