Skip to content

Commit 5192575

Browse files
committed
Successfully add an item to the guest cart
1 parent df4c444 commit 5192575

12 files changed

+240
-1
lines changed
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
package com.github.chen0040.magento.models;
22

33

4+
import lombok.Getter;
5+
import lombok.Setter;
6+
47
import java.util.HashMap;
58
import java.util.Map;
69

710

811
/**
912
* Created by xschen on 10/7/2017.
1013
*/
14+
@Setter
15+
@Getter
1116
public class CartItem {
1217
private long item_id;
1318
private String sku;
@@ -16,7 +21,9 @@ public class CartItem {
1621
private double price;
1722
private String product_type;
1823
private String quote_id;
19-
private Map<String, Object> product_option = new HashMap<>();
24+
25+
private CartItemProductOption product_option = new CartItemProductOption();
26+
private Map<String, Object> extension_attributes = new HashMap<>();
2027
}
2128

2229

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.github.chen0040.magento.models;
2+
3+
4+
import lombok.Getter;
5+
import lombok.Setter;
6+
7+
import java.util.ArrayList;
8+
import java.util.HashMap;
9+
import java.util.List;
10+
import java.util.Map;
11+
12+
13+
/**
14+
* Created by xschen on 11/7/2017.
15+
*/
16+
@Setter
17+
@Getter
18+
public class CartItemProductBundleOption {
19+
private long option_id = 0;
20+
private int option_qty = 0;
21+
private List<Integer> option_selections =new ArrayList<>();
22+
private Map<String, Object> extension_attributes = new HashMap<>();
23+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.github.chen0040.magento.models;
2+
3+
4+
import lombok.Getter;
5+
import lombok.Setter;
6+
7+
import java.util.HashMap;
8+
import java.util.Map;
9+
10+
11+
/**
12+
* Created by xschen on 11/7/2017.
13+
*/
14+
@Getter
15+
@Setter
16+
public class CartItemProductCustomOption {
17+
18+
private String option_id = "";
19+
private String option_value = "";
20+
private CartItemProductCustomOptionExtensionAttributes extension_attributes = new CartItemProductCustomOptionExtensionAttributes();
21+
22+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.github.chen0040.magento.models;
2+
3+
4+
import lombok.Getter;
5+
import lombok.Setter;
6+
7+
8+
/**
9+
* Created by xschen on 11/7/2017.
10+
*/
11+
@Setter
12+
@Getter
13+
public class CartItemProductCustomOptionExtensionAttributes {
14+
private FileInfo file_info = new FileInfo();
15+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.github.chen0040.magento.models;
2+
3+
4+
import lombok.Getter;
5+
import lombok.Setter;
6+
7+
import java.util.ArrayList;
8+
import java.util.List;
9+
10+
11+
/**
12+
* Created by xschen on 11/7/2017.
13+
*/
14+
@Getter
15+
@Setter
16+
public class CartItemProductDownloadableOption {
17+
private List<Integer> downloadable_links = new ArrayList<>();
18+
19+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.github.chen0040.magento.models;
2+
3+
4+
import lombok.Getter;
5+
import lombok.Setter;
6+
7+
8+
/**
9+
* Created by xschen on 11/7/2017.
10+
*/
11+
@Getter
12+
@Setter
13+
public class CartItemProductOption {
14+
private CartItemProductOptionExtensionAttributes extension_attributes = new CartItemProductOptionExtensionAttributes();
15+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package com.github.chen0040.magento.models;
2+
3+
4+
import lombok.Getter;
5+
import lombok.Setter;
6+
7+
import java.util.ArrayList;
8+
import java.util.HashMap;
9+
import java.util.List;
10+
import java.util.Map;
11+
12+
13+
/**
14+
* Created by xschen on 11/7/2017.
15+
*/
16+
@Getter
17+
@Setter
18+
public class CartItemProductOptionExtensionAttributes {
19+
20+
private CartItemProductCustomOption custom_options = new CartItemProductCustomOption();
21+
private List<CartItemProductBundleOption> bundle_options = new ArrayList<>();
22+
private CartItemProductDownloadableOption downloadable_option = new CartItemProductDownloadableOption();
23+
private GiftCardItemOption giftcard_item_option = new GiftCardItemOption();
24+
private List<ConfigurableItemOption> configurable_item_options = new ArrayList<>();
25+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.github.chen0040.magento.models;
2+
3+
4+
import lombok.Getter;
5+
import lombok.Setter;
6+
7+
import java.util.HashMap;
8+
import java.util.Map;
9+
10+
11+
/**
12+
* Created by xschen on 11/7/2017.
13+
*/
14+
@Getter
15+
@Setter
16+
public class ConfigurableItemOption {
17+
private String option_id = "";
18+
private double option_value = 0;
19+
private Map<String, Object> extension_attributes = new HashMap<>();
20+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.github.chen0040.magento.models;
2+
3+
4+
import lombok.Getter;
5+
import lombok.Setter;
6+
7+
8+
/**
9+
* Created by xschen on 11/7/2017.
10+
*/
11+
@Getter
12+
@Setter
13+
public class FileInfo {
14+
private String base64_encoded_data = "";
15+
private String type = "";
16+
private String name = "";
17+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package com.github.chen0040.magento.models;
2+
3+
4+
import lombok.Getter;
5+
import lombok.Setter;
6+
7+
import java.util.HashMap;
8+
import java.util.Map;
9+
10+
11+
/**
12+
* Created by xschen on 11/7/2017.
13+
*/
14+
@Getter
15+
@Setter
16+
public class GiftCardItemOption {
17+
private String giftcard_amount = "";
18+
private double custom_giftcard_amount = 0;
19+
private String giftcard_sender_name = "";
20+
private String giftcard_recipient_name = "";
21+
private String giftcard_sender_email = "";
22+
private String giftcard_recipient_email = "";
23+
private String giftcard_message = "";
24+
private Map<String, Object> extension_attributes =new HashMap<>();
25+
}

0 commit comments

Comments
 (0)