diff --git a/SodaLive/Sources/MyPage/Can/GetCanResponse.swift b/SodaLive/Sources/MyPage/Can/GetCanResponse.swift index c533ee5..05ef712 100644 --- a/SodaLive/Sources/MyPage/Can/GetCanResponse.swift +++ b/SodaLive/Sources/MyPage/Can/GetCanResponse.swift @@ -12,7 +12,6 @@ struct GetCanResponse: Decodable, Hashable { let title: String let can: Int let rewardCan: Int - let price: Int let currency: String let priceStr: String } diff --git a/SodaLive/Sources/MyPage/Can/Payment/CanPgPaymentView.swift b/SodaLive/Sources/MyPage/Can/Payment/CanPgPaymentView.swift index 3bf5d85..c92fc61 100644 --- a/SodaLive/Sources/MyPage/Can/Payment/CanPgPaymentView.swift +++ b/SodaLive/Sources/MyPage/Can/Payment/CanPgPaymentView.swift @@ -308,11 +308,18 @@ struct CanPgPaymentView: View { viewModel.payverseChargeCan(canId: canResponse.id) } else { viewModel.chargeCan(canId: canResponse.id) { - viewModel.payload.orderName = canResponse.title - viewModel.payload.price = Double(canResponse.price) - viewModel.payload.taxFree = 0 + let price = Double(canResponse.priceStr) - viewModel.isShowPaymentView = true + if let price = price { + viewModel.payload.orderName = canResponse.title + viewModel.payload.price = price + viewModel.payload.taxFree = 0 + + viewModel.isShowPaymentView = true + } else { + viewModel.errorMessage = "결제도중 오류가 발생했습니다.\n고객센터로 문의주시기 바랍니다." + viewModel.isShowPopup = true + } } } } @@ -378,7 +385,7 @@ struct CanPgPaymentView: View { struct CanPgPaymentView_Previews: PreviewProvider { static var previews: some View { CanPgPaymentView( - canResponse: GetCanResponse(id: 1, title: "300 캔", can: 300, rewardCan: 0, price: 7500, currency: "USD", priceStr: "5.99"), + canResponse: GetCanResponse(id: 1, title: "300 캔", can: 300, rewardCan: 0, currency: "USD", priceStr: "5.99"), refresh: {}, afterCompletionToGoBack: false )