Skip to content

Commit cfdb518

Browse files
authored
Merge pull request #156 from Next-Room/feature/validate-acknowledgement
[FEAT] ๊ตฌ๋… ๊ฒฐ์ œ ์‹œ, ์ด๋ฏธ ์Šน์ธ๋œ ์ƒํ’ˆ์€ ์˜ˆ์™ธ์ฒ˜๋ฆฌ
2 parents 32b38ec + 7ea57ad commit cfdb518

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

โ€Žsrc/main/java/com/nextroom/nextRoomServer/exceptions/StatusCode.javaโ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public enum StatusCode {
1919
INVALID_FILE_NAME(HttpStatus.BAD_REQUEST, "ํŒŒ์ผ ์ด๋ฆ„์ด ์œ ํšจํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค."),
2020
ENVIRONMENT_DOES_NOT_MATCH(HttpStatus.BAD_REQUEST, "์šด์˜ ํ™˜๊ฒฝ์ด ์ผ์น˜ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค."),
2121
PACKAGE_NAME_DOES_NOT_MATCH(HttpStatus.BAD_REQUEST, "ํŒจํ‚ค์ง€๋ช…์ด ์ผ์น˜ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค."),
22+
ALREADY_ACKNOWLEDGED(HttpStatus.BAD_REQUEST, "์ด๋ฏธ ์Šน์ธ๋œ ๊ฒฐ์ œ ์ž…๋‹ˆ๋‹ค."),
2223

2324
/**
2425
* 401 Unauthorized

โ€Žsrc/main/java/com/nextroom/nextRoomServer/util/inapp/AndroidPurchaseUtils.javaโ€Ž

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
package com.nextroom.nextRoomServer.util.inapp;
22

3-
import static com.nextroom.nextRoomServer.exceptions.StatusCode.ENVIRONMENT_DOES_NOT_MATCH;
4-
import static com.nextroom.nextRoomServer.exceptions.StatusCode.INTERNAL_SERVER_ERROR;
5-
import static com.nextroom.nextRoomServer.exceptions.StatusCode.IO_ERROR;
6-
import static com.nextroom.nextRoomServer.exceptions.StatusCode.PACKAGE_NAME_DOES_NOT_MATCH;
7-
83
import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
94
import com.google.api.client.json.gson.GsonFactory;
105
import com.google.api.services.androidpublisher.AndroidPublisher;
@@ -26,6 +21,8 @@
2621
import org.springframework.core.io.ClassPathResource;
2722
import org.springframework.stereotype.Component;
2823

24+
import static com.nextroom.nextRoomServer.exceptions.StatusCode.*;
25+
2926
@Slf4j
3027
@Component
3128
public class AndroidPurchaseUtils {
@@ -75,11 +72,10 @@ public SubscriptionPurchase verifyPurchase(String purchaseToken, String subscrip
7572
public SubscriptionPurchaseV2 verifyPurchase(String purchaseToken) {
7673
SubscriptionPurchaseV2 subscriptionPurchaseV2 = getSubscriptionPurchase(purchaseToken);
7774

78-
// TODO ๊ตฌ๋งค ์ƒํ™ฉ ๊ฒ€์ฆ ํ•„์š”
79-
// ์ƒํ’ˆ ์Šน์ธ์ด ๋˜์ง€ ์•Š์€ ๊ฒฝ์šฐ
80-
// if (subscriptionPurchaseV2.getAcknowledgementState().equals("ACKNOWLEDGEMENT_STATE_ACKNOWLEDGED")) {
81-
// throw new CustomException(BAD_REQUEST);
82-
// }
75+
// ์ด๋ฏธ ์ƒํ’ˆ ์Šน์ธ์ด ๋œ ๊ฒฝ์šฐ
76+
if (subscriptionPurchaseV2.getAcknowledgementState().equals("ACKNOWLEDGEMENT_STATE_ACKNOWLEDGED")) {
77+
throw new CustomException(ALREADY_ACKNOWLEDGED);
78+
}
8379

8480
log.info("SUBSCRIPTION AT PURCHASE(V2) : {}", subscriptionPurchaseV2.toString());
8581

0 commit comments

Comments
ย (0)