# SOU Public Offering Server Test
## Endpoint
- POST /api/po/:id/application
- Positive test:
- request:
- header:
-
- parameter:
- id: <Integer>
- body:
-
- response:
- status code: 200
- response
- header:
- body:
- id: <Integer>
- offering_uuid: <UUID_v4>
-
- Negative test:
- Valid input:
- request:
- response:
- status code:
- Invalid input:
-
- Bad request
- `id` is not a number
- `owner_id` is invalid
- `public_offering_uuid` is invalid
- `is_canceled` is invalid
- `amount` is invalid
- `created_date` is invalid
- Internal server error
- GET /api/po/:id/detail
- Valid Case
- Not found
- Request with invalid product id
- Internal server error
- GET /api/po/:id/info
- Valid Case
- Not found
- Request with invalid product id
- Internal server error
- GET /api/po/:id/receipt
- Valid Case
- Not found
- Request with invalid product id
- Internal server error
## Application
### Controller
- PoController
- getPoDetail(ctx, _next)
- Case 1: Valid case
- Case 2: poDetailEntity === null
- getPoInfo(ctx, _next)
- Case 1: Valid case
- Case 2: poInfoEntity === null
- poApply(ctx, _next)
- Case 1: Valid case
- Case 2: result instanceof PaymentRequiredError
- Case 3: result === null
- getPoReceipt(ctx, _next)
- Case 1: Valid case
- Case 2: poReceiptEntity === null
## Domain
- cashWallet
- isEnoughBalanceToApply(priceEntity)
- priceEntity.value <= this.balance.value
- poApplicationHistory
- poDetail
- poInfo
- poReceipt
- price
- volume
## Persistence
### Repositories
- poApplicationHistory.js
- poApply(public_offering_id, owner_id, amount)
- Create an entity from the user requested amount
- requestedVolumeEntity.isValid === false
- requiredVolumeEntity.isValid === false
- Create owner balance from cash wallet
- ownerBalanceEntity.isValid === false
- cashWalletEntity.isValid === false
- Create poApplicationHistoryEntity via `PoApplicationHistoryDataFactory.create()` to database
- poApplicationHistoryEntity.isValid === false
- poApplicationHistoryDataFactory.js
- create(public_offering_id, owner_id, requestedVolumeEntity, t)
- requestedVolumeEntity instanceof Volume) === false
- publicOffering.js
- getPoInfo(public_offering_id)
- Get instance from a database to create `PoInfo`
- typeof instance === "undefined"
- Create `PoInfo` entity from the instance
- poInfoEntity.isValid === false
- getPoDetail(public_offering_id)
- Get instance from a database to create `PoDetail` entity
- instance === null
- Create `PoDetail` entity from the instance
- poDetailEntity.isValid === false
### DAO
- account
- addProperty(data) -> error / non-error
- admin
- addProperty(data) -> error / non-error
- agreement
- addProperty(data) -> error / non-error
- building
- addProperty(data) -> error / non-error
- buildingDetail
- addProperty(data) -> error / non-error
- buidlingDocument
- addProperty(data) -> error / non-error
- buildingPicture
- addProperty(data) -> error / non-error
- cashWallet
- addPublicOfferingApplication(applicationData)
- valid case
- amount, public_offering_id, owner_id, public_offering_uuid
- invalid case
- Cash wallet not found
- Public offering data not found
- Insufficient balance
- department
- addProperty(data) -> error / non-error
- deposit
- addProperty(data) -> error / non-error
- device
- addProperty(data) -> error / non-error
- dictionary
- addProperty(data) -> error / non-error
- dictionaryRequest
- addProperty(data) -> error / non-error
- duty
- addProperty(data) -> error / non-error
- email
- addProperty(data) -> error / non-error
- event
- addProperty(data) -> error / non-error
- eventApplication
- addProperty(data) -> error / non-error
- eventImage
- addProperty(data) -> error / non-error
- faq
- addProperty(data) -> error / non-error
- feedback
- addProperty(data) -> error / non-error
- feedbackAnswer
- addProperty(data) -> error / non-error
- income
- investmentQualification
- addProperty(data) -> error / non-error
- investmentQualificationDocument
- addProperty(data) -> error / non-error
- investmentQualificationRequest
- addProperty(data) -> error / non-error
- loginHistory
- addProperty(data) -> error / non-error
- news
- addProperty(data) -> error / non-error
- notice
- addProperty(data) -> error / non-error
- noticeImage
- addProperty(data) -> error / non-error
- notificationConfiguration
- addProperty(data) -> error / non-error
- orders
- owner
- addProperty(data) -> error / non-error
- penalty
- addProperty(data) -> error / non-error
- permission
- addProperty(data) -> error / non-error
- permissionAssign
- addProperty(data) -> error / non-error
- permissionRequest
- addProperty(data) -> error / non-error
- policy
- addProperty(data) -> error / non-error
- preset
- addProperty(data) -> error / non-error
- presetPermission
- addProperty(data) -> error / non-error
- product
- addProperty(data) -> error / non-error
- productWallet
- addProperty(data) -> error / non-error
- profile
- addProperty(data) -> error / non-error
- publicOffering
- getExpectedTotalOfferingPrice(public_offering_id, requested_volume)
- getDetailById(id, uuid)
- getPoInfoById(id, uuid)
- getPoReceiptByIdWithOwnerId(id, uuid, owner_id)
- publicOfferingApplicationHistory
- add(poApplicationHistoryData, transaction) -> error / non- error
- publicOfferingDetail
- addProperty(data) -> error / non-error
- publicOfferingPurchaseHistory
- addProperty(data) -> error / non-error
- push
- addProperty(data) -> error / non-error
- reward
- addProperty(data) -> error / non-error
- sentEmail
- addProperty(data) -> error / non-error
- sentPush
- addProperty(data) -> error / non-error
- sentSms
- addProperty(data) -> error / non-error
- sms
- addProperty(data) -> error / non-error
- store
- addProperty(data) -> error / non-error
- storePicture
- addProperty(data) -> error / non-error
- systemConfiguration
- addProperty(data) -> error / non-error
- trade
- walletHistory
- withdrawal
- addProperty(data) -> error / non-error