5151import com .shopify .model .Shop ;
5252import com .shopify .model .ShopifyAccessTokenRoot ;
5353import com .shopify .model .ShopifyAddress ;
54+ import com .shopify .model .ShopifyAttribute ;
5455import com .shopify .model .ShopifyCustomer ;
5556import com .shopify .model .ShopifyCustomerRoot ;
5657import com .shopify .model .ShopifyCustomerUpdateRequest ;
@@ -1871,7 +1872,22 @@ public void givenSomeValidAccessTokenAndSubdomainAndValidRequestAndCreatingOrder
18711872 shippingLine1 .setTitle ("Testing Title" );
18721873 shippingLine1 .setPrice (new BigDecimal (4.33 ));
18731874 shopifyOrder .setShippingLines (Arrays .asList (shippingLine1 ));
1874-
1875+ shopifyOrder .setFinancialStatus ("pending" );
1876+ shopifyOrder .setNote ("Some note" );
1877+
1878+ final ShopifyAttribute shopifyAttribute1 = new ShopifyAttribute ();
1879+ shopifyAttribute1 .setName ("some-name1" );
1880+ shopifyAttribute1 .setValue ("some-value1" );
1881+ final ShopifyAttribute shopifyAttribute2 = new ShopifyAttribute ();
1882+ shopifyAttribute2 .setName ("some-name2" );
1883+ shopifyAttribute2 .setValue ("some-value2" );
1884+ final ShopifyAttribute shopifyAttribute3 = new ShopifyAttribute ();
1885+ shopifyAttribute3 .setName ("some-name3" );
1886+ shopifyAttribute3 .setValue ("some-value3" );
1887+ final List <ShopifyAttribute > someNoteAttributes = Arrays .asList (shopifyAttribute1 , shopifyAttribute2 ,
1888+ shopifyAttribute3 );
1889+
1890+ shopifyOrder .setNoteAttributes (someNoteAttributes );
18751891 shopifyOrderRoot .setOrder (shopifyOrder );
18761892
18771893 final String expectedResponseBodyString = getJsonString (ShopifyOrderRoot .class , shopifyOrderRoot );
@@ -1887,7 +1903,8 @@ public void givenSomeValidAccessTokenAndSubdomainAndValidRequestAndCreatingOrder
18871903 final ShopifyOrderCreationRequest shopifyOrderRequest = ShopifyOrderCreationRequest .newBuilder ()
18881904 .withProcessedAt (processedAt ).withName ("123456" ).withCustomer (shopifyCustomer )
18891905 .withLineItems (shopifyLineItems ).withShippingAddress (address ).withBillingAddress (address )
1890- .withMetafields (Collections .emptyList ()).withShippingLines (Arrays .asList (shippingLine1 )).build ();
1906+ .withMetafields (Collections .emptyList ()).withShippingLines (Arrays .asList (shippingLine1 ))
1907+ .withFinancialStatus ("pending" ).withNote ("Some note" ).withNoteAttributes (someNoteAttributes ).build ();
18911908 final ShopifyOrder actualShopifyOrder = shopifySdk .createOrder (shopifyOrderRequest );
18921909
18931910 assertEquals ("123456" , actualRequestBody .getContent ().get ("order" ).get ("name" ).asText ());
@@ -1920,6 +1937,22 @@ public void givenSomeValidAccessTokenAndSubdomainAndValidRequestAndCreatingOrder
19201937 assertEquals (0 , actualRequestBody .getContent ().get ("order" ).get ("line_items" ).path (1 )
19211938 .get ("fulfillable_quantity" ).asInt ());
19221939
1940+ assertEquals ("pending" , actualRequestBody .getContent ().get ("order" ).get ("financial_status" ).asText ());
1941+ assertEquals ("Some note" , actualRequestBody .getContent ().get ("order" ).get ("note" ).asText ());
1942+ assertEquals (3 , actualRequestBody .getContent ().get ("order" ).get ("note_attributes" ).size ());
1943+ assertEquals (someNoteAttributes .get (0 ).getName (),
1944+ actualRequestBody .getContent ().get ("order" ).get ("note_attributes" ).path (0 ).get ("name" ).asText ());
1945+ assertEquals (someNoteAttributes .get (0 ).getValue (),
1946+ actualRequestBody .getContent ().get ("order" ).get ("note_attributes" ).path (0 ).get ("value" ).asText ());
1947+ assertEquals (someNoteAttributes .get (1 ).getName (),
1948+ actualRequestBody .getContent ().get ("order" ).get ("note_attributes" ).path (1 ).get ("name" ).asText ());
1949+ assertEquals (someNoteAttributes .get (1 ).getValue (),
1950+ actualRequestBody .getContent ().get ("order" ).get ("note_attributes" ).path (1 ).get ("value" ).asText ());
1951+ assertEquals (someNoteAttributes .get (2 ).getName (),
1952+ actualRequestBody .getContent ().get ("order" ).get ("note_attributes" ).path (2 ).get ("name" ).asText ());
1953+ assertEquals (someNoteAttributes .get (2 ).getValue (),
1954+ actualRequestBody .getContent ().get ("order" ).get ("note_attributes" ).path (2 ).get ("value" ).asText ());
1955+
19231956 assertEquals ("Customer-Id" , actualRequestBody .getContent ().get ("order" ).get ("customer" ).get ("id" ).asText ());
19241957 assertEquals ("Ryan" , actualRequestBody .getContent ().get ("order" ).get ("customer" ).get ("first_name" ).asText ());
19251958 assertEquals ("Kazokas" , actualRequestBody .getContent ().get ("order" ).get ("customer" ).get ("last_name" ).asText ());
0 commit comments