processing timestamp
grace timestamp
# Advice testing in GMPay
## A list of failfast and processed rejections
### failFast:
Any one of the advices in the batch has wrong format, the whole batch would be errored
**Response: 400 Bad Request**
#### Cases:
* Request body is NOT an array of object
* Invalid value:
* Empty value to relatied advice id field:
```json
[{
"relatedAdviceId": ""
...
}]
```
* Not allowed values:
```json
[{
"adviceType": "OnlyAllowedOaOrEa"
...
}]
```
* Wrong format of value:
```json
[{
"ccyPair": "USDCNH"
...
}]
```
* Missing any following required fields.
```json
[{
"adviceId": ...,
"adviceType": ...,
"ccyPair": ...,
"transactionCcy": ...,
"transactionCcyType": ...,
"transactionType": ...,
"transactionTimestamp": ...,
"amount": ...
}]
```
* Duplicated advice ids in whole batch
```json
[
{
"adviceId": "advice1",
"amount": 123
...
},
{
"adviceId": "advice1"
"amount": 456
...
}
]
```
### Processed Rejection:
Passed format validation, i.e no failFast error, but having some issues while processing the advices. Client could get the error message by using API.
```json
GET /api/v2/advices?batchId={{your_batch_id}}
{
"message": "Successful",
"advices": [
{
"errorReason": "...",
"errorCode": "...",
...
}
]
}
```
#### Cases:
* Send advice with currency pair which not be set
* Example:
```json
Use USD/JPY without setting it:
[{
"ccyPair": "USD/JPY",
...
}]
```
* Status:
```json
{
"errorReason": "Field validation against static data failed",
"errorCode": 2000
...
}
```
* Use duplicated advice id
* Example:
```json
POST first EA:
[{
"adviceId": "adviceId1"
...
}]
POST second EA after a while with first EA id:
[{
"adviceId": "adviceId1"
...
}]
```
* Status:
```json
"advices": [{
"errorReason": "Advice Id is duplicated in the system",
"errorCode": 2002
...
}]
```
* Transaction time is in the future
**Noted: Time zone is UTC.**
* Example:
```json
[{
"transactionTimestamp": "2020-12-31T23:59:59.1000Z"
...
}]
```
* Status:
```json
"advices": [{
"errorReason": "Transaction time is in the future",
"errorCode": 3415,
...
}]
```
* Use expired Pricing Sheet:
* Example:
```json
[{
"requestedPricingRefId": "expired_pricing_sheet_ref_id",
...
}]
```
* Status:
```json
"advices": [{
"errorReason": "transaction is outside pricing sheet active period",
"errorCode": 3410,
...
}]
```
* Use unexisted OA id while sending EA
* Example:
```json
{
"adviceType": "EA",
"relatedAdviceId": "unexisted_oa_id",
}
```
* Status:
```json
"advices": [{
"errorReason": "Related advice is not found",
"errorCode": 5011,
...
}]
```
* Advice's fields do not match related advice's fields
---
### Scenarios of value date
#### Scenario 1:
* settlement days: 5
* cutoff time: 17:00 SGT
* consider weekend as holiday: true
* transaction time: 2020-05-28 (Thu) 09:46 SGT
```
settlement days: 5
before cutoff time -> +0 (no extra day)
holidays (weekend) -> +2
-----------------------------------------
final settlement days: 5+0+2 = 7
```
**Value Date: 2020-06-04 (Thu)**
#### Scenario 2:
* settlement days: 2
* cutoff time: 15:00 SGT
* consider weekend as holiday: true
* transaction time: 2020-05-27 (Thu) 16:00 SGT
```
settlement days: 2
after cutoff time -> +1 (extra day)
holidays (weekend) -> +2
-----------------------------------------
final settlement days: 2+1+2 = 5
```
**Value Date: 2020-06-02 (Tue)**