payment: Fix code issue from (wrong if condition)
@@ -128,7 +128,7 @@ public class ControlPluginRunner {
if (prevResult.getAdjustedPaymentMethodId() != null) {
// We only allow setting the paymentMethodId but disallow overwriting an existing paymentMethodId for a given Payment - See #1097
// unless the property isAllowedToOverwritePaymentMethodId was explicitly configured to allow this
- if (paymentConfig.isAllowedToOverwritePaymentMethodId() || paymentMethodId != null) {
+ if (!paymentConfig.isAllowedToOverwritePaymentMethodId() && paymentMethodId != null) {
throw new PaymentControlApiException(String.format("Not allowed to overwrite paymentMethodId '%s' for payment '%s'",
paymentMethodId, paymentId));
}
