P2p commission group

[!info] Overview The P2P Commission Group REST API manages commission groupings in the BMMS billing system. Commission groups organize multiple P2P commissions together for streamlined management and configuration across payment transactions.

📋 Table of Contents


Quick Reference

[!abstract] API Configuration

  • Base URL: /api

  • Entity Name: P2PCommissionGroup

  • Controller: P2pCommissionGroupResource

  • Framework: Spring Boot + JHipster

  • Auth: Required (Spring Security)

  • Content-Type: application/json

Endpoints Summary

Method
Endpoint
Description
Status

POST

/api/p-2-p-commission-groups

Create new commission group

201

PUT

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

Full update

200

PATCH

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

Partial update

200

GET

/api/p-2-p-commission-groups

Get all with criteria

200

GET

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

Get by ID

200

GET

/api/p-2-p-commission-groups/count

Count by criteria

200

DELETE

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

Delete commission group

204


Field Specifications

Field
Type
Required
Constraints
DB Column
Description

id

Long

❌ Auto

-

id

Primary key

name

String

Unique

name

Group name (unique identifier)

description

String

-

description

Optional description

p2pCommissions

List

NotNull

ManyToMany rel

Associated P2P commissions


API Endpoints

Create Commission Group

POST /api/p-2-p-commission-groups

Creates a new commission group entity.

Request

Headers:

Body:

[!warning] Validation Rules

  • id must be null (auto-generated)

  • name must be non-empty and unique

  • p2pCommissions must be non-null and contain valid commission references

  • P2P commissions must exist in the system

Response

✅ Success (201 Created):

❌ Error (400 - Name exists):

❌ Error (400 - ID exists):


Update Commission Group

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

Completely updates an existing commission group.

Path Parameters

  • id (Long) - Commission group identifier

Request

Headers:

Body:

[!warning] Validation

  • Body id must not be null

  • Path id must match body id

  • Commission group 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 Group

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

Updates only specified fields. Null fields are ignored.

Path Parameters

  • id (Long) - Commission group identifier

Request

Headers:

Body (Example - update only description):

Body (Example - update name and commissions):

[!tip] Partial Update Behavior

  • Only non-null fields are updated

  • Other fields remain unchanged

  • Perfect for updating single fields without affecting others

  • P2P commissions list is completely replaced if provided (not merged)

  • Name uniqueness is validated if name is being changed

Response

✅ Success (200 OK):


Get All Commission Groups

GET /api/p-2-p-commission-groups

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 (P2pCommissionGroupCriteria):

  • id.equals, id.in

  • name.contains, name.equals

  • description.contains

Example Requests

Response

✅ Success (200 OK):


Get Single Commission Group

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

Retrieves a single commission group by ID with all relationships.

Path Parameters

  • id (Long) - Commission group identifier

Request

Response

✅ Success (200 OK):

❌ Error (404 Not Found):


Count Commission Groups

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

Returns count of commission groups matching criteria.

Query Parameters

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

Example Requests

Response

✅ Success (200 OK):


Delete Commission Group

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

Deletes a commission group from the system.

Path Parameters

  • id (Long) - Commission group identifier

Request

Response

✅ Success (204 No Content):

[!info] Deletion Behavior

  • Commission group is permanently deleted from the system

  • Associated relationships are removed

  • P2P commissions within the group are not deleted, only the grouping relationship is removed

  • No cascade deletion of commissions


Examples

Example 1: Create Basic Commission Group

  • Setup Basic Commission Structure Request:

Example 2: Create Multi-Commission Group

  • Complex Commission Structure Request:

Example 3: Update Commissions in Group

  • Replace Commission List Request:

Response:

Example 4: Update Only Description

  • Metadata Update Request:

Example 5: Search by Name

  • Find Specific Groups 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

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 - Group name (unique)

  • p2pCommissions - List of P2P commissions

Field Constraints

Field
Rules
Error Messages

id

Null for POST

"A new commission group 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

-

p2pCommissions

@NotNull, Valid references

"must not be null", "invalid commission references"

Business Rules

[!info] Business Validation

  • name must be globally unique across all commission groups

  • p2pCommissions must contain valid references to existing P2P commissions

  • Groups can contain multiple P2P commissions

  • Same P2P commission can appear in multiple groups

  • Empty P2P commissions list is not allowed

  • Deletion removes the group but not the P2P commissions


🔧 cURL Command Reference

Create

Update

Partial Update

Get All

Get Single

Count

Delete



Last updated