JD-616: new payout tool (#17)

* JD-616: new payout tool

* JD-616: fix checkstyle

* JD-616: fix test

* JD-616: fix checkstyle

* JD-616: fixes

* JD-616: bump service parent pom

* JD-616: bump spring security
This commit is contained in:
Inal Arsanukaev 2021-08-18 17:03:37 +03:00 committed by GitHub
parent da087182d6
commit 93fe35d83d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 19 deletions

View File

@ -6,7 +6,7 @@
<parent>
<groupId>com.rbkmoney</groupId>
<artifactId>service-parent-pom</artifactId>
<version>1.2.10</version>
<version>1.2.14</version>
</parent>
<artifactId>claim-management-api</artifactId>
@ -27,13 +27,13 @@
<dockerfile.base.service.tag>c0612d6052ac049496b72a23a04acb142035f249</dockerfile.base.service.tag>
<dockerfile.registry>${env.REGISTRY}</dockerfile.registry>
<swag-claim-management.version>1.31-ded0ac5-server</swag-claim-management.version>
<swag-claim-management.version>1.33-1a8ca72-server</swag-claim-management.version>
<org-management-proto.version>1.2-06c5c84</org-management-proto.version>
<bouncer-proto.version>1.21-60cedce</bouncer-proto.version>
<keycloak-spring-security.version>14.0.0</keycloak-spring-security.version>
<bouncycastle-jdk15on.version>1.68</bouncycastle-jdk15on.version>
<spring-cloud-contract-wiremock.version>2.2.4.RELEASE</spring-cloud-contract-wiremock.version>
<spring-security.version>5.4.6</spring-security.version>
<spring-security.version>5.4.7</spring-security.version>
<jjwt.version>0.9.1</jjwt.version>
<random-beans.version>3.6.0</random-beans.version>
</properties>

View File

@ -2,10 +2,12 @@ package com.rbkmoney.claimmanagementapi.converter.party.contract
import com.rbkmoney.claimmanagementapi.converter.DarkApiConverter
import com.rbkmoney.damsel.domain.InternationalBankAccount
import com.rbkmoney.damsel.domain.PaymentInstitutionAccount
import org.springframework.stereotype.Component
import com.rbkmoney.damsel.domain.PayoutToolInfo as ThriftPayoutToolInfo
import com.rbkmoney.damsel.domain.WalletInfo as ThriftWalletInfo
import com.rbkmoney.swag.claim_management.model.InternationalBankAccount as SwagInternationalBankAccount
import com.rbkmoney.swag.claim_management.model.PaymentInstitutionAccount as SwagPaymentInstitutionAccount
import com.rbkmoney.swag.claim_management.model.PayoutToolInfo as SwagPayoutToolInfo
import com.rbkmoney.swag.claim_management.model.RussianBankAccount as SwagRussianBankAccount
import com.rbkmoney.swag.claim_management.model.WalletInfo as SwagWalletInfo
@ -34,6 +36,9 @@ class PayoutToolInfoConverter(
val swagWalletInfo = value as SwagWalletInfo
thriftPayoutToolInfo.walletInfo = ThriftWalletInfo().setWalletId(swagWalletInfo.walletID)
}
SwagPayoutToolInfo.PayoutToolTypeEnum.PAYMENTINSTITUTIONACCOUNT -> {
thriftPayoutToolInfo.paymentInstitutionAccount = PaymentInstitutionAccount()
}
else -> throw IllegalArgumentException("Unknown payout tool type: ${value.payoutToolType}")
}
return thriftPayoutToolInfo
@ -55,6 +60,11 @@ class PayoutToolInfoConverter(
walletID = value.walletInfo.walletId
}
}
value.isSetPaymentInstitutionAccount -> {
SwagPaymentInstitutionAccount().apply {
payoutToolType = SwagPayoutToolInfo.PayoutToolTypeEnum.PAYMENTINSTITUTIONACCOUNT
}
}
else -> throw IllegalArgumentException("Unknown payout tool type!")
}
}

View File

@ -24,7 +24,6 @@ import io.github.benas.randombeans.api.EnhancedRandom
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.RepeatedTest
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.assertThrows
import com.rbkmoney.damsel.claim_management.ContractAdjustmentModificationUnit as ThriftContractAdjustmentModificationUnit
import com.rbkmoney.damsel.claim_management.ContractParams as ThriftContractParams
import com.rbkmoney.damsel.claim_management.PayoutToolModification as ThriftPayoutToolModification
@ -228,21 +227,13 @@ class ContractConvertersTest {
)
val thriftPayoutToolModificationUnit = MockTBaseProcessor(MockMode.REQUIRED_ONLY)
.process(ThriftPayoutToolModificationUnit(), TBaseHandler(ThriftPayoutToolModificationUnit::class.java))
val modification = thriftPayoutToolModificationUnit.modification
// Temporary (hope so) hack
if (modification.isSetInfoModification && modification.infoModification.isSetPaymentInstitutionAccount ||
modification.isSetCreation && modification.creation.toolInfo.isSetPaymentInstitutionAccount
) {
assertThrows<IllegalArgumentException> { converter.convertToSwag(thriftPayoutToolModificationUnit) }
} else {
val resultPayoutToolModificationUnit = converter.convertToThrift(
converter.convertToSwag(thriftPayoutToolModificationUnit)
)
assertEquals(
thriftPayoutToolModificationUnit, resultPayoutToolModificationUnit,
"Thrift objects 'PayoutToolModificationUnit' (MockMode.REQUIRED_ONLY) not equals"
)
}
val resultPayoutToolModificationUnit = converter.convertToThrift(
converter.convertToSwag(thriftPayoutToolModificationUnit)
)
assertEquals(
thriftPayoutToolModificationUnit, resultPayoutToolModificationUnit,
"Thrift objects 'PayoutToolModificationUnit' (MockMode.REQUIRED_ONLY) not equals"
)
}
@Test