From db696c074414897305139942d4d08dd91a96fd39 Mon Sep 17 00:00:00 2001 From: dankl Date: Sun, 13 Oct 2019 17:24:47 +0200 Subject: [PATCH] Removed ProductData from FinTsClient methods --- .../kotlin/net/dankito/fints/FinTsClient.kt | 24 ++++++++++--------- .../net/dankito/fints/FinTsClientTest.kt | 10 ++++---- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/fints4javaLib/src/main/kotlin/net/dankito/fints/FinTsClient.kt b/fints4javaLib/src/main/kotlin/net/dankito/fints/FinTsClient.kt index 8e58e415..1fd82cbb 100644 --- a/fints4javaLib/src/main/kotlin/net/dankito/fints/FinTsClient.kt +++ b/fints4javaLib/src/main/kotlin/net/dankito/fints/FinTsClient.kt @@ -20,7 +20,8 @@ open class FinTsClient( protected val base64Service: IBase64Service, protected val webClient: IWebClient = OkHttpWebClient(), protected val messageBuilder: MessageBuilder = MessageBuilder(), - protected val responseParser: ResponseParser = ResponseParser() + protected val responseParser: ResponseParser = ResponseParser(), + protected val product: ProductData = ProductData("15E53C26816138699C7B6A3E8", "0.1") // TODO: get version dynamically ) { companion object { @@ -28,7 +29,7 @@ open class FinTsClient( } - open fun getAnonymousBankInfo(bank: BankData, product: ProductData): Response { + open fun getAnonymousBankInfo(bank: BankData): Response { val dialogData = DialogData() val requestBody = messageBuilder.createAnonymousDialogInitMessage(bank, product, dialogData) @@ -50,8 +51,7 @@ open class FinTsClient( } - open fun initDialog(bank: BankData, customer: CustomerData, product: ProductData, - dialogData: DialogData): Response { + open fun initDialog(bank: BankData, customer: CustomerData, dialogData: DialogData): Response { val requestBody = messageBuilder.createInitDialogMessage(bank, customer, product, dialogData) @@ -67,9 +67,9 @@ open class FinTsClient( return response } - open fun synchronizeCustomerSystemId(bank: BankData, customer: CustomerData, product: ProductData, - dialogData: DialogData = DialogData()): Response { + open fun synchronizeCustomerSystemId(bank: BankData, customer: CustomerData): Response { + val dialogData = DialogData() val requestBody = messageBuilder.createSynchronizeCustomerSystemIdMessage(bank, customer, product, dialogData) val response = getAndHandleResponseForMessage(requestBody, bank) @@ -87,12 +87,12 @@ open class FinTsClient( } - open fun getTransactions(parameter: GetTransactionsParameter, bank: BankData, customer: CustomerData, - product: ProductData): Response { + open fun getTransactions(parameter: GetTransactionsParameter, bank: BankData, + customer: CustomerData): Response { val dialogData = DialogData() - val initDialogResponse = initDialog(bank, customer, product, dialogData) + val initDialogResponse = initDialog(bank, customer, dialogData) if (initDialogResponse.successful == false) { return initDialogResponse @@ -122,10 +122,12 @@ open class FinTsClient( } - open fun doBankTransfer(bankTransferData: BankTransferData, bank: BankData, customer: CustomerData, product: ProductData): Response { + open fun doBankTransfer(bankTransferData: BankTransferData, bank: BankData, + customer: CustomerData): Response { + val dialogData = DialogData() - val initDialogResponse = initDialog(bank, customer, product, dialogData) + val initDialogResponse = initDialog(bank, customer, dialogData) if (initDialogResponse.successful == false) { return initDialogResponse diff --git a/fints4javaLib/src/test/kotlin/net/dankito/fints/FinTsClientTest.kt b/fints4javaLib/src/test/kotlin/net/dankito/fints/FinTsClientTest.kt index f85b2239..e8382f35 100644 --- a/fints4javaLib/src/test/kotlin/net/dankito/fints/FinTsClientTest.kt +++ b/fints4javaLib/src/test/kotlin/net/dankito/fints/FinTsClientTest.kt @@ -29,15 +29,13 @@ class FinTsClientTest { // transfer 1 cent to yourself. Transferring money to oneself also doesn't require to enter a TAN according to PSD2 private val BankTransferData = BankTransferData(Customer.name, Customer.iban!!, Bank.bic!!, 0.01.toBigDecimal(), "Give it to me baby") - private val Product = ProductData("8F0F174B4CE4AE046FA76061E", "1") - @Test fun getAnonymousBankInfo() { // when - val result = underTest.getAnonymousBankInfo(BankDataAnonymous, Product) + val result = underTest.getAnonymousBankInfo(BankDataAnonymous) // then assertThat(result.successful).isTrue() @@ -48,7 +46,7 @@ class FinTsClientTest { fun synchronizeCustomerSystemId() { // when - val result = underTest.synchronizeCustomerSystemId(Bank, Customer, Product) + val result = underTest.synchronizeCustomerSystemId(Bank, Customer) // then assertThat(result.successful).isTrue() @@ -67,7 +65,7 @@ class FinTsClientTest { val ninetyDaysAgo = Date(Date().time - ninetyDaysAgoMilliseconds) // when - val result = underTest.getTransactions(GetTransactionsParameter(ninetyDaysAgo), Bank, Customer, Product) + val result = underTest.getTransactions(GetTransactionsParameter(ninetyDaysAgo), Bank, Customer) // then assertThat(result.successful).isTrue() @@ -78,7 +76,7 @@ class FinTsClientTest { fun testBankTransfer() { // when - val result = underTest.doBankTransfer(BankTransferData, Bank, Customer, Product) + val result = underTest.doBankTransfer(BankTransferData, Bank, Customer) // then assertThat(result.successful).isTrue()