From fa480f82d4b5d7e25ad888f249819a67184226b7 Mon Sep 17 00:00:00 2001 From: EungGu Yun Date: Sun, 8 Dec 2019 19:37:34 +0900 Subject: [PATCH] Change item registration response --- src/backend/responses/item.js | 5 ++--- src/backend/tests/item_registration.json | 6 ++++++ src/backend/utils/builder.js | 9 +++++---- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/backend/responses/item.js b/src/backend/responses/item.js index cf4aa86..7243b2e 100644 --- a/src/backend/responses/item.js +++ b/src/backend/responses/item.js @@ -3,15 +3,14 @@ const builder = require("../utils/builder"); const resource = require("../utils/resource"); -module.exports.itemRegistrationSuccess = (itemName, itemDetail, itemPrice, imageUrl, nickname) => { +module.exports.itemRegistrationSuccess = (itemName, itemDetail, itemPrice, imageUrl) => { // Construct registration guide const resultThumbnail = builder.getThumbnail(imageUrl); const resultTitle = itemName; const resultDescription = itemDetail; const resultPrice = itemPrice; - const resultNickname = nickname; const resultMainMenuButton = builder.getButton("처음으로", "block", "처음으로", resource.welcomeBlockId); - const resultCard = builder.getCommerceCard(resultTitle, resultDescription, resultPrice, resultThumbnail, result, [resultMainMenuButton]); + const resultCard = builder.getCommerceCard(resultTitle, resultDescription, resultPrice, resultThumbnail, null, [resultMainMenuButton]); // Build response return builder.buildResponse([resultCard]); diff --git a/src/backend/tests/item_registration.json b/src/backend/tests/item_registration.json index 0314756..504ca45 100644 --- a/src/backend/tests/item_registration.json +++ b/src/backend/tests/item_registration.json @@ -40,6 +40,7 @@ "name": "스킬 테스트", "clientExtra": {}, "params": { + "item_category": "전자기기", "item_name": "어어", "item_price": "{\"amount\": 10000, \"unit\": \"원\"}", "item_detail": "처음으로", @@ -47,6 +48,11 @@ }, "id": "5dda19bf8192ac00011a2918", "detailParams": { + "item_category": { + "origin": "전자기기", + "value": "전자기기", + "groupName": "" + }, "item_name": { "origin": "상품의 이름", "value": "상품의 이름", diff --git a/src/backend/utils/builder.js b/src/backend/utils/builder.js index 76479ef..271fc6f 100644 --- a/src/backend/utils/builder.js +++ b/src/backend/utils/builder.js @@ -119,18 +119,19 @@ const getCarousel = (type, cards) => { } const getCommerceCard = (title, description, price, thumbnail, nickname, buttons=[]) => { - return { + const card = { commerceCard: { description: title + "\n" + description, price: price, currency: "won", thumbnails: [ thumbnail ], - profile: { - nickname: nickname - }, buttons: buttons } }; + if (nickname != null) { + card["profile"] = { nickname: nickname } + } + return card; } module.exports = {