Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/254 선물하기 flow #258

Merged
merged 44 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
9b9072b
feat : 메인 버튼 컴포넌트에 옵션 추가
HamBP Jun 10, 2024
82ac0a4
feat : 선물하기 버튼 추가
HamBP Jun 10, 2024
7582bf7
refactor : 선물하기, 예매하기 버튼 묶음 프리뷰 추가
HamBP Jun 10, 2024
162ec4e
feat : 티켓 바텀시트 띄울 때 예매/선물 구분
HamBP Jun 14, 2024
68851de
feat : GiftScreen 틀 만들기
HamBP Jun 14, 2024
6b535c6
feat : GiftScreen 내비게이션 연결
HamBP Jun 14, 2024
12360a2
feat : [선물하기] 주문내용 확인, 사업자 정보 및 결제 안내 UI 추가
HamBP Jun 16, 2024
4a0437d
feat : [선물하기] 티켓 정보, 환불 규정 UI
HamBP Jun 16, 2024
f5ff7bd
feat : [선물하기] 보내는 분, 받는 분 정보 입력 UI
HamBP Jun 16, 2024
ab730f6
feat : [선물하기] 카드 선택 UI 컴포넌트 추가
HamBP Jun 16, 2024
b94728d
feat : [선물하기] 티켓 정보 노출
HamBP Jun 17, 2024
e91414b
feat : [선물하기] 선물하기 시 초청 티켓은 미노출
HamBP Jun 17, 2024
3faf24f
feat : [선물하기] 예매하기 -> 선물하기 버튼 텍스트 변경
HamBP Jun 17, 2024
b7fc472
feat : [선물하기] 메시지, 송&수신자 정보 입력
HamBP Jun 17, 2024
4f35a5b
feat : [선물하기] 카드 선택
HamBP Jun 17, 2024
1ad4e8c
feat : [선물하기] 받는 분 안내 추가
HamBP Jun 17, 2024
8c42b3d
fix : [선물하기] 공연 및 티켓 정보 UI 수정
HamBP Jun 17, 2024
2f59c89
feat : [선물하기] 사업자 정보 페이지 연결
HamBP Jun 17, 2024
1cc0d0d
fix : [선물하기] 버튼 활성화 및 버튼 UI 수정
HamBP Jun 17, 2024
5f42848
feat : [선물하기] 결제 정보 확인 팝업
HamBP Jun 17, 2024
2091c14
refactor : 이름 변경 getOrderId -> requestOrderId
HamBP Jun 17, 2024
fb51a54
feat : [선물하기] 바텀시트에서 결제하기 클릭시 결제 event 생성
HamBP Jun 21, 2024
dde16e7
feat : [선물하기] 결제 화면으로 이동
HamBP Jun 22, 2024
44644c9
feat : [선물하기] 결제 정보 구분
HamBP Jun 22, 2024
1cddfaa
feat : [선물하기] api, data source 정의
HamBP Jun 23, 2024
92e729e
refactor : 안 쓰는 model 삭제
HamBP Jun 23, 2024
ee90b98
feat : [선물하기] giftRepository 구현
HamBP Jun 23, 2024
943e5f7
feat : [선물하기] gift 관련 컴포넌트 의존성 주입
HamBP Jun 23, 2024
978eb6b
feat : [선물하기] 결제 완료시 선물하기 api 호출
HamBP Jun 23, 2024
04bceed
feat : [선물하기] 결제 완료 시 완료 페이지로 이동
HamBP Jun 23, 2024
b93454c
feat : [선물하기] 선물 완료 페이지 약관까지 UI 작업
HamBP Jun 23, 2024
b1fee01
feat : [선물하기] 결제 완료 페이지에 결제 정보 연동
HamBP Jun 23, 2024
63626ed
feat : [선물하기] 결제 완료 페이지에 선물 정보 연동
HamBP Jun 23, 2024
c482abf
feat : [선물하기] 결제 실패 시 팝업 띄우기
HamBP Jun 24, 2024
73899af
feat : [선물하기] 카드 이미지 선택 서버 연결
HamBP Jun 24, 2024
9e953b7
refactor : [선물하기] 상수를 뷰모델에서도 쓸 수 있도록 변경하기
HamBP Jun 24, 2024
a6a9962
refactor : [페이먼츠] 상태 캡슐화
HamBP Jun 24, 2024
948e70f
feat : [선물하기] 뒤로가기 구현
HamBP Jun 25, 2024
df41d8d
fix : [선물하기] 사용성을 위해 TextField 터치 영역 개선
HamBP Jun 25, 2024
8d55baa
fix : [선물하기] 연락처 입력 후에는 한 번 쉬세요
HamBP Jun 25, 2024
6c16aad
refactor : 오타 수정
HamBP Jul 15, 2024
12f82a9
refactor : 카카오 색깔 추출
HamBP Jul 15, 2024
cbc2a21
fix : gift가 null일 경우 받는 분 출력 X
HamBP Jul 15, 2024
747adba
Merge remote-tracking branch 'origin/develop' into feature/254
HamBP Jul 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.nexters.boolti.data.datasource

