export enum BoostUpResultType {
WIN = 'win',
MISS = 'miss',
JACKPOT = 'jackpot',
}
export enum BoostUpMomentType {
BEFORE_BUY_BOOST = 'before_buy_boost',
AFTER_BUY_BOOST = 'after_buy_boost',
MANUAL_USE_BOOST = 'manual_use_boost',
}
TypeScript
복사
export interface IBoostUpResultsResponse {
userId: string;
campaignId: number;
boostId?: number;
moment: BoostUpMomentType;
total: IBoostUpTotalResponse;
boostUpResults: IBoostUpResult[];
}
export interface IBoostUpResult {
order: number;
executed: boolean;
message: string;
messageDetail: string;
boostUp?: IBoostUpResponse; // executed == false인 경우 boostUp은 존재하지 않는다.
}
export interface IBoostUpTotalResponse {
totalBoostUpCount: number;
totalCashbackAmount: number;
totalDiscountRate: number;
highestResult?: IBoostUpHighestResult; // totalBoostUpCount == 0인 경우 존재 X
}
export interface IBoostUpHighestResult {
result: BoostUpResultType;
level: number;
}
export interface IBoostUpResponse {
id: number;
resultType: BoostUpResultType;
moment: BoostUpMomentType;
campaignId: number;
boostUpPolicyId: number;
boostId: number | null;
boltPrice: number;
cashbackAmount: number;
discountRate: number;
status: BoostUpStatus;
createdAt: Date;
updatedAt: Date;
animationLevel: number;
}
풀어 쓰면 아래와 같다
{
userId: string;
campaignId: number;
boostId?: number; // 부스트 구매 전 강화의 경우는 존재하지 않는다.
moment: BoostUpMomentType;
total: {
totalBoostUpCount: number; // 유저가 강화를 총 몇 번 시도했는지
totalCashbackAmount: number; // 유저가 강화를 통해 '추가로' 얻은 할인 금액
totalDiscountRate: number; // 유저가 강화를 통해 '추가로' 얻은 할인률
highestResult: {
result: BoostUpResultType;
level: number;
}
boostUpResults: [
{
order: number;
executed: boolean;
message: string;
messageDetail: string;
boostUp?: { // executed == false인 경우 boostUp은 존재하지 않는다.
id: number;
resultType: BoostUpResultType;
moment: BoostUpMomentType;
campaignId: number;
boostUpPolicyId: number;
boostId: number | null;
boltPrice: number;
cashbackAmount: number;
discountRate: number;
status: BoostUpStatus;
createdAt: Date;
updatedAt: Date;
animationLevel: number;
}
},
...
]
}
TypeScript
복사
예시
{
"userId": "1e1e75d8-a837-4c40-86cf-72f53c7424f8",
"campaignId": 249,
"moment": "before_buy_boost",
"total": {
"totalBoostUpCount": 22,
"totalCashbackAmount": 2080,
"totalDiscountRate": 57,
"benetifDescription":"string..."
"highestResult": {
"result": "win",
"level": 2
}
},
"boostUpResults": [
{
"order": 1,
"boostUp": {
"id": 253,
"moment": "before_buy_boost",
"campaignId": 249,
"boostId": null,
"boostUpPolicyId": 4,
"resultType": "win",
"boltPrice": 1,
"cashbackAmount": 70,
"discountRate": 2,
"status": "enabled",
"createdAt": "2022-01-10T08:59:46.613Z",
"updatedAt": "2022-01-10T08:59:46.613Z",
"animationLevel": 1
},
"executed": true,
"message": "강화가 성공적으로 수행되었습니다.",
"messageDetail": ""
},
{
"order": 2,
"boostUp": {
"id": 254,
"moment": "before_buy_boost",
"campaignId": 249,
"boostId": null,
"boostUpPolicyId": 4,
"resultType": "win",
"boltPrice": 1,
"cashbackAmount": 80,
"discountRate": 2,
"status": "enabled",
"createdAt": "2022-01-10T08:59:46.700Z",
"updatedAt": "2022-01-10T08:59:46.700Z",
"animationLevel": 1
},
"executed": true,
"message": "강화가 성공적으로 수행되었습니다.",
"messageDetail": ""
}
]
}
JSON
복사
message와 messageDetail 예시
(1) 강화 예산 한도 초과한 경우
{
"order": 1,
"executed": false, // 강화 수행 실패했으므로, boostUp 존재X
"message": "강화 예산 한도를 넘었습니다.",
"messageDetail": "already_exceeded"
}
JSON
복사
(2) 강화 예산 체크 및 예산 소모 중 에러 발생한 경우
{
"order": 1,
"executed": false,
"message": "강화 예산 체크 및 예산 소모 중 에러 발생",
"messageDetail": "DB_err_message 들어감"
}
JSON
복사
(3) BoostUp을 DB에 저장하는 도중에 에러 발생한 경우
{
"order": 1,
"executed": false,
"message": "BoostUp을 DB에 저장하는 도중에 에러발생",
"messageDetail": "DB_err_message 들어감"
}
JSON
복사
(4) bolt-server와 통신 중 에러 발생한 경우
{
"order": 1,
"executed": false,
"message": "POST {bolt-server}/use 도중에 에러발생",
"messageDetail": "오류가 발생했습니다. 번개 개수가 1개 부족합니다. (B001) (S201)"
}
JSON
복사
(5) 강화 수행에 성공한 경우
{
"order": 1,
"executed": true,
"message": "강화가 성공적으로 수행되었습니다.",
"messageDetail": "", // (빈 문자열)
"boostUp": {
"id": 250,
"moment": "before_buy_boost",
"campaignId": 249,
"boostId": null,
"boostUpPolicyId": 4,
"resultType": "win",
"boltPrice": 1,
"cashbackAmount": 70,
"discountRate": 2,
"status": "enabled",
"createdAt": "2022-01-10T07:42:47.999Z",
"updatedAt": "2022-01-10T07:42:47.999Z",
"animationLevel": 1
},
}
JSON
복사