Gateway

Gateway API - Complete Documentation

[!info] Overview The Gateway REST API provides comprehensive CRUD operations for managing payment gateway entities in the pkbillms billing system. Built on JHipster framework.

📋 Table of Contents

Table of Contents


Quick Reference

[!abstract] API Configuration

  • Base URL: /api

  • Entity Name: Gateway

  • Controller: GatewayResource

  • Framework: Spring Boot + JHipster

  • Auth: Required (Spring Security)

  • Content-Type: application/json

Endpoints Summary

Method
Endpoint
Description
Status

POST

/api/gateways

Create new gateway

201

PUT

/api/gateways/{id}

Full update

200

PATCH

/api/gateways/{id}

Partial update

200

GET

/api/gateways

Get all (paginated)

200

GET

/api/gateways/{id}

Get by ID

200

GET

/api/gateways/count

Count by criteria

200

DELETE

/api/gateways/{id}

Delete gateway

204


Data Models

Gateway DTO Structure

[!note] Data Transfer Object Used for API requests and responses. Includes audit fields automatically.

Field Specifications

Field
Type
Required
Max
DB Column
Description

id

Long

❌ Auto

-

id

Primary key (sequence)

name

String

64

name

Gateway display name

org

String

32

org

Organization name

active

Boolean

-

active

Active/Inactive

mfo

String

8

mfo

Bank MFO (BIN) code

taxnr

Long

-

taxnr

Tax ID (INN)

ban

String

32

ban

Bank account number

contract

String

64

contract

Contract reference

springBeanName

String

128

spring_bean_name

Spring Bean ID

Audit Fields (Auto-populated)

[!success] Inherited from AbstractAuditingDTO These fields are automatically managed by the system.

Field
Type
Description

createdBy

String

Username who created

createdDate

Instant

Creation timestamp

lastModifiedBy

String

Last modifier

lastModifiedDate

Instant

Last modification


API Endpoints

Create Gateway

POST /api/gateways

Creates a new payment gateway entity.

Request

Headers:

Body:

[!warning] Validation Rules

  • id must be null (auto-generated)

  • All required fields must be provided

  • String lengths must not exceed limits

  • @Valid annotation enforces validation

Response

✅ Success (201 Created):

❌ Error (400 - ID exists):


Update Gateway

[!example] PUT /api/gateways/{id} Completely updates an existing gateway. All fields required.

Path Parameters

  • id (Long) - Gateway identifier

Request

Headers:

Body:

[!warning] Validation

  • Body id must not be null

  • Path id must match body id

  • Gateway must exist in database

  • All required fields must be provided

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/gateways/{id} Updates only specified fields. Null fields are ignored.

Path Parameters

  • id (Long) - Gateway identifier

Request

Headers:

Body (Example - update name and status only):

[!tip] Partial Update Behavior

  • Only non-null fields are updated

  • Other fields remain unchanged

  • Perfect for status toggles or single field updates

Response

✅ Success (200 OK):


Get All Gateways

[!example] GET /api/gateways Retrieves paginated list with optional filtering.

Query Parameters

Pagination:

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

  • size - Items per page (default: 20, max: 100)

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

Filters (GatewayCriteria):

  • id.equals, id.in

  • name.contains, name.equals

  • org.contains, org.equals

  • active.equals

  • mfo.equals

  • taxnr.equals

  • ban.contains

  • contract.contains

Example Requests

Response

✅ Success (200 OK):

[!info] Response Headers

  • X-Total-Count - Total matching records

  • Link - Pagination links (RFC 5988)


Get Single Gateway

[!example] GET /api/gateways/{id} Retrieves a single gateway by ID.

Path Parameters

  • id (Long) - Gateway identifier

Request

Response

✅ Success (200 OK):

❌ Error (404 Not Found):


Count Gateways

[!example] GET /api/gateways/count Returns count of gateways matching criteria.

Query Parameters

