Skip to content

Commit 7aa3e14

Browse files
committed
Fix tests and resource classes for missing or typo'd properties
aligent#201
1 parent 170bc1e commit 7aa3e14

25 files changed

+115
-68
lines changed

src/BigCommerce/ResourceModels/Catalog/Product/Product.php

+13-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,13 @@ class Product extends ResourceModel
8181
public bool $open_graph_use_image;
8282
public int $reviews_rating_sum;
8383
public int $total_sold;
84-
84+
public int $reviews_count;
85+
public ?int $option_set_id;
86+
public ?float $calculated_price;
87+
public ?string $option_set_display;
88+
public string $product_tax_code;
89+
public int $tax_class_id;
90+
public ?float $map_price;
8591

8692
/**
8793
* @var CustomField[]|null
@@ -99,6 +105,11 @@ class Product extends ResourceModel
99105
*/
100106
public ?array $images;
101107

108+
/**
109+
* @var ProductVariant[]|null
110+
*/
111+
public ?array $variants;
112+
102113
public function __construct(?stdClass $optionObject = null)
103114
{
104115
if (!is_null($optionObject)) {
@@ -128,5 +139,6 @@ protected function beforeBuildObject(): void
128139
{
129140
$this->buildObjectArray('modifiers', ProductModifier::class);
130141
$this->buildObjectArray('images', ProductImage::class);
142+
$this->buildObjectArray('variants', ProductVariant::class);
131143
}
132144
}

src/BigCommerce/ResourceModels/Catalog/Product/ProductVariant.php

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class ProductVariant extends ResourceModel
1212
public ?int $sku_id;
1313
public ?float $price;
1414
public ?float $calculated_price;
15+
public ?float $map_price;
1516
public ?float $sale_price;
1617
public ?float $retail_price;
1718
public ?float $weight;
@@ -31,4 +32,5 @@ class ProductVariant extends ResourceModel
3132
public int $inventory_warning_level;
3233
public string $bin_picking_number;
3334
public array $option_values;
35+
public float $calculated_weight;
3436
}

src/BigCommerce/ResourceModels/Catalog/Product/ProductVideo.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class ProductVideo extends ResourceModel
1010

1111
public string $title;
1212
public string $description;
13-
public int $sort_oder;
13+
public int $sort_order;
1414
public string $type;
1515
public string $video_id;
1616
public int $id;

src/BigCommerce/ResourceModels/Channel/Channel.php

+1
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,5 @@ class Channel extends ResourceModel
4444
public bool $is_visible;
4545
public string $name;
4646
public string $status;
47+
public bool $is_enabled;
4748
}

src/BigCommerce/ResourceModels/Customer/Customer.php

+3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ class Customer extends ResourceModel
3232
public ?array $store_credit_amounts;
3333
public ?int $origin_channel_id;
3434
public ?array $channel_ids;
35+
public ?string $registration_ip_address;
36+
public string $date_created;
37+
public string $date_modified;
3538

3639
/**
3740
* @var CustomerAddress[]

src/BigCommerce/ResourceModels/Customer/CustomerAddress.php

+1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ class CustomerAddress extends ResourceModel
1717
public string $phone;
1818
public string $address_type;
1919
public int $customer_id;
20+
public ?string $company;
2021
}

src/BigCommerce/ResourceModels/Order/OrderRefundItem.php

+1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ class OrderRefundItem extends ResourceModel
1616
public ?float $amount;
1717
public ?float $quantity;
1818
public ?string $reason;
19+
public ?float $requested_amount;
1920
}

src/BigCommerce/ResourceModels/Page/Page.php

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
class Page extends ResourceModel
88
{
9+
public int $id;
910
public string $name;
1011
public ?string $email;
1112
public string $meta_title;

src/BigCommerce/ResourceModels/PriceList/PriceList.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ class PriceList extends ResourceModel
99
public int $id;
1010
public string $name;
1111
public string $date_created;
12-
public string $data_modified;
12+
public string $date_modified;
1313
public bool $active;
1414
}

src/BigCommerce/ResourceModels/PriceList/PriceListRecord.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ class PriceListRecord extends ResourceModel
88
{
99
public int $price_list_id;
1010
public int $variant_id;
11-
public float $price;
12-
public object $sale_price;
13-
public object $map_price;
11+
public ?float $price;
12+
public ?float $sale_price;
13+
public ?float $map_price;
1414
public float $calculated_price;
1515
public string $date_created;
1616
public string $date_modified;
1717
public string $currency;
1818
public int $product_id;
1919
public array $bulk_pricing_tiers;
20+
public ?float $retail_price;
2021
}

src/BigCommerce/ResourceModels/Redirect/Redirect.php

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ class Redirect extends ResourceModel
2929
public string $from_path;
3030
public int $site_id;
3131
public RedirectTo $to;
32+
public int $id;
33+
public string $to_url;
3234

3335
public function __construct(?stdClass $optionObject = null)
3436
{

src/BigCommerce/ResourceModels/Script/Script.php

+1
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@ class Script extends ResourceModel
2929
public string $api_client_id;
3030
public string $consent_category;
3131
public bool $enabled;
32+
public string $name;
3233
}

src/BigCommerce/ResourceModels/Widget/Placement.php

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ class Placement extends ResourceModel
1717
public int $sort_order;
1818
public string $region;
1919
public ?Widget $widget;
20+
public string $date_created;
21+
public string $date_modified;
22+
public string $uuid;
2023

2124
public function __construct(?stdClass $optionObject = null)
2225
{
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
namespace BigCommerce\ApiV3\ResponseModels\Meta;
4+
5+
use BigCommerce\ApiV3\ResourceModels\ResourceModel;
6+
7+
class Links extends ResourceModel
8+
{
9+
public ?string $previous;
10+
public string $current;
11+
public ?string $next;
12+
}

src/BigCommerce/ResponseModels/Meta/Pagination.php

+8
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,12 @@ class Pagination extends ResourceModel
3030
* @var int The total number of pages in the collection
3131
*/
3232
public int $total_pages;
33+
34+
public ?Links $links;
35+
36+
protected function beforeBuildObject(): void
37+
{
38+
self::buildPropertyObject('links', Links::class);
39+
parent::beforeBuildObject();
40+
}
3341
}

tests/BigCommerce/responses/catalog__brands__11__metafields__get_all.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"resource_id": 111,
1111
"id": 6,
1212
"date_created": "1973-01-20T21:34:57.903Z",
13-
"date_updated": "1990-12-30T00:29:23.515Z"
13+
"date_modified": "1990-12-30T00:29:23.515Z"
1414
},
1515
{
1616
"permission_set": "read",
@@ -22,7 +22,7 @@
2222
"resource_id": 111,
2323
"id": 6,
2424
"date_created": "1973-01-20T21:34:57.903Z",
25-
"date_updated": "1990-12-30T00:29:23.515Z"
25+
"date_modified": "1990-12-30T00:29:23.515Z"
2626
}
2727
],
2828
"meta": {

tests/BigCommerce/responses/catalog__categories__111__metafields__get_all.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"resource_id": 111,
1111
"id": 6,
1212
"date_created": "1973-01-20T21:34:57.903Z",
13-
"date_updated": "1990-12-30T00:29:23.515Z"
13+
"date_modified": "1990-12-30T00:29:23.515Z"
1414
},
1515
{
1616
"permission_set": "read",
@@ -22,7 +22,7 @@
2222
"resource_id": 111,
2323
"id": 6,
2424
"date_created": "1973-01-20T21:34:57.903Z",
25-
"date_updated": "1990-12-30T00:29:23.515Z"
25+
"date_modified": "1990-12-30T00:29:23.515Z"
2626
}
2727
],
2828
"meta": {

tests/BigCommerce/responses/catalog__products__174__get.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
21
2323
],
2424
"brand_id": 36,
25-
"option_set_id": {},
25+
"option_set_id": null,
2626
"option_set_display": "right",
2727
"inventory_level": 0,
2828
"inventory_warning_level": 0,

tests/BigCommerce/responses/catalog__products__get_all.json

+4-5
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
21
2424
],
2525
"brand_id": 36,
26-
"option_set_id": {},
26+
"option_set_id": null,
2727
"option_set_display": "right",
2828
"inventory_level": 0,
2929
"inventory_warning_level": 0,
@@ -81,7 +81,7 @@
8181
"id": 345,
8282
"product_id": 174,
8383
"sku": "",
84-
"sku_id": {},
84+
"sku_id": null,
8585
"price": 7.95,
8686
"calculated_price": 7.95,
8787
"sale_price": 0,
@@ -189,7 +189,7 @@
189189
"id": 338,
190190
"product_id": 167,
191191
"sku": "",
192-
"sku_id": {},
192+
"sku_id": null,
193193
"price": 225,
194194
"calculated_price": 225,
195195
"sale_price": 0,
@@ -227,8 +227,7 @@
227227
"links": {
228228
"next": "?sort=name&include=variants&limit=10&page=2",
229229
"current": "?sort=name&include=variants&limit=10&page=1"
230-
},
231-
"too_many": false
230+
}
232231
}
233232
}
234233
}

tests/BigCommerce/responses/customers__get_all.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"attributes": [
3737
{
3838
"attribute_id": 0,
39-
"value": "string"
39+
"attribute_value": "string"
4040
}
4141
]
4242
}

tests/BigCommerce/responses/orders__1__metafields__get_all.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"resource_id": 1,
1111
"id": 6,
1212
"date_created": "1973-01-20T21:34:57.903Z",
13-
"date_updated": "1990-12-30T00:29:23.515Z"
13+
"date_modified": "1990-12-30T00:29:23.515Z"
1414
},
1515
{
1616
"permission_set": "read",
@@ -22,7 +22,7 @@
2222
"resource_id": 1,
2323
"id": 6,
2424
"date_created": "1973-01-20T21:34:57.903Z",
25-
"date_updated": "1990-12-30T00:29:23.515Z"
25+
"date_modified": "1990-12-30T00:29:23.515Z"
2626
}
2727
],
2828
"meta": {

tests/BigCommerce/responses/price_lists__3__records__by_variant_388.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
"price_list_id": 3,
55
"variant_id": 388,
66
"price": 10.78,
7-
"sale_price": {},
8-
"retail_price": {},
9-
"map_price": {},
7+
"sale_price": null,
8+
"retail_price": null,
9+
"map_price": null,
1010
"calculated_price": 10.78,
1111
"date_created": "2018-09-17T20:33:14Z",
1212
"date_modified": "2018-09-17T20:35:42Z",

0 commit comments

Comments
 (0)