0% found this document useful (0 votes)
5 views7 pages

Class Specification

The document outlines the design specifications for a QR-based payment system, detailing interfaces and classes such as 'IPaymentQRCode', 'VietQRController', 'VietQRBoundary', 'QRCode', 'PaymentStatus', and 'Order'. Each section describes attributes, operations, parameters, exceptions, and methods relevant to the payment processing workflow. The document serves as a technical reference for implementing QR code generation and payment status checks within the system.

Uploaded by

hpham239005
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views7 pages

Class Specification

The document outlines the design specifications for a QR-based payment system, detailing interfaces and classes such as 'IPaymentQRCode', 'VietQRController', 'VietQRBoundary', 'QRCode', 'PaymentStatus', and 'Order'. Each section describes attributes, operations, parameters, exceptions, and methods relevant to the payment processing workflow. The document serves as a technical reference for implementing QR code generation and payment status checks within the system.

Uploaded by

hpham239005
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

1.

Design for Interface "IPaymentQRCode"

Description: This interface defines the set of behaviors (operations) offered


by any QR-based payment classifier model element.

Table 1. Attribute Design

Interfaces do not contain attributes

Table 2. Operation Design

# Name Return Description (purpose)


type

1 generateQRCode QRCode Creates a QR code object based on the


provided order details.

2 checkPaymentSta PaymentStat Checks the current status of a transaction


tus us for a specific order.

Parameters:

- order: Order - Default value: null. An object containing order details like
amount and description used to generate the QR or check status.

Exception:

- PaymentException: Thrown if there is a general failure in the payment


process.

Method:

- No default behavior.
2. Design for Class "VietQRController"

Description: The controller is responsible for the internal logic of the


VietQRSubsystem.

Table 1. Attribute Design

# Name Data type Default Description


value

1 bounda VietQRBound null Boundary object used for external API


ry ary communication.

Table 2. Operation Design

# Name Return Description


type

1 generateQRCode QRCode Creates a QR code object based on the


provided order details.

2 checkPaymentSta PaymentStat Checks the current status of a transaction


tus us for a specific order.

Parameters:

- order: Order - Default value: null. The order information to be


processed.

Exception:

- PaymentException: Thrown during communication or processing errors.

Method:

- generateQRCode: Creates QRAccessTokenRequest , calls


[Link](), creates QRGenerateRequest , and returns
a QRCode object parsed from the response.
- checkPaymentStatus: Create QRCheckStatusRequest, calls
[Link], creates PaymentStatus and return an
order’s payment status

3. Design for Class "VietQRBoundary"

Description: Serves as the interaction point between AIMS and the external
VietQR system.

Table 1. Attribute Design

# Name Data Default value Description


type

1 GET_TOKEN_URL String [Link] Endpoint for the


<your-basepath>/api/ VietQR Get Token
token_generate API.

2 GENERATE_QR_UR String [Link] Endpoint for


L vqr/api/qr/generate- generating dynamic
customer QR codes.

3 TEST_CALLBACK_ String [Link] Endpoint for testing


URL vqr/bank/api/test/ transaction.
transaction-callback

Table 2. Operation Design

# Name Return Description (purpose)


type

1 getAccessToken String Requests a Bearer token from the VietQR API.

2 generateQRCode String Sends a JSON payload to generate a QR and


returns the raw response.

3 checkPaymentSta String Sends a checking request to the API and


tus returns the result.

Parameter:

- requestString: Default value: “”. The JSON-formatted request body for


the API.

Exception:

- UnknownException if a connection timeout or server error occurs.

Method:

- Sets the Content-Type header to application/json. Includes the


Authorization header with the Bearer token for protected endpoints.
Uses a standard HTTP client to send the POST request and returns the
Response body.

4. Design for Entity Class "QRCode"

Description: An entity class that holds the data returned by the VietQR
generation service to be displayed on the QRCodeScreen.

Table 1. Attribute Design

#
1 Name
qrCode Data
String Default
“” Description
Raw string content of the QR
code.

2 qrLink String “” Link to the generated QR code


image.

3 bankCode String “” Receiving bank identifier.


4 bankName String “” Full name of the receiving
bank.

5 bankAccount String “” Recipient bank account


number.

6 userBankNa String “” Account holder's name.


me

7 qrType String “” The type of qr code

8 content String “” Payment description.

Table 2. Operation Design

# Name Return Description (purpose)


type

1 parseResponseStr void Maps the raw JSON response fields to the


ing class attributes.

5. Design for Entity Class "PaymentStatus"

Description: Represents the result of a transaction inquiry, identifying if the


payment is pending, successful, or expired.

Table 1. Attribute Design

# Name Data Default Description


type value

1 referenceNum String “” Transaction


ber number

2 orderID String “” Order’s


indentifier

3 type String “” Transaction’s


type

4 status String “” Transaction’s


status

5 content String “” Payment


description
Table 2. Operation Design

# Name Return Description (purpose)


type

1 parseResponseStr void Extracts status and transaction data from


ing the API check-order response.

6. Design for Entity Class "Order"

Description: Represents the result of a transaction inquiry, identifying if the


payment is pending, successful, or expired.

Table 1. Attribute Design

# Name Data Default Description


type value

1 cart Cart null The customer’s cart

2 deliveryInf DeliveryIn null Customer’s delivery info


o fo

3 invoice Invoice “” The order detail info

4 orderID String “” The order’s identifier

5 totalAmou long 0 The total amount of money need


nt to be paid

You might also like