@@ -63,6 +63,11 @@ public function testGetCustomerOrdersSimpleProductQuery()
63
63
number
64
64
status
65
65
order_date
66
+ payment_methods{name type additional_data{ name value}}
67
+ shipping_address{firstname lastname city company country_code fax middlename postcode prefix street region
68
+ region_id suffix telephone vat_id}
69
+ billing_address{firstname lastname city company country_code fax middlename postcode prefix street region
70
+ region_id suffix telephone vat_id}
66
71
items{
67
72
quantity_ordered
68
73
product_sku
@@ -105,6 +110,9 @@ public function testGetCustomerOrdersSimpleProductQuery()
105
110
$ customerOrderItemsInResponse = $ response ['customer ' ]['orders ' ]['items ' ][0 ];
106
111
$ this ->assertArrayHasKey ('items ' , $ customerOrderItemsInResponse );
107
112
$ this ->assertNotEmpty ($ customerOrderItemsInResponse ['items ' ]);
113
+ $ this ->assertNotEmpty ($ response ["customer " ]["orders " ]["items " ][0 ]["billing_address " ]);
114
+ $ this ->assertNotEmpty ($ response ["customer " ]["orders " ]["items " ][0 ]["shipping_address " ]);
115
+ $ this ->assertNotEmpty ($ response ["customer " ]["orders " ]["items " ][0 ]["payment_methods " ]);
108
116
109
117
$ searchCriteria = $ this ->searchCriteriaBuilder ->addFilter ('increment_id ' , '100000002 ' )
110
118
->create ();
@@ -154,6 +162,9 @@ public function testCustomerOrdersSimpleProductWithTaxesAndDiscounts()
154
162
$ this ->setPaymentMethod ($ cartId , $ paymentMethod );
155
163
$ orderNumber = $ this ->placeOrder ($ cartId );
156
164
$ customerOrderResponse = $ this ->getCustomerOrderQuery ($ orderNumber );
165
+ $ this ->assertOrderBillingAddress ($ customerOrderResponse [0 ]["billing_address " ]);
166
+ $ this ->assertOrderShippingAddress ($ customerOrderResponse [0 ]["shipping_address " ]);
167
+ $ this ->assertOrderPaymentMethod ($ customerOrderResponse [0 ]["payment_methods " ]);
157
168
// Asserting discounts on order item level
158
169
$ this ->assertEquals (4 , $ customerOrderResponse [0 ]['items ' ][0 ]['discounts ' ][0 ]['amount ' ]['value ' ]);
159
170
$ this ->assertEquals ('USD ' , $ customerOrderResponse [0 ]['items ' ][0 ]['discounts ' ][0 ]['amount ' ]['currency ' ]);
@@ -166,6 +177,77 @@ public function testCustomerOrdersSimpleProductWithTaxesAndDiscounts()
166
177
$ this ->deleteOrder ();
167
178
}
168
179
180
+ /**
181
+ * Check order billing address
182
+ *
183
+ * @param array $customerOrderBillingAddress
184
+ */
185
+ private function assertOrderBillingAddress (array $ customerOrderBillingAddress ): void
186
+ {
187
+ $ assertionMap = [
188
+ 'firstname ' => 'John ' ,
189
+ 'lastname ' => 'Smith ' ,
190
+ 'city ' => 'Texas City ' ,
191
+ 'company ' => 'Test company ' ,
192
+ 'country_code ' => 'US ' ,
193
+ 'postcode ' => '78717 ' ,
194
+ 'prefix ' => 'John ' ,
195
+ 'region ' => 'Texas ' ,
196
+ 'region_id ' => '57 ' ,
197
+ 'street ' => [
198
+ 0 => 'test street 1 ' ,
199
+ 1 => 'test street 2 ' ,
200
+ ],
201
+ 'suffix ' => 'John ' ,
202
+ 'telephone ' => '5123456677 '
203
+ ];
204
+ $ this ->assertResponseFields ($ customerOrderBillingAddress , $ assertionMap );
205
+ }
206
+
207
+ /**
208
+ * Check order shipping address
209
+ *
210
+ * @param array $customerOrderShippingAddress
211
+ */
212
+ private function assertOrderShippingAddress (array $ customerOrderShippingAddress ): void
213
+ {
214
+ $ assertionMap = [
215
+ 'firstname ' => 'test shipFirst ' ,
216
+ 'lastname ' => 'test shipLast ' ,
217
+ 'city ' => 'Montgomery ' ,
218
+ 'company ' => 'test company ' ,
219
+ 'country_code ' => 'US ' ,
220
+ 'postcode ' => '36013 ' ,
221
+ 'prefix ' => 'test shipFirst ' ,
222
+ 'street ' => [
223
+ 0 => 'test street 1 ' ,
224
+ 1 => 'test street 2 ' ,
225
+ ],
226
+ 'region_id ' => '1 ' ,
227
+ 'region ' => 'Alabama ' ,
228
+ 'suffix ' => 'test shipFirst ' ,
229
+ 'telephone ' => '3347665522 '
230
+ ];
231
+ $ this ->assertResponseFields ($ customerOrderShippingAddress , $ assertionMap );
232
+ }
233
+
234
+ /**
235
+ * Check order payment method
236
+ *
237
+ * @param array $customerOrderPaymentMethod
238
+ */
239
+ private function assertOrderPaymentMethod (array $ customerOrderPaymentMethod ): void
240
+ {
241
+ $ assertionMap = [
242
+ [
243
+ 'name ' => 'Check / Money order ' ,
244
+ 'type ' => 'checkmo ' ,
245
+ 'additional_data ' => []
246
+ ]
247
+ ];
248
+ $ this ->assertResponseFields ($ customerOrderPaymentMethod , $ assertionMap );
249
+ }
250
+
169
251
/**
170
252
* @param array $customerOrderItemTotal
171
253
*/
@@ -1218,6 +1300,11 @@ private function getCustomerOrderQuery($orderNumber): array
1218
1300
number
1219
1301
order_date
1220
1302
status
1303
+ payment_methods{name type additional_data{ name value}}
1304
+ shipping_address{firstname lastname city company country_code fax middlename postcode prefix street region
1305
+ region_id suffix telephone vat_id}
1306
+ billing_address{firstname lastname city company country_code fax middlename postcode prefix street region
1307
+ region_id suffix telephone vat_id}
1221
1308
items{product_name product_sku quantity_ordered discounts {amount{value currency} label}}
1222
1309
total {
1223
1310
base_grand_total{value currency}
0 commit comments