Skip to content

Commit

Permalink
feat: add taxJurisdictionCode field to business partner's physical ad…
Browse files Browse the repository at this point in the history
…dress

- changed API models
- added database column
- adapted the mappings
- enhanced the test data
- updated the api documentation

implements to #955
  • Loading branch information
nicoprow committed Jun 25, 2024
1 parent 7e3bd98 commit bb49223
Show file tree
Hide file tree
Showing 32 changed files with 296 additions and 99 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ For changes to the BPDM Helm charts please consult the [changelog](charts/bpdm/C

- BPDM Gate: Post endpoint to upload business partner input data using csv file.(#700)
- BPDM Gate: GET endpoint to download the csv file template for business partner upload. (#700)
- Apps: Tax Jurisdiction Code to the physical address of a business partner (#955)

## [6.0.1] - [2024-05-27]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ object BusinessPartnerGenericCommonValues {
industrialZone = "industrial-zone",
building = "building",
floor = "floor",
door = "door"
door = "door",
taxJurisdictionCode = "123"
),
alternativeAddress = AlternativeAddress(
geographicCoordinates = GeoCoordinate(0.6f, 0.6f, 0.6f),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ class BusinessPartnerTestDataFactory(
industrialZone = "Industrial Zone $seed",
building = "Building $seed",
floor = "Floor $seed",
door = "Door $seed"
door = "Door $seed",
taxJurisdictionCode = "123"
),
alternativeAddress = AlternativeAddress(
geographicCoordinates = GeoCoordinate(longitude = random.nextFloat(), latitude = random.nextFloat(), altitude = random.nextFloat()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ object BusinessPartnerNonVerboseValues {
floor = BusinessPartnerVerboseValues.address1.floor,
door = BusinessPartnerVerboseValues.address1.door,
street = BusinessPartnerVerboseValues.address1.street,
taxJurisdictionCode = BusinessPartnerVerboseValues.address1.taxJurisdictionCode
)

private val postalAddress2 = PhysicalPostalAddressDto(
Expand All @@ -192,6 +193,7 @@ object BusinessPartnerNonVerboseValues {
floor = BusinessPartnerVerboseValues.address2.floor,
door = BusinessPartnerVerboseValues.address2.door,
street = BusinessPartnerVerboseValues.address2.street,
taxJurisdictionCode = BusinessPartnerVerboseValues.address2.taxJurisdictionCode
)

private val postalAddress3 = PhysicalPostalAddressDto(
Expand All @@ -209,6 +211,7 @@ object BusinessPartnerNonVerboseValues {
floor = BusinessPartnerVerboseValues.address3.floor,
door = BusinessPartnerVerboseValues.address3.door,
street = BusinessPartnerVerboseValues.address3.street,
taxJurisdictionCode = BusinessPartnerVerboseValues.address3.taxJurisdictionCode
)

val logisticAddress1 = LogisticAddressDto(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ class BusinessPartnerRequestFactory(
industrialZone = "Industrial Zone $seed",
building = "Building $seed",
floor = "Floor $seed",
door = "Door $seed"
door = "Door $seed",
taxJurisdictionCode = "Tax Jurisdiction Code $seed"
),
alternativePostalAddress = AlternativePostalAddressDto(
geographicCoordinates = GeoCoordinateDto(longitude = random.nextFloat(), latitude = random.nextFloat(), altitude = random.nextFloat()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ object BusinessPartnerVerboseValues {
additionalNameSuffix = "add name suffix 1",
additionalNamePrefix = "add name prefix 1"
),
taxJurisdictionCode = "123"
)

val address2 = PhysicalPostalAddressVerboseDto(
Expand All @@ -189,7 +190,8 @@ object BusinessPartnerVerboseValues {
namePrefix = "name prefix 2",
additionalNameSuffix = "add name suffix 2",
additionalNamePrefix = "add name prefix 2"
)
),
taxJurisdictionCode = "456"
)

val address3 = PhysicalPostalAddressVerboseDto(
Expand Down Expand Up @@ -217,6 +219,7 @@ object BusinessPartnerVerboseValues {
additionalNameSuffix = "add name suffix 3",
additionalNamePrefix = "add name prefix 3"
),
taxJurisdictionCode = "789"
)

val addressPartner1 = LogisticAddressVerboseDto(
Expand Down Expand Up @@ -361,6 +364,7 @@ object BusinessPartnerVerboseValues {
floor = null,
door = null,
street = null,
taxJurisdictionCode = null
),
bpnLegalEntity = null,
bpnSite = null,
Expand Down Expand Up @@ -401,6 +405,7 @@ object BusinessPartnerVerboseValues {
floor = null,
door = null,
street = null,
taxJurisdictionCode = null
),
bpnLegalEntity = null,
bpnSite = null,
Expand Down Expand Up @@ -441,6 +446,7 @@ object BusinessPartnerVerboseValues {
floor = null,
door = null,
street = null,
taxJurisdictionCode = null
),
bpnLegalEntity = null,
bpnSite = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,18 @@ class ExpectedBusinessPartnerResultFactory(
geographicCoordinates = geographicCoordinates,
countryVerbose = TypeKeyNameVerboseDto(country, country.getName()),
administrativeAreaLevel1Verbose = administrativeAreaLevel1?.let { mapToExpectedResult(it) },
administrativeAreaLevel2, administrativeAreaLevel3, postalCode, city, district, street, companyPostalCode, industrialZone, building, floor, door
administrativeAreaLevel2,
administrativeAreaLevel3,
postalCode,
city,
district,
street,
companyPostalCode,
industrialZone,
building,
floor,
door,
taxJurisdictionCode
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,7 @@ interface IBasePhysicalPostalAddressDto {

@get:Schema(description = PostalAddressDescription.door)
val door: String?

@get:Schema(description = PostalAddressDescription.taxJurisdictionCode)
val taxJurisdictionCode: String?
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,7 @@ object PostalAddressDescription {
"is assigned multiple times in some cities."
const val deliveryServiceNumber = "The number indicating the delivery service endpoint of the alternative postal address to which the delivery is " +
"to be delivered, such as a P.O. box number or a private bag number."

const val taxJurisdictionCode =
"Tax jurisdiction codes are used to identify the specific jurisdiction(s) that a company belong to, particularly in bureaucratic processes such as tax returns and IRS forms."
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ data class PhysicalPostalAddressDto(
override val industrialZone: String? = null,
override val building: String? = null,
override val floor: String? = null,
override val door: String? = null
override val door: String? = null,
override val taxJurisdictionCode: String? = null

) : IBasePhysicalPostalAddressDto
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,11 @@ data class PhysicalPostalAddressDb(
* Describes the door/room/suite on the respective floor the delivery shall take place
*/
@Column(name = "phy_door")
val door: String?
val door: String?,

/**
* The tax jurisdiction code defines the tax authority to which taxes must be paid
*/
@Column(name = "phy_tax_jurisdiction")
val taxJurisdictionCode: String? = null
)
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@ data class PhysicalPostalAddress(
val industrialZone: String?,
val building: String?,
val floor: String?,
val door: String?
val door: String?,
val taxJurisdictionCode: String?
)
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,8 @@ class BusinessPartnerMappings {
industrialZone = dto.industrialZone,
building = dto.building,
floor = dto.floor,
door = dto.door
door = dto.door,
taxJurisdictionCode = dto.taxJurisdictionCode
)

private fun toAlternativePostalAddress(dto: AlternativePostalAddressDto) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@ class GoldenRecordUpdateService(
building = building,
floor = floor,
door = door,
street = street?.toUpsertData()
street = street?.toUpsertData(),
taxJurisdictionCode = taxJurisdictionCode
)
}

Expand Down Expand Up @@ -345,7 +346,8 @@ class GoldenRecordUpdateService(
industrialZone = industrialZone,
building = building,
floor = floor,
door = door
door = door,
taxJurisdictionCode = taxJurisdictionCode
)

private fun StreetDto.toEntity() =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ class OrchestratorMappings(
industrialZone = industrialZone,
building = building,
floor = floor,
door = door
door = door,
taxJurisdictionCode = taxJurisdictionCode
)
}
} ?: PhysicalAddress.empty,
Expand Down Expand Up @@ -272,7 +273,8 @@ class OrchestratorMappings(
industrialZone = dto.industrialZone,
building = dto.building,
floor = dto.floor,
door = dto.door
door = dto.door,
taxJurisdictionCode = dto.taxJurisdictionCode
)

private fun toAlternativePostalAddress(dto: AlternativeAddress) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ fun PhysicalPostalAddressDb.toPhysicalPostalAddress(): PhysicalPostalAddressDto
building = building,
floor = floor,
door = door,
street = street?.toStreetDto()
street = street?.toStreetDto(),
taxJurisdictionCode = taxJurisdictionCode
)

fun GeographicCoordinateDb.toGeographicCoordinateDto(): GeoCoordinateDto {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE postal_addresses
ADD COLUMN phy_tax_jurisdiction VARCHAR(255);
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,15 @@ data class PhysicalAddress(
val industrialZone: String?,
val building: String?,
val floor: String?,
val door: String?
val door: String?,
val taxJurisdictionCode: String?
){
companion object {
val empty: PhysicalAddress = PhysicalAddress(
GeoCoordinate.empty, null, null, null,
null, null, null, null, Street.empty, null, null,
null, null, null )
null, null, null, null
)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ data class PhysicalPostalAddressDto(
override val industrialZone: String?,
override val building: String?,
override val floor: String?,
override val door: String?
override val door: String?,
override val taxJurisdictionCode: String?

) : IBasePhysicalPostalAddressDto
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ data class PhysicalPostalAddressVerboseDto(
override val industrialZone: String?,
override val building: String?,
override val floor: String?,
override val door: String?
override val door: String?,
override val taxJurisdictionCode: String?

) : IBasePhysicalPostalAddressDto {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,9 @@ class PhysicalPostalAddressDb(
@Column(name = "phy_door")
val door: String? = null,

)
/**
* The tax jurisdiction code defines the tax authority to which taxes must be paid
*/
@Column(name = "phy_tax_jurisdiction")
val taxJurisdictionCode: String? = null
)
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,8 @@ class BusinessPartnerBuildService(
industrialZone = physicalAddress.industrialZone,
building = physicalAddress.building,
floor = physicalAddress.floor,
door = physicalAddress.door
door = physicalAddress.door,
taxJurisdictionCode = physicalAddress.taxJurisdictionCode
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ class BusinessPartnerEquivalenceMapper {
additionalNameSuffix
)
}
}
},
taxJurisdictionCode = taxJurisdictionCode
)
},
alternativePostalAddress = with(logisticAddress.alternativePostalAddress) {
Expand Down Expand Up @@ -198,7 +199,8 @@ class BusinessPartnerEquivalenceMapper {
override val industrialZone: String?,
override val building: String?,
override val floor: String?,
override val door: String?
override val door: String?,
override val taxJurisdictionCode: String?
) : IBasePhysicalPostalAddressDto

data class AlternativeEquivalenceDto(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ fun PhysicalPostalAddressDb.toDto(): PhysicalPostalAddressVerboseDto {
building = building,
floor = floor,
door = door,
street = street?.toDto()
street = street?.toDto(),
taxJurisdictionCode = taxJurisdictionCode
)
}

Expand Down
Loading

0 comments on commit bb49223

Please sign in to comment.