Skip to content

Commit

Permalink
Merge pull request #179 from problemzebra2/178_party_id_types
Browse files Browse the repository at this point in the history
 Wrong PartyId type for DVGW and GLN code numbers #178
  • Loading branch information
phax authored Oct 12, 2023
2 parents 99a98e4 + 39668ed commit 1a7f1e1
Showing 1 changed file with 21 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ public final class AS4BDEWProfileRegistarSPI implements IAS4ProfileRegistrarSPI

public void registerAS4Profile (@Nonnull final IAS4ProfileRegistrar aRegistrar)
{
final IAS4ProfilePModeProvider aDefaultPModeProvider = (i, r, a) -> BDEWPMode.createBDEWPMode (i,
BDEWPMode.BDEW_PARTY_ID_TYPE_BDEW,
r,
BDEWPMode.BDEW_PARTY_ID_TYPE_BDEW,
a,
PMODE_ID_PROVIDER,
true);
final IAS4ProfilePModeProvider aDefaultPModeProvider = (i, r, a) -> BDEWPMode.createBDEWPMode(i,
getType(i),
r,
getType(r),
a,
PMODE_ID_PROVIDER,
true);

if (LOGGER.isDebugEnabled ())
LOGGER.debug ("Registering phase4 profile '" + AS4_PROFILE_ID + "'");
Expand All @@ -64,4 +64,18 @@ public void registerAS4Profile (@Nonnull final IAS4ProfileRegistrar aRegistrar)
aRegistrar.registerProfile (aProfile);
aRegistrar.setDefaultProfile (aProfile);
}

private static String getType(String id)
{
String type;
if (id.startsWith("99")) {
type = BDEWPMode.BDEW_PARTY_ID_TYPE_BDEW;
} else if (id.startsWith("98")) {
type = BDEWPMode.BDEW_PARTY_ID_TYPE_DVGW;
} else {
type = BDEWPMode.BDEW_PARTY_ID_TYPE_GLN;
}
return type;
}

}

0 comments on commit 1a7f1e1

Please sign in to comment.