Skip to content
Open
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# 0.1.17 (2024.12.19)
## Added
### Payment SDK 다통화승인(외화결제) 지원

# 0.1.16 (2024.07.03)
## Fixed
### 결제 취소 에러 문구 한글로 변경

# 0.1.15 (2024.03.06)
## Fixed
### 삼성카드 일반결제 백신 앱 (vguard) 이슈 대응

# 0.1.14 (2024.01.03)
## Added
### requestPayment의 PaymentInfo에 useInternationalCardOnly 파라미터 추가

# 0.1.13 (2023.12.13)
## Fixed
### 카드사 결제 페이지에서 취소 시 에러 화면으로 이동하는 이슈 수정
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.tosspayments.paymentsdk.sample.activity
import androidx.activity.viewModels
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import com.tosspayments.paymentsdk.model.paymentinfo.Currency
import com.tosspayments.paymentsdk.sample.viewmodel.CardPaymentViewModel
import com.tosspayments.paymentsdk.model.paymentinfo.TossCardPaymentCompany
import com.tosspayments.paymentsdk.model.paymentinfo.TossCardPaymentFlow
Expand All @@ -25,6 +26,7 @@ class CardPaymentActivity : PaymentActivity<TossCardPaymentInfo>() {
FlowMode()
EasyPay()
DiscountCode()
Currency()
}

@Composable
Expand Down Expand Up @@ -188,4 +190,15 @@ class CardPaymentActivity : PaymentActivity<TossCardPaymentInfo>() {
}
}
}

@Composable
private fun Currency() {
ItemSelectDialog("통화",
buttonText = viewModel.currency.collectAsState().value?.name ?: "통화 선택",
items = Currency.values().map { Pair(it.name, it) }) {
it?.let {
viewModel.setCurrency(it)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.tosspayments.paymentsdk.sample.viewmodel
import android.app.Activity
import android.content.Intent
import androidx.activity.result.ActivityResultLauncher
import com.tosspayments.paymentsdk.model.paymentinfo.Currency
import com.tosspayments.paymentsdk.model.paymentinfo.TossCardPaymentCompany
import com.tosspayments.paymentsdk.model.paymentinfo.TossCardPaymentFlow
import com.tosspayments.paymentsdk.model.paymentinfo.TossCardPaymentInfo
Expand Down Expand Up @@ -30,6 +31,7 @@ class CardPaymentViewModel : BasePaymentViewModel<TossCardPaymentInfo>() {
this.flowMode = _flowMode.value
this.easyPay = _easyPay.value
this.discountCode = _discountCode.value
this.currency = _currency.value
}

private val _cardCompany = MutableStateFlow<TossCardPaymentCompany?>(null)
Expand Down Expand Up @@ -59,6 +61,9 @@ class CardPaymentViewModel : BasePaymentViewModel<TossCardPaymentInfo>() {
private val _easyPay = MutableStateFlow<TossEasyPayCompany?>(null)
val easyPay = _easyPay.asStateFlow()

private val _currency = MutableStateFlow<Currency?>(null)
val currency = _currency.asStateFlow()

fun setCardCompany(cardCompany: TossCardPaymentCompany?) {
_cardCompany.value = cardCompany
}
Expand Down Expand Up @@ -95,6 +100,10 @@ class CardPaymentViewModel : BasePaymentViewModel<TossCardPaymentInfo>() {
_discountCode.value = discountCode
}

fun setCurrency(currency: Currency) {
_currency.value = currency
}

override fun requestPayment(
activity: Activity,
resultLauncher: ActivityResultLauncher<Intent>
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ kotlin.code.style=official
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true

versionName=0.1.13
versionName=0.1.17
15 changes: 15 additions & 0 deletions paymentsdk/src/dev/assets/tosspayment.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="ko">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title></title>
<script src="https://js.tosspayments.com/alpha/payment"></script>
</head>

<body>
</body>

</html>
2 changes: 1 addition & 1 deletion paymentsdk/src/main/assets/tosspayment.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title></title>
<script src="https://js.tosspayments.com/v1"></script>
<script src="https://js.tosspayments.com/v1/payment"></script>
</head>

<body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ internal class TossPaymentActivity : AppCompatActivity() {
}
}
val paymentDom = intent?.getStringExtra(TossPayments.EXTRA_PAYMENT_DOM)
val paymentCanceledMessage = "Payment has been canceled by the customer"
val paymentCanceledMessage = "사용자에 의해 결제가 취소되었습니다."
val domain = intent?.getStringExtra(Constants.EXTRA_KEY_DOMAIN)

val errorMessage = when {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.tosspayments.paymentsdk.model.paymentinfo

enum class Currency {
KRW, USD, JPY
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ data class TossCardPaymentInfo(
var flowMode: TossCardPaymentFlow = TossCardPaymentFlow.DEFAULT
var easyPay: TossEasyPayCompany? = null
var discountCode: String? = null
var currency: Currency? = null

override val paymentPayload: JSONObject.(JSONObject) -> JSONObject
get() = {
Expand Down Expand Up @@ -56,6 +57,8 @@ data class TossCardPaymentInfo(
discountCode?.let { put("discountCode", it) }
}

currency?.let { put("currency", it.name) }

put("flowMode", flowMode)
}
}
Loading