Setting

[!info] Overview The Setting REST API manages payment transaction settings and configurations in the pkbillms billing system. Settings define terminal properties, merchant configurations, and system parameters required for processing payments through various payment gateways (UZCARD, PAYNET, HUMO, WAY4).

📋 Table of Contents


Quick Reference

[!abstract] API Configuration

  • Base URL: /api

  • Entity Name: Setting

  • Controller: SettingResource

  • Framework: Spring Boot + JHipster

  • Auth: Required (Spring Security)

  • Content-Type: application/json

Endpoints Summary

Method
Endpoint
Description
Status

POST

/api/settings

Create new setting

201

PUT

/api/settings/{id}

Full update

200

PATCH

/api/settings/{id}

Partial update

200

GET

/api/settings

Get all with pagination

200

GET

/api/settings/{id}

Get by ID

200

GET

/api/settings/count

Count by criteria

200

DELETE

/api/settings/{id}

Delete setting

204


Data Models

Setting Specifications

Field
Type
Required
Max/Range
Description

id

Long

❌ Auto

-

Primary key

shortName

String

64

Short name to show in UI

ord

Integer

-

Display order

active

Boolean

-

Activation status

props

Map<Prop, SettingProperty>

-

Configuration properties map

SettingProperty Specifications

Field
Type
Required
Max/Range
DB Column
Description

id

Long

❌ Auto

-

id

Primary key

key

Prop

ENUM

key

Property key identifier

type

PropType

ENUM

type

Property value type

value

String

5000

value

Property value

Prop Enum

PropType Enum


API Endpoints

Create Setting

POST /api/settings

Creates a new payment setting configuration.

Request

Headers:

Body:

[!warning] Validation Rules

  • id must be null (auto-generated)

  • shortName and active are required

  • shortName max length is 64 characters

  • props map must contain valid Prop keys

  • Each property must have valid key, type, and value

Response

✅ Success (201 Created):

❌ Error (400 - ID exists):


Update Setting

[!example] PUT /api/settings/{id} Updates an existing payment setting (full update).

Request

Headers:

Body:

[!warning] Validation Rules

  • id must match path parameter

  • id must not be null

  • Setting must exist in database

Response

✅ Success (200 OK):

❌ Error (400 - Invalid ID):

❌ Error (400 - Not found):


Partial Update

[!example] PATCH /api/settings/{id} Partially updates setting properties.

Request

Headers:

Body:

Response

✅ Success (200 OK):

❌ Error (404 - Not Found):


Get All Settings

[!example] GET /api/settings Retrieves all payment settings 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):


SettingCriteria - Advanced Filtering

[!abstract] JHipster Criteria Filtering SettingCriteria provides powerful filtering capabilities for querying payment settings. All filter parameters support multiple operators for precise data retrieval.

Available Filter Types

String Filters:

Operator
Description
Example

equals

Exact match

shortName.equals=UZCARD_TERMINAL_01

notEquals

Not equal

shortName.notEquals=TEST_TERMINAL

in

Match any value

shortName.in=TERM01,TERM02

notIn

Not in list

shortName.notIn=OLD_TERM

contains

Partial match

shortName.contains=UZCARD

doesNotContain

Doesn't contain

shortName.doesNotContain=TEST

specified

Field exists/null

shortName.specified=true

Numeric Filters (Long, Integer):

Operator
Description
Example

equals

Exact match

id.equals=1

notEquals

Not equal

ord.notEquals=0

in

Match any value

id.in=1,2,3

notIn

Not in list

id.notIn=99,100

greaterThan

Greater than

ord.greaterThan=5

lessThan

Less than

ord.lessThan=10

greaterOrEqualThan

Greater or equal

ord.greaterOrEqualThan=1

lessOrEqualThan

Less or equal

ord.lessOrEqualThan=10

specified

Field exists/null

ord.specified=true

Boolean Filters:

Operator
Description
Example

equals

Exact match

active.equals=true

notEquals

Not equal

active.notEquals=false

specified

Field exists/null

active.specified=true

SettingCriteria Parameters

Common Query Examples

Filter Active Settings:

Filter by Name:

Filter by Display Order:

Search Specific Terminals:

Active Settings Only:

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 Single Setting

[!example] GET /api/settings/{id} Retrieves a single payment setting by ID.

Request

Headers:

Example:

Response

✅ Success (200 OK):

❌ Error (404 - Not found):


Count Settings

[!example] GET /api/settings/count Counts payment settings matching criteria.

Request

Headers:

Query Parameters: Any SettingCriteria filters.

Example:

Response

✅ Success (200 OK):


Delete Setting

[!example] DELETE /api/settings/{id} Deletes a payment setting.

Request

Headers:

Example:

Response

✅ Success (204 No Content):


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

  • shortName - Setting name

  • active - Activation status

  • props - Properties map (can be empty)

Field Constraints

Field
Rules
Error Messages

id

Null for POST

"A new setting cannot already have an ID"

id

Not null for PUT/PATCH

"Invalid id"

shortName

@NotNull, @Size(max=64)

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

active

@NotNull

"must not be null"

props

@NotNull

"must not be null"

SettingProperty Constraints

Field
Rules
Error Messages

key

@NotNull, Valid Prop enum

"must not be null", "must be valid Prop value"

type

@NotNull, Valid PropType

"must not be null", "must be valid PropType value"

value

@NotNull, @Size(max=5000)

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

Business Rules

[!info] Business Validation

  • shortName identifies the setting in UI

  • props is a Map with Prop enum as key and SettingProperty as value

  • Each SettingProperty must have a unique key within the setting

  • type determines how value should be parsed (TEXT, JSON, BOOLEAN)

  • value max length is 5000 characters for JSON configurations

  • Boolean values must be stored as strings: "true" or "false"

  • JSON values must be valid JSON format

  • active flag enables/disables the entire setting


🔧 cURL Command Reference

Create

Update

Partial Update

Get All

Get by Criteria

Get Single

Count

Delete


📊 Property Types Explained

[!info] PropType Usage Guide

TEXT Type

Used for simple string values:

JSON Type

Used for complex configurations:

BOOLEAN Type

Used for flags (stored as string):

[!warning] Important Notes

  • JSON values must be properly escaped

  • Boolean values are strings: "true" or "false"

  • Value field max length is 5000 characters

  • Invalid JSON will cause parsing errors


🔐 Security Considerations

[!warning] Sensitive Data Settings may contain sensitive information:

  • Passwords: Store encrypted or hashed

  • API Keys: Use secure vault when possible

  • Credentials: Never log in plain text

  • Access Control: Restrict who can view/modify settings

Best Practices:

  • Encrypt sensitive values before storing

  • Use environment variables for critical secrets

  • Audit all setting modifications

  • Implement role-based access control

  • Mask passwords in API responses


📝 Notes

[!tip] Best Practices

  • Use meaningful shortName values for easy identification

  • Set appropriate ord values for UI display order

  • Group related properties under single setting

  • Use JSON type for complex configurations

  • Always validate JSON values before saving

  • Keep property values under 5000 characters

  • Document each property's purpose

[!warning] Important

  • Deleting settings may affect payment processing

  • Inactive settings will not be used by payment gateways

  • Changing terminal IDs requires gateway reconfiguration

  • Props map uses Prop enum as key - case sensitive

  • Boolean values must be strings: "true" or "false"

  • JSON values must be valid and properly escaped



Last updated