diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/can/charge/free/AdsCharge.kt b/src/main/kotlin/kr/co/vividnext/sodalive/can/charge/free/AdsCharge.kt deleted file mode 100644 index d290824..0000000 --- a/src/main/kotlin/kr/co/vividnext/sodalive/can/charge/free/AdsCharge.kt +++ /dev/null @@ -1,23 +0,0 @@ -package kr.co.vividnext.sodalive.can.charge.free - -import kr.co.vividnext.sodalive.common.BaseEntity -import kr.co.vividnext.sodalive.member.Member -import javax.persistence.Entity -import javax.persistence.FetchType -import javax.persistence.JoinColumn -import javax.persistence.ManyToOne - -@Entity -data class AdsCharge( - val transactionKey: String, - val adKey: String, - val adName: String, - val adProfit: Float, - val adCurrency: String, - val point: Float, - val deviceIfa: String -) : BaseEntity() { - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "member_id", nullable = false) - var member: Member? = null -} diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/can/charge/free/AdsChargeController.kt b/src/main/kotlin/kr/co/vividnext/sodalive/can/charge/free/AdsChargeController.kt deleted file mode 100644 index ea6bf41..0000000 --- a/src/main/kotlin/kr/co/vividnext/sodalive/can/charge/free/AdsChargeController.kt +++ /dev/null @@ -1,35 +0,0 @@ -package kr.co.vividnext.sodalive.can.charge.free - -import org.springframework.web.bind.annotation.GetMapping -import org.springframework.web.bind.annotation.RequestMapping -import org.springframework.web.bind.annotation.RequestParam -import org.springframework.web.bind.annotation.RestController - -@RestController -@RequestMapping("/charge/ads") -class AdsChargeController(private val service: AdsChargeService) { - @GetMapping - fun adsCharge( - @RequestParam("transaction_key") transactionKey: String, - @RequestParam("placement_uid") placementUid: String, - @RequestParam("ad_key") adKey: String, - @RequestParam("ad_name") adName: String, - @RequestParam("ad_profit") adProfit: String, - @RequestParam("ad_currency") adCurrency: String, - @RequestParam("point") point: String, - @RequestParam("device_ifa") deviceIfa: String, - @RequestParam("picker_uid") memberId: String - ) { - service.adsCharge( - transactionKey, - placementUid, - adKey, - adName, - adProfit, - adCurrency, - point, - deviceIfa, - memberId - ) - } -} diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/can/charge/free/AdsChargeRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/can/charge/free/AdsChargeRepository.kt deleted file mode 100644 index 8b71aea..0000000 --- a/src/main/kotlin/kr/co/vividnext/sodalive/can/charge/free/AdsChargeRepository.kt +++ /dev/null @@ -1,7 +0,0 @@ -package kr.co.vividnext.sodalive.can.charge.free - -import org.springframework.data.jpa.repository.JpaRepository -import org.springframework.stereotype.Repository - -@Repository -interface AdsChargeRepository : JpaRepository diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/can/charge/free/AdsChargeService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/can/charge/free/AdsChargeService.kt deleted file mode 100644 index 1541fde..0000000 --- a/src/main/kotlin/kr/co/vividnext/sodalive/can/charge/free/AdsChargeService.kt +++ /dev/null @@ -1,85 +0,0 @@ -package kr.co.vividnext.sodalive.can.charge.free - -import kr.co.vividnext.sodalive.can.charge.Charge -import kr.co.vividnext.sodalive.can.charge.ChargeRepository -import kr.co.vividnext.sodalive.can.charge.ChargeStatus -import kr.co.vividnext.sodalive.can.payment.Payment -import kr.co.vividnext.sodalive.can.payment.PaymentGateway -import kr.co.vividnext.sodalive.can.payment.PaymentStatus -import kr.co.vividnext.sodalive.common.AdsChargeException -import kr.co.vividnext.sodalive.fcm.FcmEvent -import kr.co.vividnext.sodalive.fcm.FcmEventType -import kr.co.vividnext.sodalive.member.MemberRepository -import org.springframework.beans.factory.annotation.Value -import org.springframework.context.ApplicationEventPublisher -import org.springframework.data.repository.findByIdOrNull -import org.springframework.stereotype.Service -import org.springframework.transaction.annotation.Transactional - -@Service -class AdsChargeService( - private val repository: AdsChargeRepository, - private val memberRepository: MemberRepository, - private val chargeRepository: ChargeRepository, - private val applicationEventPublisher: ApplicationEventPublisher, - - @Value("\${point-click.placement-uid}") - private val placementUid: String -) { - @Transactional - fun adsCharge( - transactionKey: String, - placementUid: String, - adKey: String, - adName: String, - adProfit: String, - adCurrency: String, - point: String, - deviceIfa: String, - memberId: String - ) { - if (placementUid != this.placementUid) { - throw AdsChargeException("잘못된 요청입니다.") - } - - val member = memberRepository.findByIdOrNull(id = memberId.toLong()) - ?: throw AdsChargeException("잘못된 요청입니다.") - - val adsCharge = AdsCharge( - transactionKey = transactionKey, - adKey = adKey, - adName = adName, - adProfit = adProfit.toFloat(), - adCurrency = adCurrency, - point = point.toFloat(), - deviceIfa = deviceIfa - ) - adsCharge.member = member - repository.save(adsCharge) - - val charge = Charge(0, rewardCan = adsCharge.point.toInt(), status = ChargeStatus.ADS) - charge.title = "${adsCharge.point.toInt()} 캔" - charge.member = member - - val payment = Payment( - status = PaymentStatus.COMPLETE, - paymentGateway = PaymentGateway.POINT_CLICK_AD - ) - - payment.method = "제휴보상" - charge.payment = payment - chargeRepository.save(charge) - - member.charge(0, adsCharge.point.toInt(), "ads") - - applicationEventPublisher.publishEvent( - FcmEvent( - type = FcmEventType.INDIVIDUAL, - title = "제휴보상", - message = "${adsCharge.point.toInt()} 캔이 지급되었습니다.", - recipients = listOf(member.id!!), - isAuth = null - ) - ) - } -} diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/live/room/GetRoomListResponse.kt b/src/main/kotlin/kr/co/vividnext/sodalive/live/room/GetRoomListResponse.kt index 34edc54..2649133 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/live/room/GetRoomListResponse.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/live/room/GetRoomListResponse.kt @@ -12,6 +12,7 @@ data class GetRoomListResponse( val price: Int, val tags: List, val channelName: String?, + val creatorProfileImage: String, val creatorNickname: String, val creatorId: Long, val isReservation: Boolean, diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/live/room/LiveRoomService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/live/room/LiveRoomService.kt index 09101b0..25ab32f 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/live/room/LiveRoomService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/live/room/LiveRoomService.kt @@ -146,6 +146,11 @@ class LiveRoomService( isAdult = it.isAdult, price = it.price, channelName = it.channelName, + creatorProfileImage = if (it.member!!.profileImage != null) { + "$cloudFrontHost/${it.member!!.profileImage}" + } else { + "$cloudFrontHost/profile/default-profile.png" + }, creatorNickname = it.member!!.nickname, creatorId = it.member!!.id!!, tags = it.tags diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 3be6e79..1f71979 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -20,9 +20,6 @@ agora: appId: ${AGORA_APP_ID} appCertificate: ${AGORA_APP_CERTIFICATE} -pointClick: - placementUid: fc07cfb1-ef16-455c-bdad-22aa9e8fd78c - firebase: secretKeyPath: ${GOOGLE_APPLICATION_CREDENTIALS} @@ -92,6 +89,3 @@ spring: hibernate: show_sql: true format_sql: true - -pointClick: - placementUid: test diff --git a/src/test/resources/application.yml b/src/test/resources/application.yml index 6639ad7..a4d9db8 100644 --- a/src/test/resources/application.yml +++ b/src/test/resources/application.yml @@ -13,9 +13,6 @@ agora: appId: ${AGORA_APP_ID} appCertificate: ${AGORA_APP_CERTIFICATE} -pointClick: - placementUid: test - cloud: aws: credentials: