Skip to content

Commit f80c0ea

Browse files
committed
merge latest develop branch and flesh out the Schema class
1 parent d8b5896 commit f80c0ea

File tree

1 file changed

+116
-114
lines changed

1 file changed

+116
-114
lines changed

src/Rest/AbandonedCarts/Schema.php

Lines changed: 116 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -76,120 +76,7 @@ public static function get_public_item_schema() {
7676
'type' => 'array',
7777
'context' => [ 'view' ],
7878
'readonly' => true,
79-
'properties' => [
80-
[
81-
'key' => [
82-
'description' => esc_html__( 'Unique WooCommerce-generated key identifying the cart in the database. This differs from the parent-level cart_hash property.', 'cc-woo' ),
83-
'type' => 'string',
84-
'context' => [ 'view' ],
85-
'readonly' => true,
86-
],
87-
'product_id' => [
88-
'description' => esc_html__( 'The WooCommerce product ID.', 'cc-woo' ),
89-
'type' => 'integer',
90-
'context' => [ 'view' ],
91-
'readonly' => true,
92-
],
93-
'variation_id' => [
94-
'description' => esc_html__( 'The WooCommerce product variation ID, if applicable.', 'cc-woo' ),
95-
'type' => 'integer',
96-
'context' => [ 'view' ],
97-
'readonly' => true,
98-
],
99-
'variation' => [
100-
'description' => esc_html__( 'Object representation of any applicable variations, where keys are variation names and values are the actual variation selection.', 'cc-woo' ),
101-
'type' => 'object',
102-
'context' => [ 'view' ],
103-
'readonly' => true,
104-
],
105-
'quantity' => [
106-
'description' => esc_html__( 'Item quantity.', 'cc-woo' ),
107-
'type' => 'integer',
108-
'context' => [ 'view' ],
109-
'readonly' => true,
110-
],
111-
'data_hash' => [
112-
'description' => esc_html__( 'MD5 hash of cart items to determine if contents are modified.', 'cc-woo' ),
113-
'type' => 'string',
114-
'context' => [ 'view' ],
115-
'readonly' => true,
116-
],
117-
'line_tax_data' => [
118-
'description' => esc_html__( 'Line subtotal tax and total tax data.', 'cc-woo' ),
119-
'type' => 'object',
120-
'context' => [ 'view' ],
121-
'readonly' => true,
122-
'properties' => [
123-
'subtotal' => [
124-
'description' => esc_html__( 'Line subtotal tax data.', 'cc-woo' ),
125-
'type' => 'string',
126-
'context' => [ 'view' ],
127-
'readonly' => true,
128-
],
129-
'total' => [
130-
'description' => esc_html__( 'Line total tax data.', 'cc-woo' ),
131-
'type' => 'string',
132-
'context' => [ 'view' ],
133-
'readonly' => true,
134-
],
135-
]
136-
],
137-
'line_subtotal' => [
138-
'description' => esc_html__( 'Line subtotal.', 'cc-woo' ),
139-
'type' => 'string',
140-
'context' => [ 'view' ],
141-
'readonly' => true,
142-
],
143-
'line_subtotal_tax' => [
144-
'description' => esc_html__( 'Line subtotal tax.', 'cc-woo' ),
145-
'type' => 'string',
146-
'context' => [ 'view' ],
147-
'readonly' => true,
148-
],
149-
'line_total' => [
150-
'description' => esc_html__( 'Line total.', 'cc-woo' ),
151-
'type' => 'string',
152-
'context' => [ 'view' ],
153-
'readonly' => true,
154-
],
155-
'line_tax' => [
156-
'description' => esc_html__( 'Line total tax.', 'cc-woo' ),
157-
'type' => 'string',
158-
'context' => [ 'view' ],
159-
'readonly' => true,
160-
],
161-
'data' => [
162-
'description' => esc_html__( 'Misc. product data in key-value pairs.', 'cc-woo' ),
163-
'type' => 'object',
164-
'context' => [ 'view' ],
165-
'readonly' => true,
166-
],
167-
'product_title' => [
168-
'description' => esc_html__( 'The product title.', 'cc-woo' ),
169-
'type' => 'string',
170-
'context' => [ 'view' ],
171-
'readonly' => true,
172-
],
173-
'product_sku' => [
174-
'description' => esc_html__( 'The product SKU.', 'cc-woo' ),
175-
'type' => 'string',
176-
'context' => [ 'view' ],
177-
'readonly' => true,
178-
],
179-
'product_permalink' => [
180-
'description' => esc_html__( 'Permalink to the product page.', 'cc-woo' ),
181-
'type' => 'string',
182-
'context' => [ 'view' ],
183-
'readonly' => true,
184-
],
185-
'product_image_url' => [
186-
'description' => esc_html__( 'URL to the full-size featured image for the product if one exists.', 'cc-woo' ),
187-
'type' => 'string',
188-
'context' => [ 'view' ],
189-
'readonly' => true,
190-
]
191-
]
192-
]
79+
'properties' => self::get_products_properties(),
19380
],
19481
'coupons' => [
19582
'description' => esc_html__( '', 'cc-woo' ),
@@ -263,4 +150,119 @@ public static function get_public_item_schema() {
263150
];
264151
}
265152

153+
public static function get_products_properties() {
154+
return [
155+
'key' => [
156+
'description' => esc_html__( 'Unique WooCommerce-generated key identifying the cart in the database. This differs from the parent-level cart_hash property.', 'cc-woo' ),
157+
'type' => 'string',
158+
'context' => [ 'view' ],
159+
'readonly' => true,
160+
],
161+
'product_id' => [
162+
'description' => esc_html__( 'The WooCommerce product ID.', 'cc-woo' ),
163+
'type' => 'integer',
164+
'context' => [ 'view' ],
165+
'readonly' => true,
166+
],
167+
'variation_id' => [
168+
'description' => esc_html__( 'The WooCommerce product variation ID, if applicable.', 'cc-woo' ),
169+
'type' => 'integer',
170+
'context' => [ 'view' ],
171+
'readonly' => true,
172+
],
173+
'variation' => [
174+
'description' => esc_html__( 'Object representation of any applicable variations, where keys are variation names and values are the actual variation selection.', 'cc-woo' ),
175+
'type' => 'object',
176+
'context' => [ 'view' ],
177+
'readonly' => true,
178+
],
179+
'quantity' => [
180+
'description' => esc_html__( 'Item quantity.', 'cc-woo' ),
181+
'type' => 'integer',
182+
'context' => [ 'view' ],
183+
'readonly' => true,
184+
],
185+
'data_hash' => [
186+
'description' => esc_html__( 'MD5 hash of cart items to determine if contents are modified.', 'cc-woo' ),
187+
'type' => 'string',
188+
'context' => [ 'view' ],
189+
'readonly' => true,
190+
],
191+
'line_tax_data' => [
192+
'description' => esc_html__( 'Line subtotal tax and total tax data.', 'cc-woo' ),
193+
'type' => 'object',
194+
'context' => [ 'view' ],
195+
'readonly' => true,
196+
'properties' => [
197+
'subtotal' => [
198+
'description' => esc_html__( 'Line subtotal tax data.', 'cc-woo' ),
199+
'type' => 'string',
200+
'context' => [ 'view' ],
201+
'readonly' => true,
202+
],
203+
'total' => [
204+
'description' => esc_html__( 'Line total tax data.', 'cc-woo' ),
205+
'type' => 'string',
206+
'context' => [ 'view' ],
207+
'readonly' => true,
208+
],
209+
]
210+
],
211+
'line_subtotal' => [
212+
'description' => esc_html__( 'Line subtotal.', 'cc-woo' ),
213+
'type' => 'string',
214+
'context' => [ 'view' ],
215+
'readonly' => true,
216+
],
217+
'line_subtotal_tax' => [
218+
'description' => esc_html__( 'Line subtotal tax.', 'cc-woo' ),
219+
'type' => 'string',
220+
'context' => [ 'view' ],
221+
'readonly' => true,
222+
],
223+
'line_total' => [
224+
'description' => esc_html__( 'Line total.', 'cc-woo' ),
225+
'type' => 'string',
226+
'context' => [ 'view' ],
227+
'readonly' => true,
228+
],
229+
'line_tax' => [
230+
'description' => esc_html__( 'Line total tax.', 'cc-woo' ),
231+
'type' => 'string',
232+
'context' => [ 'view' ],
233+
'readonly' => true,
234+
],
235+
'data' => [
236+
'description' => esc_html__( 'Misc. product data in key-value pairs.', 'cc-woo' ),
237+
'type' => 'object',
238+
'context' => [ 'view' ],
239+
'readonly' => true,
240+
],
241+
'product_title' => [
242+
'description' => esc_html__( 'The product title.', 'cc-woo' ),
243+
'type' => 'string',
244+
'context' => [ 'view' ],
245+
'readonly' => true,
246+
],
247+
'product_sku' => [
248+
'description' => esc_html__( 'The product SKU.', 'cc-woo' ),
249+
'type' => 'string',
250+
'context' => [ 'view' ],
251+
'readonly' => true,
252+
],
253+
'product_permalink' => [
254+
'description' => esc_html__( 'Permalink to the product page.', 'cc-woo' ),
255+
'type' => 'string',
256+
'context' => [ 'view' ],
257+
'readonly' => true,
258+
],
259+
'product_image_url' => [
260+
'description' => esc_html__( 'URL to the full-size featured image for the product if one exists.', 'cc-woo' ),
261+
'type' => 'string',
262+
'context' => [ 'view' ],
263+
'readonly' => true,
264+
]
265+
];
266+
}
267+
266268
}

0 commit comments

Comments
 (0)