Same filtering parameters as [[#Get All Gateways]]

Example Requests

Response

✅ Success (200 OK):


Delete Gateway

[!example] DELETE /api/gateways/{id} Deletes a gateway by ID.

Path Parameters

  • id (Long) - Gateway identifier

Request

Response

✅ Success (204 No Content):

[!danger] Cascade Delete Warning Deletion may fail (500) if gateway has dependent relationships (e.g., Deposit).


Examples

Example 1: Create New Gateway

[!example]- Create Uzcard Gateway Request:

Response:

Example 2: Toggle Gateway Status

[!example]- Deactivate Gateway Request:

Response:

Example 3: Search Active Bank Gateways

[!example]- Filter by Organization and Status Request:

Response:


Error Handling

Error Response Format

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

HTTP Status Codes

Code
Type
Description
Common Causes

400

Bad Request

Invalid request

Validation failure, ID mismatch

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 entry, constraints

500

Server Error

Internal error

Database error, exception

Validation Error Example

[!bug] Field Validation Errors Multiple field errors returned in single response.

Business Logic Errors

[!bug]- ID Already Exists (POST)

[!bug]- Entity Not Found (PUT/PATCH/DELETE)

[!bug]- ID Mismatch (PUT/PATCH)


Validation Rules

Field-Level Validation

Field
Rules
Error Messages

id

Null for POST

"A new gateway cannot already have an ID"

id

Not null for PUT/PATCH

"Invalid id"

id

Must match path

"Invalid ID"

name

@NotNull, @Size(max=64)

"must not be null", "size must be between 0 and 64"

org

@NotNull, @Size(max=32)

"must not be null", "size must be between 0 and 32"

active

@NotNull

"must not be null"

mfo

@NotNull, @Size(max=8)

"must not be null", "size must be between 0 and 8"

taxnr

Optional

-

ban

@NotNull, @Size(max=32)

"must not be null", "size must be between 0 and 32"

contract

@NotNull, @Size(max=64)

"must not be null", "size must be between 0 and 64"

springBeanName

@Size(max=128)

"size must be between 0 and 128"

Entity-Level Validation

[!check] Validation Checklist

  • ✅ Gateway must exist before update/patch/delete

  • ✅ Path ID must match body ID

  • ✅ All @NotNull fields required for POST/PUT

  • ✅ PATCH only validates non-null fields


Pagination & Filtering

Pagination Parameters

[!tip] Standard Parameters

  • page - Zero-based index (default: 0)

  • size - Records per page (default: 20, max: 100)

  • sort - Format: property,direction

Examples:

Filtering with Criteria API

[!abstract] Comparison Operators Advanced filtering through dynamic criteria.

Operator
Description
Example

equals

Exact match

active.equals=true

notEquals

Not equal

active.notEquals=false

in

In list

id.in=1,2,3

notIn

Not in list

id.notIn=4,5,6

specified

Null check

taxnr.specified=true

greaterThan

GT (numeric/date)

id.greaterThan=10

lessThan

LT (numeric/date)

id.lessThan=100

contains

String contains

name.contains=Gateway

Filter Examples

[!example]- Common Filter Patterns

Active gateways:

Specific MFO:

Multiple organizations:

With tax number:

Name pattern:

Complex filter:

Response Headers

[!info] Pagination Headers

  • X-Total-Count - Total number of records

  • Link - Navigation links (RFC 5988)

Example Link Header:


🔧 cURL Command Reference

Create

Update

Partial Update

Get All

Get Single

Count

Delete



FieldValue API - Complete Documentation

[!info] Overview The FieldValue REST API manages predefined values and options for dynamic form fields in the pkbillms billing system. FieldValues define selectable options, pricing information, and filtering logic for field configurations with multilingual support.

📋 Table of Contents

  • [[#Quick Reference|Quick Reference]]

  • [[#Data Models|Data Models]]

  • [[#API Endpoints|API Endpoints]]

    • [[#Create FieldValue|Create FieldValue]]

    • [[#Update FieldValue|Update FieldValue]]

    • [[#Partial Update|Partial Update]]

    • [[#Get All FieldValues|Get All FieldValues]]

    • [[#Get FieldValues by Criteria|Get FieldValues by Criteria]]

    • [[#Get FieldValues V2|Get FieldValues V2]]

    • [[#Get Single FieldValue|Get Single FieldValue]]

    • [[#Count FieldValues|Count FieldValues]]

    • [[#Delete FieldValue|Delete FieldValue]]

    • [[#Cascaded Delete|Cascaded Delete FieldValue]]

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

  • [[#Error Handling|Error Handling]]

  • [[#Validation Rules|Validation Rules]]


Quick Reference

[!abstract] API Configuration

  • Base URL: /api

  • Entity Name: FieldValue

  • Controller: FieldValueResource

  • Framework: Spring Boot + JHipster

  • Auth: Required (Spring Security)

  • Content-Type: application/json

Endpoints Summary

Method
Endpoint
Description
Status

POST

/api/field-values

Create new field value

201

PUT

/api/field-values/{id}

Full update

200

PATCH

/api/field-values/{id}

Partial update

200

GET

/api/field-values

Get all with pagination

200

GET

/api/field-values/get

Get all (alternative)

200

GET

/api/field-values/criteria

Get by criteria + field

200

GET

/api/v2/field-values

Get V2 projection

200

GET

/api/field-values/{id}

Get by ID

200

GET

/api/field-values/count

Count by criteria

200

DELETE

/api/field-values/{id}

Delete field value

204

DELETE

/api/field-values/cascaded/{id}

Cascaded delete

200


Data Models

FieldValue Specifications

Field
Type
Required
Max/Range
Description

id

Long

❌ Auto

-

Primary key

value

String

64

Param value to send to server

amount

Long

-

Price of selected value

filterBy

String

16

Filter by parent field

ord

Integer

-

Display order

checkId

String

-

Check identifier

field

FieldDTO

-

Parent field reference

titles

Set

-

Multilingual titles

descriptions

Set

-

Multilingual descriptions


API Endpoints

Create FieldValue

[!example] POST /api/field-values Creates a new field value option.

Request

Headers:

Body:

[!warning] Validation Rules

  • id must be null (auto-generated)

  • value and field are required

  • value max length is 64 characters

  • filterBy max length is 16 characters

Response

✅ Success (201 Created):

❌ Error (400 - ID exists):


Update FieldValue

[!example] PUT /api/field-values/{id} Updates an existing field value (full update).

Request

Headers:

Body:

[!warning] Validation Rules

  • id must match path parameter

  • id must not be null

  • FieldValue must exist in database

Response

✅ Success (200 OK):

❌ Error (400 - Invalid ID):

❌ Error (400 - Not found):


Partial Update

[!example] PATCH /api/field-values/{id} Partially updates field value properties.

Request

Headers:

Body:

Response

✅ Success (200 OK):

❌ Error (404 - Not Found):


Get All FieldValues

[!example] GET /api/field-values Retrieves all field values with pagination and filtering.

Request

Headers:

Query Parameters:

Parameter
Type
Required
Description

page

Integer

Page number (default: 0)

size

Integer

Page size (default: 20)

sort

String

Sort field and direction

unPaged

Boolean

Disable pagination

Example:

Response

✅ Success (200 OK):


Get All FieldValues (Alternative)

[!example] GET /api/field-values/get Alternative endpoint for retrieving field values.

Request

Headers:

Query Parameters: Same as main GET endpoint plus FieldValueCriteria filters.

Example:

Response

✅ Success (200 OK): Same format as main GET endpoint.


FieldValueCriteria - Advanced Filtering

[!abstract] JHipster Criteria Filtering FieldValueCriteria provides powerful filtering capabilities for querying field values. All filter parameters support multiple operators for precise data retrieval.

Available Filter Types

String Filters:

Operator
Description
Example

equals

Exact match

value.equals=50000

notEquals

Not equal

value.notEquals=100000

in

Match any value

value.in=50000,100000,150000

notIn

Not in list

value.notIn=0,5000

contains

Partial match

value.contains=000

doesNotContain

Doesn't contain

filterBy.doesNotContain=test

specified

Field exists/null

filterBy.specified=true

Numeric Filters (Long, Integer):

Operator
Description
Example

equals

Exact match

amount.equals=50000

notEquals

Not equal

amount.notEquals=0

in

Match any value

amount.in=50000,100000

notIn

Not in list

amount.notIn=0

greaterThan

Greater than

amount.greaterThan=50000

lessThan

Less than

amount.lessThan=100000

greaterOrEqualThan

Greater or equal

amount.greaterOrEqualThan=50000

lessOrEqualThan

Less or equal

amount.lessOrEqualThan=100000

specified

Field exists/null

amount.specified=true

Get FieldValues by Criteria

[!example] GET /api/field-values/criteria Retrieves field values filtered by field name and criteria.

Request

Headers:

Example:

Response

✅ Success (200 OK):

FieldValueCriteria Parameters

Common Query Examples

Filter by Field:

Filter by Amount Range:

Filter with filterBy:

Search by Value:

Values with Amount:

Sorted by Display Order:

Complex Filter (AND operation):

Combining Filters

[!tip] Multiple Criteria All criteria are combined with AND logic. Use .in operator for OR logic on same field.

Example:


Get FieldValues V2

[!example] GET /api/v2/field-values Retrieves field values using V2 projection (optimized response).

Request

Headers:

Query Parameters: Same as standard criteria endpoint.

Example:

Response

✅ Success (200 OK):

[!info] V2 Projection V2 endpoint returns a lighter projection without nested objects for better performance.


Get Single FieldValue

[!example] GET /api/field-values/{id} Retrieves a single field value by ID.

Request

Headers:

Example:

Response

✅ Success (200 OK):

❌ Error (404 - Not found):


Count FieldValues

[!example] GET /api/field-values/count Counts field values matching criteria.

Request

Headers:

Query Parameters: Any FieldValueCriteria filters.

Example:

Response

✅ Success (200 OK):


Delete FieldValue

[!example] DELETE /api/field-values/{id} Deletes a field value.

Request

Headers:

Example:

Response

✅ Success (204 No Content):


Cascaded Delete FieldValue

[!example] DELETE /api/field-values/cascaded/{id} Deletes a field value with all related entities (I18n translations).

Request

Headers:

Example:

Response

✅ Success (200 OK):


Error Handling

Error Response Format

HTTP Status Codes

Code
Description
When

200

OK

Successful GET/PUT/PATCH

201

Created

Successful POST

204

No Content

Successful DELETE

400

Bad Request

Validation error

401

Unauthorized

Missing/invalid authentication

403

Forbidden

Insufficient permissions

404

Not Found

Resource doesn't exist

500

Internal Server Error

Server error


Validation Rules

Required Fields

[!check] Mandatory Fields

  • value - Value to send to server

  • field - Parent field reference

  • titles - At least one title (I18n)

Field Constraints

Field
Rules
Error Messages

id

Null for POST

"A new fieldValue cannot already have an ID"

id

Not null for PUT/PATCH

"Invalid id"

value

@NotNull, @Size(max=64)

"must not be null", "size must be between 0 and 64"

filterBy

@Size(max=16)

"size must be between 0 and 16"

field

@NotNull

"must not be null"

titles

@NotNull

"must not be null"

Business Rules

[!info] Business Validation

  • value is used as the parameter sent to backend services

  • amount represents pricing information for the selected value

  • filterBy enables dependent dropdown filtering (parent-child relationships)

  • ord determines display order in UI select elements

  • checkId is used for validation and reconciliation processes

  • titles must include at least one language translation

  • descriptions are optional additional information


🔧 cURL Command Reference

Create

Update

Partial Update

Get All

Get by Criteria (with Field Name)

Get by Criteria (Standard)

Get V2

Get Single

Count

Delete

Cascaded Delete


📝 Notes

[!tip] Best Practices

  • Always provide meaningful ord values for proper sorting

  • Use filterBy for cascading dropdown dependencies

  • Include translations for all supported languages

  • Set appropriate amount values for pricing information

  • Use checkId for validation and reconciliation tracking

[!warning] Important

  • Deleting field values may affect active payment forms

  • Use cascaded delete carefully as it removes all I18n data

  • value field is sent to backend services - ensure proper validation

  • V2 endpoint provides better performance for large datasets



Last updated