Skip to content

Commit 18217a7

Browse files
committed
Merge branch 'release/2.5.0'
2 parents b532fa9 + 39873ba commit 18217a7

File tree

7 files changed

+72
-2
lines changed

7 files changed

+72
-2
lines changed

.github/workflows/maven-feature-hotfix.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
name: Shopify SDK Build Feature/Hotfix Branch
55

66
on:
7-
push:
7+
pull_request:
8+
push:
89
branches:
910
- '**'
1011
- '!master'

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>com.channelape</groupId>
66
<artifactId>shopify-sdk</artifactId>
7-
<version>2.4.3</version>
7+
<version>2.5.0</version>
88

99
<name>Shopify SDK</name>
1010
<description>Java SDK for Shopify REST API.</description>

src/main/java/com/shopify/model/ShopifyLineItem.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ public class ShopifyLineItem {
4444
private String fulfillmentService;
4545
@XmlElement(name = "tax_lines")
4646
private List<ShopifyTaxLine> taxLines = new LinkedList<>();
47+
@XmlElement(name = "properties")
48+
private List<ShopifyProperty> properties = new LinkedList<>();
4749

4850
public String getId() {
4951
return id;
@@ -205,4 +207,12 @@ public void setTaxLines(final List<ShopifyTaxLine> taxLines) {
205207
this.taxLines = taxLines;
206208
}
207209

210+
public List<ShopifyProperty> getProperties() {
211+
return properties;
212+
}
213+
214+
public void setProperties(final List<ShopifyProperty> properties) {
215+
this.properties = properties;
216+
}
217+
208218
}

src/main/java/com/shopify/model/ShopifyOrder.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ public class ShopifyOrder {
9999
private List<ShopifyShippingLine> shippingLines = new LinkedList<>();
100100
@XmlElement(name = "tax_lines")
101101
private List<ShopifyTaxLine> taxLines = new LinkedList<>();
102+
102103
@XmlElement(name = "note_attributes")
103104
private List<ShopifyAttribute> noteAttributes = new LinkedList<>();
104105
private List<ShopifyRefund> refunds = new LinkedList<>();
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.shopify.model;
2+
3+
import javax.xml.bind.annotation.XmlRootElement;
4+
5+
@XmlRootElement
6+
public class ShopifyProperty {
7+
8+
private String name;
9+
private String value;
10+
11+
public String getName() {
12+
return name;
13+
}
14+
15+
public void setName(String name) {
16+
this.name = name;
17+
}
18+
19+
public String getValue() {
20+
return value;
21+
}
22+
23+
public void setValue(String value) {
24+
this.value = value;
25+
}
26+
27+
}

src/test/java/com/shopify/ShopifySdkTest.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
import com.shopify.model.ShopifyProductUpdateRequest;
9292
import com.shopify.model.ShopifyProducts;
9393
import com.shopify.model.ShopifyProductsRoot;
94+
import com.shopify.model.ShopifyProperty;
9495
import com.shopify.model.ShopifyRecurringApplicationCharge;
9596
import com.shopify.model.ShopifyRecurringApplicationChargeCreationRequest;
9697
import com.shopify.model.ShopifyRecurringApplicationChargeRoot;
@@ -395,6 +396,12 @@ public void givenSomePageAndCreatedAtMinAndCreatedAtMaxOrdersWhenRetrievingOrder
395396
"Some Tax Line2");
396397
shopifyLineItem1
397398
.setTaxLines(new LinkedList<>(Arrays.asList(shopifyTaxLine1LineItem1, shopifyTaxLine1LineItem2)));
399+
400+
final ShopifyProperty shopifyProperty1 = buildShopifyProperty("message", "Some new message");
401+
final ShopifyProperty shopifyProperty2 = buildShopifyProperty("from", "From family");
402+
final ShopifyProperty shopifyProperty3 = buildShopifyProperty("to", "To family member");
403+
shopifyLineItem1
404+
.setProperties(new LinkedList<>(Arrays.asList(shopifyProperty1, shopifyProperty2, shopifyProperty3)));
398405
shopifyOrder1.setLineItems(Arrays.asList(shopifyLineItem1));
399406

400407
final ShopifyFulfillment shopifyFulfillment = new ShopifyFulfillment();
@@ -498,6 +505,19 @@ public void givenSomePageAndCreatedAtMinAndCreatedAtMaxOrdersWhenRetrievingOrder
498505
shopifyOrders.get(0).getLineItems().get(0).getTaxLines().get(1).getPrice());
499506
assertEquals(shopifyTaxLine1LineItem2.getTitle(),
500507
shopifyOrders.get(0).getLineItems().get(0).getTaxLines().get(1).getTitle());
508+
assertEquals(shopifyProperty1.getName(),
509+
shopifyOrders.get(0).getLineItems().get(0).getProperties().get(0).getName());
510+
assertEquals(shopifyProperty1.getValue(),
511+
shopifyOrders.get(0).getLineItems().get(0).getProperties().get(0).getValue());
512+
assertEquals(shopifyProperty2.getName(),
513+
shopifyOrders.get(0).getLineItems().get(0).getProperties().get(1).getName());
514+
assertEquals(shopifyProperty2.getValue(),
515+
shopifyOrders.get(0).getLineItems().get(0).getProperties().get(1).getValue());
516+
assertEquals(shopifyProperty3.getName(),
517+
shopifyOrders.get(0).getLineItems().get(0).getProperties().get(2).getName());
518+
assertEquals(shopifyProperty3.getValue(),
519+
shopifyOrders.get(0).getLineItems().get(0).getProperties().get(2).getValue());
520+
501521
assertEquals(shopifyOrder1.getFulfillments().get(0).getId(),
502522
shopifyOrders.get(0).getFulfillments().get(0).getId());
503523
assertTrue(shopifyOrder1.getFulfillments().get(0).getCreatedAt()
@@ -3700,4 +3720,11 @@ private ShopifyTaxLine buildTaxLine(final BigDecimal price, final BigDecimal rat
37003720
shopifyTaxLine1LineItem1.setTitle(title);
37013721
return shopifyTaxLine1LineItem1;
37023722
}
3723+
3724+
private ShopifyProperty buildShopifyProperty(final String name, final String value) {
3725+
final ShopifyProperty shopifyProperty = new ShopifyProperty();
3726+
shopifyProperty.setName(name);
3727+
shopifyProperty.setValue(value);
3728+
return shopifyProperty;
3729+
}
37033730
}

