feat(gift): 선물 상세 API 계약을 추가한다

This commit is contained in:
2026-10-02 18:30:15 +09:00
parent d907d2cdc2
commit 1931e6fda3
5 changed files with 339 additions and 0 deletions
@@ -5,6 +5,7 @@ import kr.co.vividnext.sodalive.common.ApiResponse
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.Header
import retrofit2.http.Path
import retrofit2.http.POST
import retrofit2.http.Query
@@ -27,4 +28,23 @@ interface GiftApi {
@Body request: GiftCreateRequest,
@Header("Authorization") authHeader: String
): Single<ApiResponse<Any>>
@GET("/api/v2/gifts/{applicationNo}")
fun getGiftDetail(
@Path("applicationNo") applicationNo: String,
@Header("Authorization") authHeader: String
): Single<ApiResponse<GiftDetailResponse>>
@POST("/api/v2/gifts/{applicationNo}/tracking")
fun registerGiftTracking(
@Path("applicationNo") applicationNo: String,
@Body request: GiftTrackingRequest,
@Header("Authorization") authHeader: String
): Single<ApiResponse<GiftTrackingResponse>>
@POST("/api/v2/gifts/{applicationNo}/cancel")
fun cancelGift(
@Path("applicationNo") applicationNo: String,
@Header("Authorization") authHeader: String
): Single<ApiResponse<GiftCancelResponse>>
}
@@ -62,3 +62,79 @@ data class GiftCreateRequest(
@SerializedName("senderPrivacyAgreed") val senderPrivacyAgreed: Boolean,
@SerializedName("damageWaiverAgreed") val damageWaiverAgreed: Boolean
)
@Keep
data class GiftDetailResponse(
@SerializedName("applicationNo") val applicationNo: String,
@SerializedName("direction") val direction: String,
@SerializedName("status") val status: String,
@SerializedName("statusName") val statusName: String,
@SerializedName("giftInfo") val giftInfo: GiftDetailInfoResponse,
@SerializedName("senderInfo") val senderInfo: GiftAddressResponse?,
@SerializedName("recipientAddress") val recipientAddress: GiftAddressResponse?,
@SerializedName("mailbox") val mailbox: GiftAddressResponse?,
@SerializedName("trackingRequired") val trackingRequired: Boolean,
@SerializedName("recipientAddressRequired") val recipientAddressRequired: Boolean,
@SerializedName("recipientAddressDeadlineAt") val recipientAddressDeadlineAt: String?,
@SerializedName("delivery") val delivery: GiftDeliveryResponse,
@SerializedName("statusTimeline") val statusTimeline: List<GiftStatusTimelineResponse>
)
@Keep
data class GiftDetailInfoResponse(
@SerializedName("recipientCreatorNickname") val recipientCreatorNickname: String?,
@SerializedName("senderNickname") val senderNickname: String?,
@SerializedName("sizeName") val sizeName: String,
@SerializedName("categoryName") val categoryName: String,
@SerializedName("applicationNo") val applicationNo: String?,
@SerializedName("paidCan") val paidCan: Int?,
@SerializedName("tracking") val tracking: String?,
@SerializedName("shippingRequestedAt") val shippingRequestedAt: String?
)
@Keep
data class GiftAddressResponse(
@SerializedName("name") val name: String,
@SerializedName("phoneNumber") val phoneNumber: String,
@SerializedName("address") val address: String
)
@Keep
data class GiftDeliveryResponse(
@SerializedName("canceledAt") val canceledAt: String?,
@SerializedName("undeliverableAt") val undeliverableAt: String?,
@SerializedName("undeliverableReason") val undeliverableReason: String?
)
@Keep
data class GiftStatusTimelineResponse(
@SerializedName("status") val status: String,
@SerializedName("statusName") val statusName: String,
@SerializedName("occurredAt") val occurredAt: String?
)
@Keep
data class GiftTrackingRequest(
@SerializedName("courierCompanyName") val courierCompanyName: String,
@SerializedName("trackingNumber") val trackingNumber: String
)
@Keep
data class GiftTrackingResponse(
@SerializedName("applicationNo") val applicationNo: String,
@SerializedName("status") val status: String,
@SerializedName("statusName") val statusName: String,
@SerializedName("courierCompanyName") val courierCompanyName: String,
@SerializedName("trackingNumber") val trackingNumber: String,
@SerializedName("trackingRegisteredAt") val trackingRegisteredAt: String,
@SerializedName("recipientAddressDeadlineAt") val recipientAddressDeadlineAt: String
)
@Keep
data class GiftCancelResponse(
@SerializedName("applicationNo") val applicationNo: String,
@SerializedName("status") val status: String,
@SerializedName("statusName") val statusName: String,
@SerializedName("priceCan") val priceCan: Int,
@SerializedName("canceledAt") val canceledAt: String
)
@@ -14,4 +14,21 @@ class GiftRepository(private val api: GiftApi) {
request = request,
authHeader = token
)
fun getGiftDetail(applicationNo: String, token: String) = api.getGiftDetail(
applicationNo = applicationNo,
authHeader = token
)
fun registerGiftTracking(applicationNo: String, request: GiftTrackingRequest, token: String) =
api.registerGiftTracking(
applicationNo = applicationNo,
request = request,
authHeader = token
)
fun cancelGift(applicationNo: String, token: String) = api.cancelGift(
applicationNo = applicationNo,
authHeader = token
)
}