From 1999d30839c8fe33c0f6cc4837f2bf237cae7bbd Mon Sep 17 00:00:00 2001 From: "i.khafizov" Date: Tue, 30 Nov 2021 19:08:51 +0300 Subject: [PATCH] Send "connection_type" and "sdk_version" in Init request --- changelog.md | 7 +++++++ .../ru/tinkoff/acquiring/sdk/requests/AcquiringRequest.kt | 2 ++ .../java/ru/tinkoff/acquiring/sdk/requests/InitRequest.kt | 5 +++++ gradle.properties | 2 +- .../ru/tinkoff/acquiring/sdk/payment/PaymentProcess.kt | 2 ++ .../java/ru/tinkoff/acquiring/sdk/viewmodel/QrViewModel.kt | 2 ++ 6 files changed, 19 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 17b88008..4e6f7ae1 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,10 @@ +## 2.5.2 + +#### Fixed +#### Changes +#### Additions +Send "connection_type" and "sdk_version" in Init request + ## 2.5.1 #### Fixed diff --git a/core/src/main/java/ru/tinkoff/acquiring/sdk/requests/AcquiringRequest.kt b/core/src/main/java/ru/tinkoff/acquiring/sdk/requests/AcquiringRequest.kt index c5d6e1a8..582c38b2 100644 --- a/core/src/main/java/ru/tinkoff/acquiring/sdk/requests/AcquiringRequest.kt +++ b/core/src/main/java/ru/tinkoff/acquiring/sdk/requests/AcquiringRequest.kt @@ -115,5 +115,7 @@ abstract class AcquiringRequest(internal val apiMethod: S const val DATA_TYPE = "DataType" const val REDIRECT_DUE_DATE = "RedirectDueDate" const val IP = "IP" + const val CONNECTION_TYPE = "connection_type" + const val SDK_VERSION = "sdk_version" } } diff --git a/core/src/main/java/ru/tinkoff/acquiring/sdk/requests/InitRequest.kt b/core/src/main/java/ru/tinkoff/acquiring/sdk/requests/InitRequest.kt index 7a34b92d..d919271e 100644 --- a/core/src/main/java/ru/tinkoff/acquiring/sdk/requests/InitRequest.kt +++ b/core/src/main/java/ru/tinkoff/acquiring/sdk/requests/InitRequest.kt @@ -119,6 +119,8 @@ class InitRequest : AcquiringRequest(INIT_METHOD) { } } + var sdkVersion: String? = null + private var redirectDueDateFormat: String? = null private val dateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.getDefault()) @@ -166,10 +168,13 @@ class InitRequest : AcquiringRequest(INIT_METHOD) { } dataMap[CHARGE_FLAG] = chargeFlag.toString() + dataMap[CONNECTION_TYPE] = CONNECTION_TYPE_MOBILE_SDK + sdkVersion?.let { dataMap[SDK_VERSION] = it } this[DATA] = dataMap } companion object { private const val RECURRENT_FLAG_Y = "Y" + private const val CONNECTION_TYPE_MOBILE_SDK = "mobile_sdk" } } diff --git a/gradle.properties b/gradle.properties index e94efc50..c5f8a298 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -VERSION_NAME=2.5.1 +VERSION_NAME=2.5.2 VERSION_CODE=15 GROUP=ru.tinkoff.acquiring diff --git a/ui/src/main/java/ru/tinkoff/acquiring/sdk/payment/PaymentProcess.kt b/ui/src/main/java/ru/tinkoff/acquiring/sdk/payment/PaymentProcess.kt index 8fb8eb1d..5f515df4 100644 --- a/ui/src/main/java/ru/tinkoff/acquiring/sdk/payment/PaymentProcess.kt +++ b/ui/src/main/java/ru/tinkoff/acquiring/sdk/payment/PaymentProcess.kt @@ -17,6 +17,7 @@ package ru.tinkoff.acquiring.sdk.payment import ru.tinkoff.acquiring.sdk.AcquiringSdk +import ru.tinkoff.acquiring.sdk.BuildConfig import ru.tinkoff.acquiring.sdk.exceptions.AcquiringApiException import ru.tinkoff.acquiring.sdk.localization.AsdkLocalization import ru.tinkoff.acquiring.sdk.models.AsdkState @@ -364,6 +365,7 @@ class PaymentProcess internal constructor(private val sdk: AcquiringSdk) { data = order.additionalData customerKey = paymentOptions.customer.customerKey language = AsdkLocalization.language.name + sdkVersion = BuildConfig.VERSION_NAME } } diff --git a/ui/src/main/java/ru/tinkoff/acquiring/sdk/viewmodel/QrViewModel.kt b/ui/src/main/java/ru/tinkoff/acquiring/sdk/viewmodel/QrViewModel.kt index 25308610..95f522c6 100644 --- a/ui/src/main/java/ru/tinkoff/acquiring/sdk/viewmodel/QrViewModel.kt +++ b/ui/src/main/java/ru/tinkoff/acquiring/sdk/viewmodel/QrViewModel.kt @@ -19,6 +19,7 @@ package ru.tinkoff.acquiring.sdk.viewmodel import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import ru.tinkoff.acquiring.sdk.AcquiringSdk +import ru.tinkoff.acquiring.sdk.BuildConfig import ru.tinkoff.acquiring.sdk.localization.AsdkLocalization import ru.tinkoff.acquiring.sdk.models.DefaultScreenState import ru.tinkoff.acquiring.sdk.models.LoadedState @@ -134,6 +135,7 @@ internal class QrViewModel(handleErrorsInSdk: Boolean, sdk: AcquiringSdk) : Base data = order.additionalData customerKey = paymentOptions.customer.customerKey language = AsdkLocalization.language.name + sdkVersion = BuildConfig.VERSION_NAME } } } \ No newline at end of file