Skip to content

Commit

Permalink
Merge pull request #13 from lotteon2/cherrypick/feature/subscription
Browse files Browse the repository at this point in the history
Cherrypick/feature/subscription
  • Loading branch information
binarywoo27 authored Dec 30, 2023
2 parents 6cd49de + 6cd8710 commit e5f4a45
Show file tree
Hide file tree
Showing 20 changed files with 235 additions and 188 deletions.
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@ dependencies {
testImplementation 'org.springframework.boot:spring-boot-starter-test'
implementation "org.springframework.cloud:spring-cloud-starter-bus-kafka"
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'io.github.lotteon-maven:blooming-blooms-utils:202312260649'
implementation 'io.github.lotteon-maven:blooming-blooms-utils:202312290714'
runtimeOnly 'com.h2database:h2'
implementation 'mysql:mysql-connector-java:8.0.33'
testImplementation 'org.mock-server:mockserver-netty:5.11.2' // 사용 중인 MockServer 버전
implementation 'org.springframework.cloud:spring-cloud-starter-openfeign'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.13.1'
}

dependencyManagement {
Expand Down
Empty file modified gradlew
100755 → 100644
Empty file.
184 changes: 92 additions & 92 deletions gradlew.bat
Original file line number Diff line number Diff line change
@@ -1,92 +1,92 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*

:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*

:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package kr.bb.payment.controller.clientcontroller;

import bloomingblooms.domain.payment.KakaopayApproveRequestDto;
import bloomingblooms.domain.payment.KakaopayReadyRequestDto;
import bloomingblooms.domain.payment.KakaopayReadyResponseDto;
import bloomingblooms.response.CommonResponse;
import java.time.LocalDateTime;
import kr.bb.payment.dto.request.KakaopayApproveRequestDto;
import kr.bb.payment.dto.request.KakaopayReadyRequestDto;
import kr.bb.payment.dto.response.KakaopayReadyResponseDto;
import kr.bb.payment.service.KakaopayService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
Expand All @@ -29,7 +29,6 @@ public CommonResponse<KakaopayReadyResponseDto> payReady(
@PostMapping("/approve")
public CommonResponse<LocalDateTime> payApprove(
@RequestBody KakaopayApproveRequestDto approveRequestDto) {

return CommonResponse.success(kakaopayService.kakaoPayApprove(approveRequestDto));
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package kr.bb.payment.dto.request;

import javax.annotation.Nullable;
import javax.validation.constraints.NotNull;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
Expand All @@ -23,4 +24,5 @@ public class KakaopayApproveRequestDto {
@NotNull private String cid;
@NotNull private String tid;
@NotNull private String pgToken;
@Nullable private Long deliveryId;
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package kr.bb.payment.dto.response;

import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.LocalDateTime;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Builder;
Expand All @@ -15,7 +16,7 @@
@Builder
@AllArgsConstructor
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class KakaoPayApproveResponseDto {
public class KakaopayApproveResponseDto {
private String aid; // 요청 고유번호
private String tid; // 결제 고유번호
private String cid; // 가맹점 코드
Expand All @@ -30,8 +31,8 @@ public class KakaoPayApproveResponseDto {
private String itemName;
private Integer quantity;
@JsonProperty("created_at")
private String createdAt;
private LocalDateTime createdAt;
@JsonProperty("approved_at")
private String approvedAt;
private LocalDateTime approvedAt;
private Amount amount;
}

This file was deleted.

3 changes: 2 additions & 1 deletion src/main/java/kr/bb/payment/entity/OrderType.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
@Getter
public enum OrderType {
ORDER_DELIVERY("주문 배송"),
ORDER_PICKUP("주문 픽업");
ORDER_PICKUP("주문 픽업"),
ORDER_SUBSCRIPTION("주문 구독");

private final String message;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/kr/bb/payment/entity/Payment.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package kr.bb.payment.entity;

import bloomingblooms.domain.payment.KakaopayApproveRequestDto;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
Expand All @@ -8,7 +9,6 @@
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import kr.bb.payment.dto.request.KakaopayApproveRequestDto;
import kr.bb.payment.entity.common.BaseEntity;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
Expand Down
21 changes: 16 additions & 5 deletions src/main/java/kr/bb/payment/entity/Subscription.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
package kr.bb.payment.entity;

import java.time.LocalDate;
import java.util.Date;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import kr.bb.payment.entity.common.BaseEntity;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@Builder
@Entity
@Table(name = "subscription")
@AllArgsConstructor(access = AccessLevel.PROTECTED)
Expand All @@ -24,6 +31,10 @@ public class Subscription extends BaseEntity {
@Column(name = "subscription_id")
private Long subscriptionId;

@Builder.Default
@OneToMany(mappedBy = "subscription", cascade = CascadeType.PERSIST, orphanRemoval = true)
private List<SubscriptionRecords> subscriptionRecordsList = new ArrayList<>();

@Column(name = "order_subscription_id", unique = true, nullable = false)
private String orderSubscriptionId;

Expand All @@ -43,11 +54,11 @@ public class Subscription extends BaseEntity {
private Long subscriptionTotalAmount;

@Column(name = "payment_date", nullable = false)
private LocalDate paymentDate;
private LocalDateTime paymentDate;

@Column(name = "start_date", nullable = false)
private LocalDate startDate;
private LocalDateTime startDate;

@Column(name = "end_date")
private LocalDate endDate;
private LocalDateTime endDate;
}
Loading

0 comments on commit e5f4a45

Please sign in to comment.