Skip to content

Commit

Permalink
[FIX/#102] 구매뷰 orderId 관련 서버 수정사항 대응
Browse files Browse the repository at this point in the history
  • Loading branch information
Marchbreeze committed Sep 2, 2024
1 parent efc4f89 commit e4250d8
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import kotlinx.serialization.Serializable
data class OrderRequestDto(
@SerialName("itemId")
val itemId: String,
@SerialName("paymentId")
val paymentId: String,
@SerialName("orderId")
val orderId: String,
@SerialName("selectedOptionDetailIdList")
val selectedOptionDetailIdList: List<Long>,
) {
companion object {
fun OrderRequestModel.toDto() = OrderRequestDto(itemId, paymentId, selectedOptionDetailIdList)
fun OrderRequestModel.toDto() = OrderRequestDto(itemId, orderId, selectedOptionDetailIdList)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import kotlinx.serialization.Serializable

@Serializable
data class PayEndRequestDto(
@SerialName("paymentId")
val paymentId: String,
@SerialName("orderId")
val orderId: String,
@SerialName("payStatus")
val payStatus: String,
) {
companion object {
fun PayEndRequestModel.toDto() = PayEndRequestDto(paymentId, payStatus)
fun PayEndRequestModel.toDto() = PayEndRequestDto(orderId, payStatus)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import kotlinx.serialization.Serializable

@Serializable
data class PayStartRequestDto(
@SerialName("itemId")
val itemId: String,
@SerialName("productId")
val productId: String,
@SerialName("charge")
val charge: Int,
@SerialName("totalPrice")
Expand All @@ -16,6 +16,6 @@ data class PayStartRequestDto(
val method: String,
) {
companion object {
fun PayStartRequestModel.toDto() = PayStartRequestDto(itemId, charge, totalPrice, method)
fun PayStartRequestModel.toDto() = PayStartRequestDto(productId, charge, totalPrice, method)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import kotlinx.serialization.Serializable

@Serializable
data class BuyProgressDto(
@SerialName("itemId")
val itemId: String,
@SerialName("productId")
val productId: String,
@SerialName("productName")
val productName: String,
@SerialName("modifiedProductName")
Expand All @@ -27,7 +27,7 @@ data class BuyProgressDto(
) {
fun toModel() =
BuyProgressModel(
itemId,
productId,
productName,
modifiedProductName,
imgUrl,
Expand Down
6 changes: 3 additions & 3 deletions data/src/main/java/co/orange/data/dto/response/PayEndDto.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ import kotlinx.serialization.Serializable

@Serializable
data class PayEndDto(
@SerialName("paymentId")
val paymentId: String,
@SerialName("orderId")
val orderId: String,
@SerialName("payStatus")
val payStatus: String,
@SerialName("endedAt")
val endedAt: String,
) {
fun toModel() =
PayEndModel(
paymentId = paymentId,
orderId = orderId,
payStatus = payStatus,
endedAt = endedAt,
)
Expand Down
6 changes: 3 additions & 3 deletions data/src/main/java/co/orange/data/dto/response/PayStartDto.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ import kotlinx.serialization.Serializable

@Serializable
data class PayStartDto(
@SerialName("paymentId")
val paymentId: String,
@SerialName("orderId")
val orderId: String,
@SerialName("payStatus")
val payStatus: String,
@SerialName("startedAt")
val startedAt: String,
) {
fun toModel() =
PayStartModel(
paymentId = paymentId,
orderId = orderId,
payStatus = payStatus,
startedAt = startedAt,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ package co.orange.domain.entity.request

data class OrderRequestModel(
val itemId: String,
val paymentId: String,
val orderId: String,
val selectedOptionDetailIdList: List<Long>,
)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package co.orange.domain.entity.request

data class PayEndRequestModel(
val paymentId: String,
val orderId: String,
val payStatus: String,
)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package co.orange.domain.entity.request

data class PayStartRequestModel(
val itemId: String,
val productId: String,
val charge: Int,
val totalPrice: Int,
val method: String,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package co.orange.domain.entity.response

data class BuyProgressModel(
val itemId: String,
val productId: String,
val productName: String,
val modifiedProductName: String,
val imgUrl: String,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package co.orange.domain.entity.response

data class PayEndModel(
val paymentId: String,
val orderId: String,
val payStatus: String,
val endedAt: String,
)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package co.orange.domain.entity.response

data class PayStartModel(
val paymentId: String,
val orderId: String,
val payStatus: String,
val startedAt: String,
)
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ class BuyProgressViewModel
private val buyRepository: BuyRepository,
) : ViewModel() {
var productId: String = ""
var paymentId: String = ""
private var orderId: String = ""

var buyProgressData: BuyProgressModel? = null
private var buyProgressData: BuyProgressModel? = null

var payMethodId = MutableLiveData<Int>(-1)
var payMethod = ""
Expand Down Expand Up @@ -112,13 +112,13 @@ class BuyProgressViewModel
viewModelScope.launch {
buyRepository.postPaymentStart(
PayStartRequestModel(
buyProgressData?.itemId.orEmpty(),
buyProgressData?.productId.orEmpty(),
buyProgressData?.charge ?: -1,
buyProgressData?.totalPrice ?: -1,
payMethod,
),
).onSuccess {
paymentId = it.paymentId
orderId = it.orderId
if (it.payStatus == PAY_STATUS_PENDING) {
_postPayStartState.value = UiState.Success(it)
} else {
Expand All @@ -131,15 +131,15 @@ class BuyProgressViewModel
}

fun createIamportRequest(): IamPortRequest? {
return if (buyProgressData?.productName.isNullOrBlank() || payMethod.isBlank() || paymentId.isBlank()) {
return if (buyProgressData?.productName.isNullOrBlank() || payMethod.isBlank() || orderId.isBlank()) {
Timber.tag("okhttp").d("IAMPORT PURCHASE REQUEST ERROR : $buyProgressData")
null
} else {
IamPortRequest(
pg = NICE_PAYMENTS,
pay_method = payMethod,
name = buyProgressData?.modifiedProductName,
merchant_uid = paymentId,
merchant_uid = orderId,
amount = buyProgressData?.totalPrice.toString(),
buyer_name = buyProgressData?.addressInfo?.recipient,
buyer_tel = buyProgressData?.addressInfo?.recipientPhone,
Expand All @@ -153,7 +153,7 @@ class BuyProgressViewModel
viewModelScope.launch {
buyRepository.patchPaymentEnd(
PayEndRequestModel(
paymentId,
orderId,
if (errorCode.isNullOrEmpty()) PAY_SUCCESS else PAY_FAILURE,
),
).onSuccess {
Expand All @@ -170,8 +170,8 @@ class BuyProgressViewModel
viewModelScope.launch {
buyRepository.postToRequestOrder(
OrderRequestModel(
buyProgressData?.itemId.orEmpty(),
paymentId,
buyProgressData?.productId.orEmpty(),
orderId,
// TODO 추후 옵션 대응
listOf(),
),
Expand Down

0 comments on commit e4250d8

Please sign in to comment.