import com.nexters.boolti.data.network.api.GiftService
import com.nexters.boolti.data.network.request.GiftReceiveRequest
import com.nexters.boolti.data.network.response.ApproveGiftPaymentResponse
import com.nexters.boolti.data.network.response.GiftResponse
import com.nexters.boolti.data.network.response.ImageResponse
import com.nexters.boolti.domain.request.GiftApproveRequest
import javax.inject.Inject

internal class GiftDataSource @Inject constructor(
private val service: GiftService
) {
suspend fun receiverGift(request: GiftReceiveRequest): Boolean = service.receiveGift(request)
HamBP marked this conversation as resolved.
Show resolved Hide resolved

suspend fun approveGiftPayment(request: GiftApproveRequest): ApproveGiftPaymentResponse =
service.approveGiftPayment(request)

suspend fun getGift(giftId: String): GiftResponse = service.getGift(giftId)

suspend fun getGiftImages(): List<ImageResponse> = service.getGiftImages()
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.nexters.boolti.data.network.AuthAuthenticator
import com.nexters.boolti.data.datasource.AuthDataSource
import com.nexters.boolti.data.network.AuthInterceptor
import com.nexters.boolti.data.network.api.DeviceTokenService
import com.nexters.boolti.data.network.api.GiftService
import com.nexters.boolti.data.network.api.HostService
import com.nexters.boolti.data.network.api.ReservationService
import com.nexters.boolti.data.network.api.ShowService
Expand Down Expand Up @@ -95,6 +96,10 @@ internal object NetworkModule {
@Provides
fun provideTicketingService(@Named("auth") retrofit: Retrofit): TicketingService = retrofit.create()

@Singleton
@Provides
fun provideGiftService(@Named("auth") retrofit: Retrofit): GiftService = retrofit.create()

@Singleton
@Provides
fun provideTicketService(@Named("auth") retrofit: Retrofit): TicketService = retrofit.create()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ package com.nexters.boolti.data.di
import com.nexters.boolti.data.repository.TicketingRepositoryImpl
import com.nexters.boolti.data.repository.AuthRepositoryImpl
import com.nexters.boolti.data.repository.ConfigRepositoryImpl
import com.nexters.boolti.data.repository.GiftRepositoryImpl
import com.nexters.boolti.data.repository.ReservationRepositoryImpl
import com.nexters.boolti.data.repository.HostRepositoryImpl
import com.nexters.boolti.data.repository.ShowRepositoryImpl
import com.nexters.boolti.data.repository.TicketRepositoryImpl
import com.nexters.boolti.domain.repository.AuthRepository
import com.nexters.boolti.domain.repository.ConfigRepository
import com.nexters.boolti.domain.repository.GiftRepository
import com.nexters.boolti.domain.repository.ReservationRepository
import com.nexters.boolti.domain.repository.HostRepository
import com.nexters.boolti.domain.repository.ShowRepository
Expand All @@ -34,6 +36,9 @@ internal abstract class RepositoryModule {
@Binds
abstract fun bindTicketingRepository(repository: TicketingRepositoryImpl): TicketingRepository

@Binds
abstract fun bindGiftRepository(repository: GiftRepositoryImpl): GiftRepository

@Binds
abstract fun bindTicketRepository(repository: TicketRepositoryImpl): TicketRepository

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.nexters.boolti.data.network.api

import com.nexters.boolti.data.network.request.GiftReceiveRequest
import com.nexters.boolti.data.network.response.ApproveGiftPaymentResponse
import com.nexters.boolti.data.network.response.GiftResponse
import com.nexters.boolti.data.network.response.ImageResponse
import com.nexters.boolti.domain.request.GiftApproveRequest
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Path

internal interface GiftService {
@POST("/app/api/v1/order/receive-gift")
suspend fun receiveGift(@Body request: GiftReceiveRequest): Boolean

@POST("/app/api/v1/order/gift-approve-payment")
suspend fun approveGiftPayment(@Body request: GiftApproveRequest): ApproveGiftPaymentResponse

@GET("/app/api/v1/gift/{giftId}")
suspend fun getGift(@Path("giftId") giftId: String): GiftResponse

@GET("/app/api/v1/gift/img-list")
suspend fun getGiftImages(): List<ImageResponse>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.nexters.boolti.data.network.request

data class GiftReceiveRequest(
val giftId: String,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.nexters.boolti.data.network.response

import com.nexters.boolti.domain.model.ApproveGiftPayment
import kotlinx.serialization.Serializable

@Serializable
data class ApproveGiftPaymentResponse(
val orderId: String,
val reservationId: String,
val giftId: String,
) {
fun toDomain(): ApproveGiftPayment {
return ApproveGiftPayment(
orderId = orderId,
reservationId = reservationId,
giftId = giftId
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.nexters.boolti.data.network.response

import com.nexters.boolti.domain.model.Gift
import kotlinx.serialization.Serializable

@Serializable
data class GiftResponse(
val id: String,
val orderId: String,
val reservationId: String,
val giftImgId: String,
val message: String,
val senderName: String,
val senderPhoneNumber: String,
val recipientName: String,
val recipientPhoneNumber: String,
val isDone: Boolean,
) {
fun toDomain(): Gift {
return Gift(
id = id,
orderId = orderId,
reservationId = reservationId,
giftImgId = giftImgId,
message = message,
senderName = senderName,
senderPhoneNumber = senderPhoneNumber,
recipientName = recipientName,
recipientPhoneNumber = recipientPhoneNumber,
isDone = isDone,
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.nexters.boolti.data.repository

import com.nexters.boolti.data.datasource.GiftDataSource
import com.nexters.boolti.data.network.request.GiftReceiveRequest
import com.nexters.boolti.data.network.response.toDomains
import com.nexters.boolti.domain.model.ApproveGiftPayment
import com.nexters.boolti.domain.model.Gift
import com.nexters.boolti.domain.model.ImagePair
import com.nexters.boolti.domain.repository.GiftRepository
import com.nexters.boolti.domain.request.GiftApproveRequest
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
import javax.inject.Inject

internal class GiftRepositoryImpl @Inject constructor(
private val dataSource: GiftDataSource
) : GiftRepository {
override fun receiverGift(giftId: String): Flow<Boolean> = flow {
emit(dataSource.receiverGift(GiftReceiveRequest(giftId)))
}

override fun approveGiftPayment(request: GiftApproveRequest): Flow<ApproveGiftPayment> = flow {
emit(dataSource.approveGiftPayment(request).toDomain())
}

override fun getGift(giftId: String): Flow<Gift> = flow {
emit(dataSource.getGift(giftId).toDomain())
}

override fun getGiftImages(): Flow<List<ImagePair>> = flow {
emit(dataSource.getGiftImages().toDomains())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ internal class TicketingRepositoryImpl @Inject constructor(
emit(reservationDataSource.findReservationById(reservationId).toDomain())
}

override fun getOrderId(request: OrderIdRequest): Flow<String> = flow {
override fun requestOrderId(request: OrderIdRequest): Flow<String> = flow {
emit(dataSource.requestOrderId(request))
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.nexters.boolti.domain.model

data class ApproveGiftPayment(
val orderId: String,
val reservationId: String,
val giftId: String,
)
14 changes: 14 additions & 0 deletions domain/src/main/java/com/nexters/boolti/domain/model/Gift.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.nexters.boolti.domain.model

data class Gift(
val id: String,
val orderId: String,
val reservationId: String,
val giftImgId: String,
val message: String,
val senderName: String,
val senderPhoneNumber: String,
val recipientName: String,
val recipientPhoneNumber: String,
val isDone: Boolean,
)

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.nexters.boolti.domain.repository

import com.nexters.boolti.domain.model.ApproveGiftPayment
import com.nexters.boolti.domain.model.Gift
import com.nexters.boolti.domain.model.ImagePair
import com.nexters.boolti.domain.request.GiftApproveRequest
import kotlinx.coroutines.flow.Flow

interface GiftRepository {
fun receiverGift(giftId: String): Flow<Boolean>

fun approveGiftPayment(request: GiftApproveRequest): Flow<ApproveGiftPayment>

fun getGift(giftId: String): Flow<Gift>

fun getGiftImages(): Flow<List<ImagePair>>
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface TicketingRepository {
fun requestReservation(request: TicketingRequest): Flow<String>
fun checkInviteCode(request: CheckInviteCodeRequest): Flow<InviteCodeStatus>
fun getPaymentInfo(reservationId: String): Flow<ReservationDetail>
fun getOrderId(request: OrderIdRequest): Flow<String>
fun requestOrderId(request: OrderIdRequest): Flow<String>
fun approvePayment(request: PaymentApproveRequest): Flow<ApprovePaymentResponse>
fun cancelPayment(request: PaymentCancelRequest): Flow<Boolean>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.nexters.boolti.domain.request

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class GiftApproveRequest(
val orderId: String,
val amount: Int,
val paymentKey: String,
val showId: String,
val salesTicketTypeId: String,
val ticketCount: Int,
@SerialName("giftImgId") val giftImageId: String,
val message: String,
val senderName: String,
val senderPhoneNumber: String,
val recipientName: String,
val recipientPhoneNumber: String,
)
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ fun KakaoLoginButton(
contentAlignment = Alignment.CenterStart,
) {
Icon(
painter = painterResource(R.drawable.ic_kakaotalk), contentDescription = "카카오톡 아이콘",
painter = painterResource(R.drawable.ic_kakaotalk), contentDescription = null,
modifier = Modifier.size(width = 20.dp, height = 20.dp),
tint = Color.Black,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ package com.nexters.boolti.presentation.component

import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonColors
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
Expand All @@ -27,19 +29,14 @@ fun MainButton(
modifier: Modifier = Modifier,
label: String = stringResource(id = R.string.btn_ok),
enabled: Boolean = true,
disabledContentColor: Color = Grey50,
colors: ButtonColors = MainButtonDefaults.buttonColors(),
onClick: () -> Unit,
) {
Button(
modifier = modifier.height(48.dp),
onClick = onClick,
enabled = enabled,
colors = ButtonDefaults.buttonColors(
containerColor = MaterialTheme.colorScheme.primary,
contentColor = MaterialTheme.colorScheme.onPrimary,
disabledContainerColor = Grey80,
disabledContentColor = disabledContentColor,
),
colors = colors,
HamBP marked this conversation as resolved.
Show resolved Hide resolved
shape = RoundedCornerShape(4.dp),
contentPadding = PaddingValues(horizontal = marginHorizontal),
interactionSource = remember { MutableInteractionSource() },
Expand All @@ -48,6 +45,22 @@ fun MainButton(
}
}

object MainButtonDefaults {

@Composable
fun buttonColors(
containerColor: Color = MaterialTheme.colorScheme.primary,
contentColor: Color = MaterialTheme.colorScheme.onPrimary,
disabledContainerColor: Color = Grey80,
disabledContentColor: Color = Grey50,
): ButtonColors = ButtonDefaults.buttonColors(
containerColor = containerColor,
contentColor = contentColor,
disabledContainerColor = disabledContainerColor,
disabledContentColor = disabledContentColor
)
}

@Composable
fun SecondaryButton(
modifier: Modifier = Modifier,
Expand Down Expand Up @@ -79,7 +92,26 @@ fun SecondaryButton(
fun MainButtonPreview() {
BooltiTheme {
Surface {
MainButton(label = "확인") {}
MainButton(
modifier = Modifier.fillMaxWidth(),
label = "확인",
) {}
}
}
}

@Preview
@Composable
fun AnotherMainButtonPreview() {
BooltiTheme {
Surface {
MainButton(
modifier = Modifier.fillMaxWidth(),
label = "선물하기",
colors = MainButtonDefaults.buttonColors(
containerColor = Grey80
)
) {}
}
}
}
Loading
Loading