File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed
commercetools/commercetools-sdk-java-api/src
main/java/com/commercetools/api/models/payment
test/java/com/commercetools Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change 44import com .commercetools .api .models .common .LocalizedString ;
55import com .commercetools .api .models .payment_method .PaymentMethodToken ;
66import com .commercetools .api .models .type .CustomFields ;
7+ import com .commercetools .api .models .type .CustomFieldsMixin ;
8+
9+ import java .util .Optional ;
710
811public interface PaymentMethodInfoMixin {
912
@@ -26,7 +29,7 @@ public default PaymentMethodInfoDraft toDraft() {
2629 .paymentInterface (getPaymentInterface ())
2730 .token (getToken ())
2831 .interfaceAccount (getInterfaceAccount ())
29- .custom (getCustom (). toDraft ( ))
32+ .custom (Optional . ofNullable ( getCustom ()). map ( CustomFieldsMixin :: toDraft ). orElse ( null ))
3033 .build ();
3134 }
3235}
Original file line number Diff line number Diff line change 1+ package com .commercetools ;
2+
3+ import com .commercetools .api .models .cart_discount .CartDiscountValue ;
4+ import com .commercetools .api .models .cart_discount .CartDiscountValueAbsoluteDraft ;
5+ import com .commercetools .api .models .common .LocalizedString ;
6+ import com .commercetools .api .models .common .Money ;
7+ import com .commercetools .api .models .customer .CustomerResourceIdentifierBuilder ;
8+ import com .commercetools .api .models .payment .PaymentDraft ;
9+ import com .commercetools .api .models .payment .PaymentMethodInfo ;
10+ import org .assertj .core .api .Assert ;
11+ import org .junit .jupiter .api .Test ;
12+ import org .mockito .Mock ;
13+
14+ import static org .assertj .core .api .Assertions .assertThat ;
15+ import static org .junit .jupiter .api .Assertions .assertNotNull ;
16+
17+ public class PaymentMethodInfoMixinTest {
18+ @ Test
19+ public void noCustomFieldTest () {
20+ var paymentMethodInfo = PaymentMethodInfo .builder ()
21+ .paymentInterface ("interface" )
22+ .method ("method" )
23+ .name (LocalizedString .of ())
24+ .build ();
25+
26+ assertNotNull (paymentMethodInfo .toDraft ());
27+ }
28+ }
You can’t perform that action at this time.
0 commit comments