[!info] Overview The P2P Condition REST API manages conditions for peer-to-peer payment routing in the pkbillms billing system. P2P conditions define matching rules and criteria used by P2P parameters to determine transaction routing between different payment processors.
📋 Table of Contents
Quick Reference
[!abstract] API Configuration
Entity Name: P2PCondition
Controller: P2pConditionResource
Framework: Spring Boot + JHipster
Auth: Required (Spring Security)
Content-Type: application/json
Endpoints Summary
Method
Endpoint
Description
Status
/api/p-2-p-conditions/{id}
/api/p-2-p-conditions/{id}
/api/p-2-p-conditions/{id}
/api/p-2-p-conditions/count
/api/p-2-p-conditions/{id}
Field Specifications
Field
Type
Required
Max/Range
DB Column
Description
Human-readable description
P2pConditionCriteria
[!note] Query Criteria Used for filtering and searching P2P conditions.
Available Filters:
id.equals, id.in, id.greaterThan, id.lessThan
value.equals, value.contains, value.specified
description.equals, description.contains, description.specified
Audit Fields (Inherited)
[!success] Auto-managed These fields are automatically populated by the system.
Create P2P Condition
POST /api/p-2-p-conditions
Creates a new P2P condition entity.
Headers:
Body:
[!warning] Validation Rules
id must be null (auto-generated)
Both fields are optional but recommended
✅ Success (201 Created):
❌ Error (400 - Has ID):
Update P2P Condition
PUT /api/p-2-p-conditions/{id}
Completely updates an existing P2P condition.
Path Parameters
id (Long) - P2P condition identifier
Headers:
Body:
[!warning] Validation
Path id must match body id
P2P condition must exist in database
✅ Success (200 OK):
❌ Errors:
PATCH /api/p-2-p-conditions/{id}
Updates only specified fields. Null fields are ignored.
Path Parameters
id (Long) - P2P condition identifier
Headers:
Body (Example - update description only):
Body (Example - update value only):
[!tip] Partial Update Behavior
Only non-null fields are updated
Other fields remain unchanged
Perfect for single field updates
Value uniqueness is still enforced
✅ Success (200 OK):
Get All P2P Conditions
GET /api/p-2-p-conditions
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., value,asc)
unPaged - Boolean for unpaged results
Filters (P2pConditionCriteria):
id.equals, id.in, id.greaterThan, id.lessThan
value.equals, value.contains, value.specified
description.equals, description.contains, description.specified
Example Requests
✅ Success (200 OK):
Get Single P2P Condition
GET /api/p-2-p-conditions/{id}
Retrieves a single P2P condition by ID.
Path Parameters
id (Long) - P2P condition identifier
✅ Success (200 OK):
❌ Error (404 Not Found):
Count P2P Conditions
GET /api/p-2-p-conditions/count
Returns count of P2P conditions matching criteria.
Query Parameters
Same filtering parameters as [[#Get All P2P Conditions]]
Example Requests
✅ Success (200 OK):
Delete P2P Condition
DELETE /api/p-2-p-conditions/{id}
Permanently deletes a P2P condition from the database.
Path Parameters
id (Long) - P2P condition identifier
✅ Success (204 No Content):
[!danger] Delete Warning Permanently deletes:
May fail if condition is referenced by P2P parameters
Check dependencies before deletion
Use with caution! This cannot be undone.
Example 1: Create Card Type Conditions
Setup Card Type Conditions Request - HUMO Condition:
Request - UZCARD Condition:
Example 2: Create Amount-Based Conditions
Setup Amount Ranges Request - Small Transactions:
Request - Large Transactions:
Example 3: Update Condition Description
Update Description Request:
Response:
Example 4: Search by Value
Response:
[!failure] RFC 7807 Problem Details All errors follow standardized format.
HTTP Status Codes
Code
Type
Description
Common Causes
Validation failure, ID mismatch
Invalid ID, deleted entity
Database error, foreign key conflict
Validation Error Example
[!bug] Field Validation Errors
Validation Rules
Field Constraints
[!info] Business Validation
value should be unique across all conditions
value typically contains identifiers or patterns (e.g., card prefixes, amount ranges)
description provides human-readable explanation of the condition
Conditions are referenced by P2P parameters for transaction routing
Deleting a condition may fail if it's used by active P2P parameters
Condition Usage in P2P Routing
[!info] How Conditions Work
P2P conditions are used by P2P parameters to match transactions:
Matching Process:
Transaction arrives with sender/recipient details
System checks all active P2P parameters
Each parameter's conditions are evaluated
First matching parameter (by priority) is selected
Transaction routed according to selected parameter
Common Condition Types
[!tip] Typical Condition Categories
Card Type Conditions:
HUMO_CARDS - HUMO card numbers (9860****)
UZCARD_CARDS - UZCARD card numbers (8600****)
VISA_CARDS - VISA card numbers (4****)
MASTERCARD_CARDS - MasterCard numbers (5****)
[!note] Recommended Format
🔧 cURL Command Reference
Use Case 1: Setup Card Type Routing
Scenario: Configure conditions to route transactions based on card types.
Implementation:
Create condition for HUMO cards
Create condition for UZCARD cards
Use conditions in P2P parameters for routing