Skip to content

Commit

Permalink
[MERGE] #76 -> develop
Browse files Browse the repository at this point in the history
[FEAT/#76] 구매뷰 / 구매 정보 API 구현
  • Loading branch information
Marchbreeze authored Aug 18, 2024
2 parents 6694188 + dae543b commit 29d3bbf
Show file tree
Hide file tree
Showing 41 changed files with 580 additions and 255 deletions.
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
android:screenOrientation="portrait" />

<activity
android:name="co.orange.presentation.buy.confirm.BuyConfirmActivity"
android:name="co.orange.presentation.buy.progress.BuyProgressActivity"
android:exported="false"
android:screenOrientation="portrait" />

Expand Down Expand Up @@ -83,7 +83,7 @@
android:screenOrientation="portrait" />

<activity
android:name="co.orange.presentation.sell.confirm.SellConfirmActivity"
android:name="co.orange.presentation.sell.progress.SellProgressActivity"
android:exported="false"
android:screenOrientation="portrait" />

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package co.orange.ddanzi.di.module

import co.orange.data.dataSource.AuthDataSource
import co.orange.data.dataSource.BuyDataSource
import co.orange.data.dataSource.DeviceDataSource
import co.orange.data.dataSource.HomeDataSource
import co.orange.data.dataSource.IamportDataSource
Expand All @@ -9,6 +10,7 @@ import co.orange.data.dataSource.ProfileDataSource
import co.orange.data.dataSource.SearchDataSource
import co.orange.data.dataSource.SettingDataSource
import co.orange.data.dataSourceImpl.AuthDataSourceImpl
import co.orange.data.dataSourceImpl.BuyDataSourceImpl
import co.orange.data.dataSourceImpl.DeviceDataSourceImpl
import co.orange.data.dataSourceImpl.HomeDataSourceImpl
import co.orange.data.dataSourceImpl.IamportDataSourceImpl
Expand Down Expand Up @@ -41,6 +43,10 @@ object DataSourceModule {
@Singleton
fun provideSearchDataSource(searchDataSourceImpl: SearchDataSourceImpl): SearchDataSource = searchDataSourceImpl

@Provides
@Singleton
fun provideBuyDataSource(buyDataSourceImpl: BuyDataSourceImpl): BuyDataSource = buyDataSourceImpl

@Provides
@Singleton
fun provideProfileDataSource(profileDataSourceImpl: ProfileDataSourceImpl): ProfileDataSource = profileDataSourceImpl
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package co.orange.ddanzi.di.module

import co.orange.data.repositoryImpl.AuthRepositoryImpl
import co.orange.data.repositoryImpl.BuyRepositoryImpl
import co.orange.data.repositoryImpl.DeviceRepositoryImpl
import co.orange.data.repositoryImpl.HomeRepositoryImpl
import co.orange.data.repositoryImpl.IamportRepositoryImpl
Expand All @@ -9,6 +10,7 @@ import co.orange.data.repositoryImpl.ProfileRepositoryImpl
import co.orange.data.repositoryImpl.SearchRepositoryImpl
import co.orange.data.repositoryImpl.SettingRepositoryImpl
import co.orange.domain.repository.AuthRepository
import co.orange.domain.repository.BuyRepository
import co.orange.domain.repository.DeviceRepository
import co.orange.domain.repository.HomeRepository
import co.orange.domain.repository.IamportRepository
Expand Down Expand Up @@ -41,6 +43,10 @@ object RepositoryModule {
@Singleton
fun provideSearchRepository(searchRepositoryImpl: SearchRepositoryImpl): SearchRepository = searchRepositoryImpl

@Provides
@Singleton
fun provideBuyRepository(buyRepositoryImpl: BuyRepositoryImpl): BuyRepository = buyRepositoryImpl

@Provides
@Singleton
fun provideProfileRepository(profileRepositoryImpl: ProfileRepositoryImpl): ProfileRepository = profileRepositoryImpl
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package co.orange.ddanzi.di.module

import co.orange.data.service.AuthService
import co.orange.data.service.BuyService
import co.orange.data.service.DeviceService
import co.orange.data.service.HomeService
import co.orange.data.service.IamportService
Expand Down Expand Up @@ -33,7 +34,7 @@ object ServiceModule {

@Provides
@Singleton
fun provideDetailService(
fun provideDeviceService(
@RetrofitQualifier.DEVICE retrofit: Retrofit,
): DeviceService = retrofit.create(DeviceService::class.java)

Expand All @@ -43,6 +44,12 @@ object ServiceModule {
@RetrofitQualifier.JWT retrofit: Retrofit,
): SearchService = retrofit.create(SearchService::class.java)

@Provides
@Singleton
fun provideBuyService(
@RetrofitQualifier.JWT retrofit: Retrofit,
): BuyService = retrofit.create(BuyService::class.java)

@Provides
@Singleton
fun provideProfileService(
Expand Down
8 changes: 8 additions & 0 deletions data/src/main/java/co/orange/data/dataSource/BuyDataSource.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package co.orange.data.dataSource

import co.orange.data.dto.BaseResponse
import co.orange.data.dto.response.BuyProgressDto

interface BuyDataSource {
suspend fun getBuyProgressData(productId: String): BaseResponse<BuyProgressDto>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package co.orange.data.dataSourceImpl

import co.orange.data.dataSource.BuyDataSource
import co.orange.data.dto.BaseResponse
import co.orange.data.dto.response.BuyProgressDto
import co.orange.data.service.BuyService
import javax.inject.Inject

data class BuyDataSourceImpl
@Inject
constructor(
private val buyService: BuyService,
) : BuyDataSource {
override suspend fun getBuyProgressData(productId: String): BaseResponse<BuyProgressDto> = buyService.getBuyProgressData(productId)
}
19 changes: 19 additions & 0 deletions data/src/main/java/co/orange/data/dto/response/AddressInfoDto.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package co.orange.data.dto.response

import co.orange.domain.entity.response.AddressInfoModel
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class AddressInfoDto(
@SerialName("recipient")
val recipient: String? = null,
@SerialName("zipCode")
val zipCode: String? = null,
@SerialName("address")
val address: String? = null,
@SerialName("recipientPhone")
val recipientPhone: String? = null,
) {
fun toModel() = AddressInfoModel(recipient, zipCode, address, recipientPhone)
}
37 changes: 37 additions & 0 deletions data/src/main/java/co/orange/data/dto/response/BuyProgressDto.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package co.orange.data.dto.response

import co.orange.domain.entity.response.BuyProgressModel
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class BuyProgressDto(
@SerialName("itemId")
val itemId: String,
@SerialName("productName")
val productName: String,
@SerialName("imgUrl")
val imgUrl: String,
@SerialName("originPrice")
val originPrice: Int,
@SerialName("addressInfo")
val addressInfo: AddressInfoDto,
@SerialName("discountPrice")
val discountPrice: Int,
@SerialName("charge")
val charge: Int,
@SerialName("totalPrice")
val totalPrice: Int,
) {
fun toModel() =
BuyProgressModel(
itemId,
productName,
imgUrl,
originPrice,
addressInfo.toModel(),
discountPrice,
charge,
totalPrice,
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package co.orange.data.repositoryImpl

import co.orange.data.dataSource.BuyDataSource
import co.orange.domain.entity.response.BuyProgressModel
import co.orange.domain.repository.BuyRepository
import javax.inject.Inject

class BuyRepositoryImpl
@Inject
constructor(
private val buyDataSource: BuyDataSource,
) : BuyRepository {
override suspend fun getBuyProgressData(productId: String): Result<BuyProgressModel> =
runCatching {
buyDataSource.getBuyProgressData(productId).data.toModel()
}
}
13 changes: 13 additions & 0 deletions data/src/main/java/co/orange/data/service/BuyService.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package co.orange.data.service

import co.orange.data.dto.BaseResponse
import co.orange.data.dto.response.BuyProgressDto
import retrofit2.http.GET
import retrofit2.http.Path

interface BuyService {
@GET("/api/v1/order/product/{id}")
suspend fun getBuyProgressData(
@Path("id") productId: String,
): BaseResponse<BuyProgressDto>
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package co.orange.domain.entity.response

data class AddressInfoModel(
val recipient: String,
val zipCode: String,
val address: String,
val phone: String
)
val recipient: String? = null,
val zipCode: String? = null,
val address: String? = null,
val recipientPhone: String? = null,
)

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
package co.orange.domain.entity.response

import co.orange.domain.enums.OrderStatus

data class BuyInfoModel(
val orderId: String,
val orderStatus: OrderStatus,
val productName: String,
val imgUrl: String,
val originPrice: Int,
val sellerNickname: String,
val addressInfo: List<AddressInfoModel>,
val paymentInfo: List<PaymentInfoModel>,
val discountPrice: Int,
val charge: Int,
val totalPrice: Int,
)
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package co.orange.domain.entity.response

data class BuyProgressModel(
val itemId: String,
val productName: String,
val imgUrl: String,
val originPrice: Int,
val addressInfo: AddressInfoModel,
val discountPrice: Int,
val charge: Int,
val totalPrice: Int,
)

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
package co.orange.domain.entity.response

import co.orange.domain.enums.ItemStatus
import co.orange.domain.enums.OrderStatus

data class SellInfoModel(
val itemId: String,
val itemStatus: ItemStatus,
val productName: String,
val imgUrl: String,
val originPrice: Int,
val salePrice: Int,
val orderId: String,
val orderStatus: OrderStatus,
val buyerNickname: String,
val addressInfo: List<AddressInfoModel>,
val paymentInfo: List<PaymentInfoModel>,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package co.orange.domain.entity.response

data class SellProgressModel(
val itemId: String,
val productName: String,
val originPrice: Int,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package co.orange.domain.repository

import co.orange.domain.entity.response.BuyProgressModel

interface BuyRepository {
suspend fun getBuyProgressData(productId: String): Result<BuyProgressModel>
}
Loading

0 comments on commit 29d3bbf

Please sign in to comment.