Removed ProductData from FinTsClient methods

This commit is contained in:
dankl 2019-10-13 17:24:47 +02:00 committed by dankito
parent 816b278dd0
commit db696c0744
2 changed files with 17 additions and 17 deletions

View File

@ -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

View File

@ -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()