Response field

[!info] Overview The ResponseField REST API manages response field configurations for payment transaction results in the pkbillms billing system. ResponseFields define which data fields are returned from backend services, their visibility, formatting, and display order with multilingual support.

📋 Table of Contents


Quick Reference

[!abstract] API Configuration

  • Base URL: /api

  • Entity Name: ResponseField

  • Controller: ResponseFieldResource

  • Framework: Spring Boot + JHipster

  • Auth: Required (Spring Security)

  • Content-Type: application/json

Endpoints Summary

Method
Endpoint
Description
Status

POST

/api/response-fields

Create new response field

201

PUT

/api/response-fields/{id}

Full update

200

PATCH

/api/response-fields/{id}

Partial update

200

GET

/api/response-fields

Get all with pagination

200

GET

/api/response-fields/{id}

Get by ID

200

GET

/api/response-fields/count

Count by criteria

200

DELETE

/api/response-fields/{id}

Delete response field

204


Data Models

ResponseField Specifications

Field
Type
Required
Max/Range
Description

id

Long

❌ Auto

-

Primary key

name

String

128

Response field name (account_id, phone, etc.)

visibility

Visibility

ENUM

UI visibility setting

ord

Integer

-

Display order

requestType

RequestType

ENUM

Transaction type association

type

ResponseFieldType

ENUM

Field data type

amountRatio

Integer

-

Amount fraction (1=sum, 100=tiyin)

active

Boolean

-

Activation status

recipient

RecipientDTO

-

Payment recipient reference

labels

Set

-

Multilingual labels

Visibility Enum

RequestType Enum

ResponseFieldType Enum


API Endpoints

Create ResponseField

POST /api/response-fields

Creates a new response field configuration.

Request

Headers:

Body:

[!warning] Validation Rules

  • id must be null (auto-generated)

  • name, recipient, and labels are required

  • name max length is 128 characters

  • At least one label translation required

Response

✅ Success (201 Created):

❌ Error (400 - ID exists):


Update ResponseField

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

Request

Headers:

Body:

[!warning] Validation Rules

  • id must match path parameter

  • id must not be null

  • ResponseField must exist in database

Response

✅ Success (200 OK):

❌ Error (400 - Invalid ID):

❌ Error (400 - Not found):


Partial Update

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

Request

Headers:

Body:

Response

✅ Success (200 OK):

❌ Error (404 - Not Found):


Get All ResponseFields

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


ResponseFieldCriteria - Advanced Filtering

[!abstract] JHipster Criteria Filtering ResponseFieldCriteria provides powerful filtering capabilities for querying response fields. All filter parameters support multiple operators for precise data retrieval.

Available Filter Types

String Filters:

Operator
Description
Example

equals

Exact match

name.equals=account_balance

notEquals

Not equal

name.notEquals=temp_field

in

Match any value

name.in=account_id,phone,login

notIn

Not in list

name.notIn=hidden,test

contains

Partial match

name.contains=balance

doesNotContain

Doesn't contain

name.doesNotContain=temp

specified

Field exists/null

name.specified=true

Numeric Filters (Long, Integer):

Operator
Description
Example

equals

Exact match

id.equals=5

notEquals

Not equal

amountRatio.notEquals=1

in

Match any value

id.in=1,2,3,4,5

notIn

Not in list

id.notIn=99,100

greaterThan

Greater than

ord.greaterThan=5

lessThan

Less than

ord.lessThan=10

greaterOrEqualThan

Greater or equal

amountRatio.greaterOrEqualThan=100

lessOrEqualThan

Less or equal

amountRatio.lessOrEqualThan=100

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

Enum Filters (Visibility, RequestType, ResponseFieldType):

Operator
Description
Example

equals

Exact match

visibility.equals=ALL

notEquals

Not equal

visibility.notEquals=HIDDEN

in

Match any value

requestType.in=CHECK,PAY,STATUS

notIn

Not in list

visibility.notIn=HIDDEN

specified

Field exists/null

requestType.specified=true

ResponseFieldCriteria Parameters

Common Query Examples

Filter by Recipient:

Filter by Request Type:

Filter Active Fields:

Filter by Visibility:

Filter by Type:

Search by Name:

Filter Amount Ratio:

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 ResponseField

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

Request

Headers:

Example:

Response

✅ Success (200 OK):

❌ Error (404 - Not found):


Count ResponseFields

[!example] GET /api/response-fields/count Counts response fields matching criteria.

Request

Headers:

Query Parameters: Any ResponseFieldCriteria filters.

Example:

Response

✅ Success (200 OK):


Delete ResponseField

[!example] DELETE /api/response-fields/{id} Deletes a response field.

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

  • name - Response field name

  • recipient - Payment recipient reference

  • labels - At least one label translation

Field Constraints

Field
Rules
Error Messages

id

Null for POST

"A new responseField cannot already have an ID"

id

Not null for PUT/PATCH

"Invalid id"

name

@NotNull, @Size(max=128)

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

recipient

@NotNull

"must not be null"

labels

@NotNull

"must not be null"

Business Rules

[!info] Business Validation

  • name identifies the field in backend response (e.g., account_id, phone, balance)

  • visibility controls where the field is displayed (UI, printer, monitor)

  • requestType determines which transaction type this field belongs to

  • type defines data formatting (TEXT, AMOUNT, DATE)

  • amountRatio specifies amount division: 1 for sum, 100 for tiyin (cents)

  • active flag enables/disables the field in responses

  • ord determines display order in UI

  • labels must include at least one language translation


🔧 cURL Command Reference

Create

Update

Partial Update

Get All

Get by Criteria

Get Single

Count

Delete


📝 Notes

[!tip] Best Practices

  • Set appropriate visibility for each field based on requirements

  • Use HIDDEN for system fields not meant for user display

  • Set amountRatio to 100 for tiyin/cents, 1 for sum/dollars

  • Always provide translations for all supported languages

  • Use meaningful name values that match backend response keys

  • Set proper ord values for consistent display order

  • Use requestType to organize fields by transaction type

[!warning] Important

  • name must match the field name in backend service responses

  • Deleting response fields may affect transaction display

  • amountRatio is critical for proper amount formatting

  • Inactive fields (active=false) will not appear in responses

  • HIDDEN visibility still stores data but hides from UI


📊 Amount Ratio Explained

[!info] Amount Ratio Usage The amountRatio field determines how amounts are divided:

amountRatio = 1:

  • Amount is in major currency unit (sum, dollar, euro)

  • Example: 50000 = 50,000 sum

amountRatio = 100:

  • Amount is in minor currency unit (tiyin, cents)

  • Example: 5000000 = 50,000.00 sum (5,000,000 tiyin ÷ 100)

Common Use:



Last updated