generated from pricelees/issue-pr-template
[#34] 회원 / 인증 도메인 재정의 #43
@ -44,7 +44,7 @@ class PaymentService(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun cancel(memberId: Long, request: PaymentCancelRequest) {
|
fun cancel(userId: Long, request: PaymentCancelRequest) {
|
||||||
val payment: PaymentEntity = findByReservationIdOrThrow(request.reservationId)
|
val payment: PaymentEntity = findByReservationIdOrThrow(request.reservationId)
|
||||||
|
|
||||||
val clientCancelResponse: PaymentClientCancelResponse = paymentClient.cancel(
|
val clientCancelResponse: PaymentClientCancelResponse = paymentClient.cancel(
|
||||||
@ -55,7 +55,7 @@ class PaymentService(
|
|||||||
|
|
||||||
transactionExecutionUtil.withNewTransaction(isReadOnly = false) {
|
transactionExecutionUtil.withNewTransaction(isReadOnly = false) {
|
||||||
paymentWriter.cancel(
|
paymentWriter.cancel(
|
||||||
memberId = memberId,
|
userId = userId,
|
||||||
payment = payment,
|
payment = payment,
|
||||||
requestedAt = request.requestedAt,
|
requestedAt = request.requestedAt,
|
||||||
cancelResponse = clientCancelResponse
|
cancelResponse = clientCancelResponse
|
||||||
|
|||||||
@ -59,7 +59,7 @@ class PaymentWriter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun cancel(
|
fun cancel(
|
||||||
memberId: Long,
|
userId: Long,
|
||||||
payment: PaymentEntity,
|
payment: PaymentEntity,
|
||||||
requestedAt: LocalDateTime,
|
requestedAt: LocalDateTime,
|
||||||
cancelResponse: PaymentClientCancelResponse
|
cancelResponse: PaymentClientCancelResponse
|
||||||
@ -72,7 +72,7 @@ class PaymentWriter(
|
|||||||
id = tsidFactory.next(),
|
id = tsidFactory.next(),
|
||||||
paymentId = payment.id,
|
paymentId = payment.id,
|
||||||
cancelRequestedAt = requestedAt,
|
cancelRequestedAt = requestedAt,
|
||||||
canceledBy = memberId
|
canceledBy = userId
|
||||||
).also {
|
).also {
|
||||||
canceledPaymentRepository.save(it)
|
canceledPaymentRepository.save(it)
|
||||||
log.debug { "[PaymentWriterV2.cancelPayment] 결제 취소 정보 저장 완료: payment.id=${payment.id}" }
|
log.debug { "[PaymentWriterV2.cancelPayment] 결제 취소 정보 저장 완료: payment.id=${payment.id}" }
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import roomescape.common.entity.AuditingBaseEntity
|
|||||||
class ReservationEntity(
|
class ReservationEntity(
|
||||||
id: Long,
|
id: Long,
|
||||||
|
|
||||||
val memberId: Long,
|
val userId: Long,
|
||||||
val scheduleId: Long,
|
val scheduleId: Long,
|
||||||
val reserverName: String,
|
val reserverName: String,
|
||||||
val reserverContact: String,
|
val reserverContact: String,
|
||||||
|
|||||||
@ -4,5 +4,5 @@ import org.springframework.data.jpa.repository.JpaRepository
|
|||||||
|
|
||||||
interface ReservationRepository : JpaRepository<ReservationEntity, Long> {
|
interface ReservationRepository : JpaRepository<ReservationEntity, Long> {
|
||||||
|
|
||||||
fun findAllByMemberId(memberId: Long): List<ReservationEntity>
|
fun findAllByUserId(userId: Long): List<ReservationEntity>
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,9 +19,9 @@ data class PendingReservationCreateRequest(
|
|||||||
val requirement: String
|
val requirement: String
|
||||||
)
|
)
|
||||||
|
|
||||||
fun PendingReservationCreateRequest.toEntity(id: Long, memberId: Long) = ReservationEntity(
|
fun PendingReservationCreateRequest.toEntity(id: Long, userId: Long) = ReservationEntity(
|
||||||
id = id,
|
id = id,
|
||||||
memberId = memberId,
|
userId = userId,
|
||||||
scheduleId = this.scheduleId,
|
scheduleId = this.scheduleId,
|
||||||
reserverName = this.reserverName,
|
reserverName = this.reserverName,
|
||||||
reserverContact = this.reserverContact,
|
reserverContact = this.reserverContact,
|
||||||
|
|||||||
@ -108,7 +108,7 @@ create table if not exists schedule (
|
|||||||
|
|
||||||
create table if not exists reservation (
|
create table if not exists reservation (
|
||||||
id bigint primary key,
|
id bigint primary key,
|
||||||
member_id bigint not null,
|
user_id bigint not null,
|
||||||
schedule_id bigint not null,
|
schedule_id bigint not null,
|
||||||
reserver_name varchar(30) not null,
|
reserver_name varchar(30) not null,
|
||||||
reserver_contact varchar(30) not null,
|
reserver_contact varchar(30) not null,
|
||||||
@ -120,7 +120,7 @@ create table if not exists reservation (
|
|||||||
updated_at timestamp not null,
|
updated_at timestamp not null,
|
||||||
updated_by bigint not null,
|
updated_by bigint not null,
|
||||||
|
|
||||||
constraint fk_reservation__member_id foreign key (member_id) references members (member_id),
|
constraint fk_reservation__user_id foreign key (user_id) references users (id),
|
||||||
constraint fk_reservation__schedule_id foreign key (schedule_id) references schedule (id)
|
constraint fk_reservation__schedule_id foreign key (schedule_id) references schedule (id)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -133,8 +133,7 @@ create table if not exists canceled_reservation (
|
|||||||
status varchar(30) not null,
|
status varchar(30) not null,
|
||||||
|
|
||||||
constraint uk_canceled_reservations__reservation_id unique (reservation_id),
|
constraint uk_canceled_reservations__reservation_id unique (reservation_id),
|
||||||
constraint fk_canceled_reservations__reservation_id foreign key (reservation_id) references reservation (id),
|
constraint fk_canceled_reservations__reservation_id foreign key (reservation_id) references reservation (id)
|
||||||
constraint fk_canceled_reservations__canceled_by foreign key (canceled_by) references members (member_id)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
create table if not exists payment (
|
create table if not exists payment (
|
||||||
@ -208,6 +207,5 @@ create table if not exists canceled_payment(
|
|||||||
easypay_discount_amount integer not null,
|
easypay_discount_amount integer not null,
|
||||||
|
|
||||||
constraint uk_canceled_payment__paymentId unique (payment_id),
|
constraint uk_canceled_payment__paymentId unique (payment_id),
|
||||||
constraint fk_canceled_payment__paymentId foreign key (payment_id) references payment(id),
|
constraint fk_canceled_payment__paymentId foreign key (payment_id) references payment(id)
|
||||||
constraint fk_canceled_payment__canceledBy foreign key (canceled_by) references members(member_id)
|
|
||||||
);
|
);
|
||||||
|
|||||||
@ -184,7 +184,7 @@ class DummyInitializer(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun cancelPayment(
|
fun cancelPayment(
|
||||||
memberId: Long,
|
userId: Long,
|
||||||
reservationId: Long,
|
reservationId: Long,
|
||||||
cancelReason: String,
|
cancelReason: String,
|
||||||
): CanceledPaymentEntity {
|
): CanceledPaymentEntity {
|
||||||
@ -197,7 +197,7 @@ class DummyInitializer(
|
|||||||
)
|
)
|
||||||
|
|
||||||
return paymentWriter.cancel(
|
return paymentWriter.cancel(
|
||||||
memberId,
|
userId,
|
||||||
payment,
|
payment,
|
||||||
requestedAt = LocalDateTime.now(),
|
requestedAt = LocalDateTime.now(),
|
||||||
clientCancelResponse
|
clientCancelResponse
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user