src/test/java/com/shopify/model/ShopifyLineItemTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.shopify.model;
22

33
import static org.junit.Assert.assertEquals;
4+
import static org.junit.Assert.assertSame;
45
import static org.junit.Assert.assertTrue;
56

67
import java.math.BigDecimal;
@@ -11,6 +12,7 @@
1112
public class ShopifyLineItemTest {
1213

1314
private static final LinkedList<ShopifyTaxLine> SOME_TAX_LINES = new LinkedList<>();
15+
private static final LinkedList<ShopifyProperty> SOME_PROPERTIES = new LinkedList<>();
1416
private static final BigDecimal SOME_PRICE = BigDecimal.valueOf(41.55);
1517

1618
@Test
@@ -31,6 +33,7 @@ public void givenSomeValuesWhenBuildingLineItemsThenExpectLineItemValuesToBeCorr
3133
shopifyLineItem.setTaxable(true);
3234
shopifyLineItem.setTitle("Some_Title");
3335
shopifyLineItem.setTaxLines(SOME_TAX_LINES);
36+
shopifyLineItem.setProperties(SOME_PROPERTIES);
3437
shopifyLineItem.setTotalDiscount(SOME_PRICE);
3538
shopifyLineItem.setVariantId("1234");
3639
shopifyLineItem.setVariantInventoryManagement("shopify");
@@ -55,6 +58,7 @@ public void givenSomeValuesWhenBuildingLineItemsThenExpectLineItemValuesToBeCorr
5558
assertEquals("shopify", shopifyLineItem.getVariantInventoryManagement());
5659
assertEquals("some-title", shopifyLineItem.getVariantTitle());
5760
assertEquals("some-vendor", shopifyLineItem.getVendor());
61+
assertSame(SOME_PROPERTIES, shopifyLineItem.getProperties());
5862

5963
}
6064

0 commit comments

Comments
 (0)