Updated to new method signatures
This commit is contained in:
parent
2c1c690302
commit
8b1051092a
|
@ -28,6 +28,9 @@ import java.io.File
|
||||||
import java.io.FileWriter
|
import java.io.FileWriter
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
import java.util.concurrent.CountDownLatch
|
||||||
|
import java.util.concurrent.TimeUnit
|
||||||
|
import java.util.concurrent.atomic.AtomicReference
|
||||||
|
|
||||||
|
|
||||||
@Ignore // not a real test, run manually to retrieve FinTS information from all banks
|
@Ignore // not a real test, run manually to retrieve FinTS information from all banks
|
||||||
|
@ -48,8 +51,8 @@ class BanksFinTsDetailsRetriever {
|
||||||
|
|
||||||
private val finTsClient = object : FinTsClient(NoOpFinTsClientCallback(), KtorWebClient(), PureKotlinBase64Service()) {
|
private val finTsClient = object : FinTsClient(NoOpFinTsClientCallback(), KtorWebClient(), PureKotlinBase64Service()) {
|
||||||
|
|
||||||
suspend fun getAndHandleResponseForMessagePublic(message: MessageBuilderResult, dialogContext: DialogContext): Response {
|
fun getAndHandleResponseForMessagePublic(message: MessageBuilderResult, dialogContext: DialogContext, callback: (Response) -> Unit) {
|
||||||
return getAndHandleResponseForMessage(message, dialogContext)
|
getAndHandleResponseForMessage(message, dialogContext, callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateBankDataPublic(bank: BankData, response: Response) {
|
fun updateBankDataPublic(bank: BankData, response: Response) {
|
||||||
|
@ -122,15 +125,23 @@ class BanksFinTsDetailsRetriever {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private suspend fun getAnonymousBankInfo(bank: BankData): Response {
|
private fun getAnonymousBankInfo(bank: BankData): Response {
|
||||||
val dialogContext = DialogContext(bank, CustomerData.Anonymous, product)
|
val dialogContext = DialogContext(bank, CustomerData.Anonymous, product)
|
||||||
val requestBody = messageBuilder.createAnonymousDialogInitMessage(dialogContext)
|
val requestBody = messageBuilder.createAnonymousDialogInitMessage(dialogContext)
|
||||||
|
|
||||||
val anonymousBankInfoResponse =
|
val anonymousBankInfoResponse = AtomicReference<Response>()
|
||||||
finTsClient.getAndHandleResponseForMessagePublic(requestBody, dialogContext)
|
val countDownLatch = CountDownLatch(1)
|
||||||
|
|
||||||
finTsClient.updateBankDataPublic(bank, anonymousBankInfoResponse)
|
finTsClient.getAndHandleResponseForMessagePublic(requestBody, dialogContext) {
|
||||||
return anonymousBankInfoResponse
|
anonymousBankInfoResponse.set(it)
|
||||||
|
countDownLatch.countDown()
|
||||||
|
}
|
||||||
|
|
||||||
|
countDownLatch.await(30, TimeUnit.SECONDS)
|
||||||
|
|
||||||
|
finTsClient.updateBankDataPublic(bank, anonymousBankInfoResponse.get())
|
||||||
|
|
||||||
|
return anonymousBankInfoResponse.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getAndSaveBankDetails(bankInfo: BankInfo, responsesFolder: File, csvPrinter: CSVPrinter) = runBlocking {
|
private fun getAndSaveBankDetails(bankInfo: BankInfo, responsesFolder: File, csvPrinter: CSVPrinter) = runBlocking {
|
||||||
|
|
Loading…
Reference in New Issue