Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ de95c481329aa8b821e6e71ac35c1b8bc67e3e86
78c44064f4ec15091bde7a2dc590aa2b3a99341d
03665b75a1e1c3a3cf28df1dec52e91b308e4368
7e25c796da25ae080a952936de535a1228fed448
7ceb871552e5d9cb0379fbba014690aa067061eb
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@

package com.commercetools.api.models.payment;

import java.util.Optional;

import com.commercetools.api.models.common.LocalizedString;
import com.commercetools.api.models.payment_method.PaymentMethodToken;
import com.commercetools.api.models.type.CustomFields;
import com.commercetools.api.models.type.CustomFieldsMixin;

public interface PaymentMethodInfoMixin {

Expand All @@ -26,7 +29,7 @@ public default PaymentMethodInfoDraft toDraft() {
.paymentInterface(getPaymentInterface())
.token(getToken())
.interfaceAccount(getInterfaceAccount())
.custom(getCustom().toDraft())
.custom(Optional.ofNullable(getCustom()).map(CustomFieldsMixin::toDraft).orElse(null))
.build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

package com.commercetools;

import static org.junit.jupiter.api.Assertions.assertNotNull;

import com.commercetools.api.models.common.LocalizedString;
import com.commercetools.api.models.payment.PaymentMethodInfo;

import org.junit.jupiter.api.Test;

public class PaymentMethodInfoMixinTest {
@Test
public void noCustomFieldTest() {
var paymentMethodInfo = PaymentMethodInfo.builder()
.paymentInterface("interface")
.method("method")
.name(LocalizedString.of())
.build();

assertNotNull(paymentMethodInfo.toDraft());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better assert the type here

}
}