Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Checksum change to include also the Prefix BPN(L-S-A) #965

Merged
merged 1 commit into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@ import java.time.ZoneOffset
*/
object BusinessPartnerVerboseValues {

val firstBpnL = "BPNL000000000065"
val secondBpnL = "BPNL00000000015G"
val thirdBpnl = "BPNL00000000024R"

val firstBpnA = "BPNA00000000009W"
val secondBpnA = "BPNA000000000197"
val thirdBpnA = "BPNA00000000028I"

val firstBpnS = "BPNS0000000000WN"
val secondBpnS = "BPNS0000000001VY"
val thirdBpnS = "BPNS0000000002V9"

private val createdTime1 = LocalDateTime.of(2020, 1, 1, 1, 1)
val language0 = TypeKeyNameVerboseDto(LanguageCode.undefined, LanguageCode.undefined.getName())
val language1 = TypeKeyNameVerboseDto(LanguageCode.en, LanguageCode.en.getName())
Expand Down Expand Up @@ -208,7 +220,7 @@ object BusinessPartnerVerboseValues {
)

val addressPartner1 = LogisticAddressVerboseDto(
bpna = "BPNA000000000001",
bpna = firstBpnA,
physicalPostalAddress = address1,
bpnLegalEntity = null,
bpnSite = null,
Expand All @@ -220,7 +232,7 @@ object BusinessPartnerVerboseValues {
)

val addressPartner2 = LogisticAddressVerboseDto(
bpna = "BPNA0000000001YN",
bpna = secondBpnA,
physicalPostalAddress = address2,
bpnLegalEntity = null,
bpnSite = null,
Expand All @@ -232,7 +244,7 @@ object BusinessPartnerVerboseValues {
)

val addressPartner3 = LogisticAddressVerboseDto(
bpna = "BPNA0000000002XY",
bpna = thirdBpnA,
physicalPostalAddress = address3,
bpnLegalEntity = null,
bpnSite = null,
Expand All @@ -259,32 +271,32 @@ object BusinessPartnerVerboseValues {
)

val site1 = SiteVerboseDto(
bpns = "BPNS000000000001",
bpns = firstBpnS,
name = "Stammwerk A",
states = listOf(siteStatus1),
bpnLegalEntity = "BPNL000000000001",
bpnLegalEntity = firstBpnL,
confidenceCriteria = confidenceCriteria1,
isCatenaXMemberData = false,
createdAt = Instant.now(),
updatedAt = Instant.now(),
)

val site2 = SiteVerboseDto(
bpns = "BPNS0000000001YN",
bpns = secondBpnS,
name = "Halle B1",
states = listOf(siteStatus2),
bpnLegalEntity = "BPNL0000000001YN",
bpnLegalEntity = secondBpnL,
confidenceCriteria = confidenceCriteria2,
isCatenaXMemberData = false,
createdAt = Instant.now(),
updatedAt = Instant.now(),
)

val site3 = SiteVerboseDto(
bpns = "BPNS0000000002XY",
bpns = thirdBpnS,
name = "主厂房 C",
states = listOf(siteStatus3),
bpnLegalEntity = "BPNL0000000002XY",
bpnLegalEntity = thirdBpnl,
confidenceCriteria = confidenceCriteria3,
isCatenaXMemberData = false,
createdAt = Instant.now(),
Expand Down Expand Up @@ -321,7 +333,7 @@ object BusinessPartnerVerboseValues {

val legalEntity1 = LegalEntityWithLegalAddressVerboseDto(
LegalEntityVerboseDto(
bpnl = "BPNL000000000001",
bpnl = firstBpnL,
legalName = "Business Partner Name",
legalFormVerbose = legalForm1,
identifiers = listOf(identifier1),
Expand All @@ -333,7 +345,7 @@ object BusinessPartnerVerboseValues {
updatedAt = Instant.now(),
),
legalAddress = LogisticAddressVerboseDto(
bpna = "BPNA000000000001",
bpna = firstBpnA,
physicalPostalAddress = PhysicalPostalAddressVerboseDto(
geographicCoordinates = null,
countryVerbose = country1,
Expand Down Expand Up @@ -361,7 +373,7 @@ object BusinessPartnerVerboseValues {

val legalEntity2 = LegalEntityWithLegalAddressVerboseDto(
LegalEntityVerboseDto(
bpnl = "BPNL0000000001YN",
bpnl = secondBpnL,
legalName = "Another Organisation Corp",
legalFormVerbose = legalForm2,
identifiers = listOf(identifier2),
Expand All @@ -373,7 +385,7 @@ object BusinessPartnerVerboseValues {
updatedAt = Instant.now(),
),
legalAddress = LogisticAddressVerboseDto(
bpna = "BPNA000000000001",
bpna = firstBpnA,
physicalPostalAddress = PhysicalPostalAddressVerboseDto(
geographicCoordinates = null,
countryVerbose = country2,
Expand Down Expand Up @@ -401,7 +413,7 @@ object BusinessPartnerVerboseValues {

val legalEntity3 = LegalEntityWithLegalAddressVerboseDto(
LegalEntityVerboseDto(
bpnl = "BPNL0000000002XY",
bpnl = thirdBpnl,
legalName = "好公司 合伙制企业",
legalFormVerbose = legalForm3,
identifiers = listOf(identifier3),
Expand All @@ -413,7 +425,7 @@ object BusinessPartnerVerboseValues {
updatedAt = Instant.now(),
),
legalAddress = LogisticAddressVerboseDto(
bpna = "BPNA000000000001",
bpna = firstBpnA,
physicalPostalAddress = PhysicalPostalAddressVerboseDto(
geographicCoordinates = null,
countryVerbose = country3,
Expand Down Expand Up @@ -441,7 +453,7 @@ object BusinessPartnerVerboseValues {

val legalEntityUpsert1 = LegalEntityPartnerCreateVerboseDto(
legalEntity = LegalEntityVerboseDto(
bpnl = "BPNL000000000001",
bpnl = firstBpnL,
legalName = "Business Partner Name",
legalFormVerbose = legalForm1,
identifiers = listOf(LegalEntityIdentifierVerboseDto("ID-XYZ", identifierType1, "Agency X")),
Expand All @@ -461,7 +473,7 @@ object BusinessPartnerVerboseValues {

val legalEntityUpsert2 = LegalEntityPartnerCreateVerboseDto(
legalEntity = LegalEntityVerboseDto(
bpnl = "BPNL0000000001YN",
bpnl = secondBpnL,
legalName = "Another Organisation Corp",
legalFormVerbose = legalForm2,
identifiers = listOf(LegalEntityIdentifierVerboseDto("Another ID Value", identifierType2, "Body Y")),
Expand All @@ -481,7 +493,7 @@ object BusinessPartnerVerboseValues {

val legalEntityUpsert3 = LegalEntityPartnerCreateVerboseDto(
legalEntity = LegalEntityVerboseDto(
bpnl = "BPNL0000000002XY",
bpnl = thirdBpnl,
legalName = "好公司 合伙制企业",
legalFormVerbose = legalForm3,
identifiers = listOf(LegalEntityIdentifierVerboseDto("An ID Value", identifierType3, "Official Z")),
Expand All @@ -501,7 +513,7 @@ object BusinessPartnerVerboseValues {

val legalEntityUpsertMultipleIdentifier = LegalEntityPartnerCreateVerboseDto(
legalEntity = LegalEntityVerboseDto(
bpnl = "BPNL000000000001",
bpnl = firstBpnL,
legalName = "Business Partner Name",
legalFormVerbose = legalForm1,
identifiers = listOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class BpnIssuingService(

private fun createBpn(number: Long, bpnChar: Char): String {
val code = toBpnCode(number)
val checksum = calculateChecksum(code)
val checksum = calculateChecksum(bpnConfigProperties.id + bpnChar + code)

return "${bpnConfigProperties.id}$bpnChar$code$checksum"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -492,15 +492,15 @@ class SiteControllerIT @Autowired constructor(
BusinessPartnerVerboseValues.addressPartner1.copy(
addressType = AddressType.SiteMainAddress,
bpnSite = BusinessPartnerVerboseValues.site1.bpns,
bpna = "BPNA0000000001YN"
bpna = BusinessPartnerVerboseValues.secondBpnA
)
val site1 = BusinessPartnerVerboseValues.site1.copy(bpnLegalEntity = bpnL1)

val legalAddress2: LogisticAddressVerboseDto =
BusinessPartnerVerboseValues.addressPartner2.copy(
addressType = AddressType.SiteMainAddress,
bpnSite = BusinessPartnerVerboseValues.site2.bpns,
bpna = "BPNA0000000002XY"
bpna = BusinessPartnerVerboseValues.thirdBpnA
)
val site2 = BusinessPartnerVerboseValues.site2.copy(bpnLegalEntity = bpnL1)

Expand Down