File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Customer Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ class Webapi extends AbstractWebapi implements CustomerInterface
70
70
'default_shipping ' ,
71
71
'addresses ' ,
72
72
'disable_auto_group_change ' ,
73
+ 'custom_attribute ' ,
73
74
];
74
75
75
76
/**
@@ -115,6 +116,29 @@ protected function prepareData(Customer $customer)
115
116
unset($ data ['customer ' ]['password_confirmation ' ]);
116
117
$ data = $ this ->prepareAddressData ($ data );
117
118
$ data = $ this ->prepareExtensionAttributes ($ data );
119
+ $ data = $ this ->prepareCustomAttributes ($ data );
120
+ return $ data ;
121
+ }
122
+
123
+ /**
124
+ * Prepare Custom Attributes.
125
+ *
126
+ * @param array $data
127
+ * @return array
128
+ */
129
+ protected function prepareCustomAttributes (array $ data )
130
+ {
131
+ if (isset ($ data ['customer ' ]['custom_attribute ' ])) {
132
+ $ data ['customer ' ]['custom_attribute ' ]['attribute_code ' ] = $ data ['customer ' ]['custom_attribute ' ]['code ' ];
133
+ unset($ data ['customer ' ]['custom_attribute ' ]['code ' ]);
134
+ if (is_array ($ data ['customer ' ]['custom_attribute ' ]['value ' ])) {
135
+ $ data ['customer ' ]['custom_attribute ' ]['value ' ] =
136
+ implode (', ' , $ data ['customer ' ]['custom_attribute ' ]['value ' ]);
137
+ }
138
+ $ data ['customer ' ]['custom_attributes ' ][0 ] = $ data ['customer ' ]['custom_attribute ' ];
139
+ unset($ data ['customer ' ]['custom_attribute ' ]);
140
+ }
141
+
118
142
return $ data ;
119
143
}
120
144
You can’t perform that action at this time.
0 commit comments