Skip to content

Commit

Permalink
YEL-176 [feat] 오류 수정 및 로그 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
user 이름 committed Oct 15, 2023
1 parent c5188da commit 8263125
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public record DeveloperNotification(
) {

public ProductType getProductType() {
if (ObjectUtils.isEmpty(testNotification)) {
if (!ObjectUtils.isEmpty(testNotification)) {
return ProductType.TEST;
} else if (!ObjectUtils.isEmpty(subscriptionNotification)) {
return ProductType.YELLO_PLUS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ public void appleNotification(AppleNotificationRequest request) {

AppleNotificationPayloadVO payloadVO =
purchaseManager.decodeApplePayload(request.signedPayload());

ApplePurchaseVO purchaseData = purchaseManager.getPurchaseData(payloadVO);
purchaseRepository.findByTransactionId(purchaseData.transactionId())
.ifPresent((purchase) -> {
Expand Down Expand Up @@ -356,6 +356,7 @@ public void appleNotification(AppleNotificationRequest request) {
@Transactional
public void googleNotification(GooglePubSubNotificationRequest request) {
if (!Objects.equals(request.subscription(), googlePubSubName)) {
log.info("BAD REQUEST by wrong pub-sub name");
throw new GoogleBadRequestException(GOOGLE_NOTIFICATION_BAD_REQUEST_EXCEPTION);
}

Expand All @@ -368,8 +369,10 @@ public void googleNotification(GooglePubSubNotificationRequest request) {

final DeveloperNotification developerNotification = gson.fromJson(data, DeveloperNotification.class);
if (ObjectUtils.isEmpty(developerNotification.getProductType())) {
log.info("BAD REQUEST by wrong pub-sub name");
throw new GoogleBadRequestException(GOOGLE_NOTIFICATION_BAD_REQUEST_EXCEPTION);
}
log.info(String.format("notification product type is %s", developerNotification.getProductType().toString()));

final Optional<Purchase> purchase = purchaseRepository.findByPurchaseToken(
developerNotification.subscriptionNotification().purchaseToken());
Expand Down

0 comments on commit 8263125

Please sign in to comment.