Skip to content

Commit

Permalink
Merge branch 'v2.12' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
jQwout authored Dec 29, 2022
2 parents fb835d9 + 4952a9a commit 9fa2199
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 27 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
VERSION_NAME=2.10.1
VERSION_CODE=17
VERSION_NAME=2.12.0
VERSION_CODE=18
GROUP=ru.tinkoff.acquiring

POM_DESCRIPTION=Library which allows you to use internet acquiring in your android app
Expand Down
4 changes: 2 additions & 2 deletions gradle/versions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ ext {
versionName = isRelease ? VERSION_NAME : "$VERSION_NAME-SNAPSHOT"

compileSdk = 31
minSdk = 21
yandexPayMinSdk = 23
minSdk = 24
yandexPayMinSdk = 24
targetSdk = 31
buildTools = '30.0.3'

Expand Down
16 changes: 15 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Acquiring SDK позволяет интегрировать [Интернет-Э
- Совершение оплаты из уведомления

### Требования
Для работы Tinkoff Acquiring SDK необходим Android версии 5.0 и выше (API level 21).
Для работы Tinkoff Acquiring SDK необходим Android версии 7.0 и выше (API level 24).

### Подключение
Для подключения SDK добавьте в [_build.gradle_][build-config] вашего проекта следующие зависимости:
Expand All @@ -34,6 +34,19 @@ implementation 'ru.tinkoff.acquiring:threeds-wrapper:$latestVersion'
implementation 'ru.tinkoff.acquiring:cardio:$latestVersion'
```

Так же необходимо добавить в [_network-security-config_][network-security-config] содержащий
сертификаты от минцифр и доп. сертификат от тинькофф. Пример можно посмотреть в `sample` выглядит он так:
```xml
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config>
<certificates src="system" />
<certificates src="@raw/acq_tinkoff_root_cert" />
<certificates src="@raw/acq_ministry_of_digital_development_root_cert" />
</base-config>
</network-security-config>
```

### Подготовка к работе
Для начала работы с SDK вам понадобятся:
* Terminal key
Expand Down Expand Up @@ -382,3 +395,4 @@ implementation 'ru.tinkoff.acquiring:core:$latestVersion'
[init-documentation]: https://oplata.tinkoff.ru/develop/api/payments/init-request/
[google-pay-brand]: https://developers.google.com/pay/api/android/guides/brand-guidelines
[full-doc]: https://github.com/Tinkoff/AcquiringSdkAndroid/blob/master/Android%20SDK.pdf
[network-security-config]:https://developer.android.com/training/articles/security-config
11 changes: 5 additions & 6 deletions sample/src/main/res/xml/network_security_config.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<debug-overrides>
<trust-anchors>
<!-- Trust user added CAs while debuggable only -->
<certificates src="user" />
</trust-anchors>
</debug-overrides>
<base-config>
<certificates src="system" />
<certificates src="@raw/acq_tinkoff_root_cert" />
<certificates src="@raw/acq_ministry_of_digital_development_root_cert" />
</base-config>
</network-security-config>
31 changes: 15 additions & 16 deletions ui/src/main/java/ru/tinkoff/acquiring/sdk/TinkoffAcquiring.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import androidx.fragment.app.Fragment
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.*
import ru.tinkoff.acquiring.sdk.localization.LocalizationSource
import ru.tinkoff.acquiring.sdk.models.*
import ru.tinkoff.acquiring.sdk.models.options.FeaturesOptions
Expand All @@ -33,6 +31,7 @@ import ru.tinkoff.acquiring.sdk.models.paysources.CardData
import ru.tinkoff.acquiring.sdk.models.paysources.GooglePay
import ru.tinkoff.acquiring.sdk.payment.PaymentProcess
import ru.tinkoff.acquiring.sdk.requests.performSuspendRequest
import ru.tinkoff.acquiring.sdk.responses.GetTerminalPayMethodsResponse
import ru.tinkoff.acquiring.sdk.responses.TerminalInfo
import ru.tinkoff.acquiring.sdk.responses.TinkoffPayStatusResponse
import ru.tinkoff.acquiring.sdk.threeds.ThreeDsHelper
Expand All @@ -43,6 +42,7 @@ import ru.tinkoff.acquiring.sdk.ui.activities.NotificationPaymentActivity
import ru.tinkoff.acquiring.sdk.ui.activities.PaymentActivity
import ru.tinkoff.acquiring.sdk.ui.activities.QrCodeActivity
import ru.tinkoff.acquiring.sdk.ui.activities.SavedCardsActivity
import kotlin.coroutines.suspendCoroutine

/**
* Точка входа для взаимодействия с Acquiring SDK
Expand Down Expand Up @@ -209,30 +209,29 @@ class TinkoffAcquiring(
onFailure: ((Throwable) -> Unit)? = null
) {
CoroutineScope(Dispatchers.IO).launch {
sdk.tinkoffPayStatus().execute({
launch(Dispatchers.Main) { onSuccess(it) }
}, {
launch(Dispatchers.Main) { onFailure?.invoke(it) }
})
val mainScope = this
val result = sdk.tinkoffPayStatus().performSuspendRequest()
withContext(Dispatchers.Main) {
result.fold(onSuccess = onSuccess, onFailure = { onFailure?.invoke(it) })
mainScope.cancel()
}
}
}

/**
* Проверка доступных спосбов оплаты
*/
fun checkTerminalInfo(onSuccess: (TerminalInfo?) -> Unit,
onFailure: ((Throwable) -> Unit)? = null) {

val onFailureOrThrow = onFailure ?: { throw it }

onFailure: ((Throwable) -> Unit)? = null
) {
CoroutineScope(Dispatchers.IO).launch {

val mainScope = this
val result = sdk.getTerminalPayMethods()
.performSuspendRequest()
.map { it.terminalInfo }

launch(Dispatchers.Main) {
result.fold(onSuccess, onFailureOrThrow)
withContext(Dispatchers.Main) {
result.fold(onSuccess = onSuccess, onFailure = { onFailure?.invoke(it) })
mainScope.cancel()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
-----BEGIN CERTIFICATE-----
MIIFwjCCA6qgAwIBAgICEAAwDQYJKoZIhvcNAQELBQAwcDELMAkGA1UEBhMCUlUx
PzA9BgNVBAoMNlRoZSBNaW5pc3RyeSBvZiBEaWdpdGFsIERldmVsb3BtZW50IGFu
ZCBDb21tdW5pY2F0aW9uczEgMB4GA1UEA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pfBKrS6badZrHF+qwshzAS
BgNVHRMBAf8ECDAGAQH/AgEEMA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQsF
AAOCAgEAALIY1wkilt/urfEVM5vKzr6utOeDWCUczmWX/RX4ljpRdgF+5fAIS4vH
tmXkqpSCOVeWUrJV9QvZn6L227ZwuE15cWi8DCDal3Ue90WgAJJZMfTshN4OI8cq
W9E4EG9wglbEtMnObHlms8F3CHmrw3k6KmUkWGoa+/ENmcVl68u/cMRl1JbW2bM+
/3A+SAg2c6iPDlehczKx2oa95QW0SkPPWGuNA/CE8CpyANIhu9XFrj3RQ3EqeRcS
AQQod1RNuHpfETLU/A2gMmvn/w/sx7TB3W5BPs6rprOA37tutPq9u6FTZOcG1Oqj
C/B7yTqgI7rbyvox7DEXoX7rIiEqyNNUguTk/u3SZ4VXE2kmxdmSh3TQvybfbnXV
4JbCZVaqiZraqc7oZMnRoWrXRG3ztbnbes/9qhRGI7PqXqeKJBztxRTEVj8ONs1d
WN5szTwaPIvhkhO3CO5ErU2rVdUr89wKpNXbBODFKRtgxUT70YpmJ46VVaqdAhOZ
D9EUUn4YaeLaS8AjSF/h7UkjOibNc4qVDiPP+rkehFWM66PVnP1Msh93tc+taIfC
EYVMxjh8zNbFuoc7fzvvrFILLe7ifvEIUqSVIC/AzplM/Jxw7buXFeGP1qVCBEHq
391d/9RAfaZ12zkwFsl+IKwE/OZxW8AHa9i1p4GO0YSNuczzEm4=
-----END CERTIFICATE-----
31 changes: 31 additions & 0 deletions ui/src/main/res/raw/acq_tinkoff_root_cert.cer
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
-----BEGIN CERTIFICATE-----
MIIFVDCCAzygAwIBAgIQchJ4p+qpbrJMjzfTwBLEajANBgkqhkiG9w0BAQsFADAy
MRkwFwYDVQQKExBKU0MgVGlua29mZiBCYW5rMRUwEwYDVQQDEwxUaW5rb2ZmIEJh
bmswHhcNMjAwNjIzMTgwNzE0WhcNMzUwNjIzMTgxNz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