├── .github
├── CODEOWNERS
├── dependabot.yml
└── workflows
│ ├── release.yml
│ └── php.yml
├── tests
├── BigCommerce
│ ├── responses
│ │ ├── blank.json
│ │ ├── customers__validate-credentials.json
│ │ ├── themes__upload.json
│ │ ├── payments__create_payment_access_token.json
│ │ ├── catalog__categories__1__image__create.json
│ │ ├── content__regions__get.json
│ │ ├── site__route__60474753_get.json
│ │ ├── catalog__products__bulk_pricing_rules__83__get.json
│ │ ├── price_lists__2__get.json
│ │ ├── channel_currency_assignments.json
│ │ ├── customers__get_all_no_results.json
│ │ ├── channels__18735__site__1__get.json
│ │ ├── catalog__products__1__videos__1__get.json
│ │ ├── catalog__products__1__options__2__values__create.json
│ │ ├── no-data-paginated.json
│ │ ├── orders__order_refunds__create_quote.json
│ │ ├── themes__jobs__get.json
│ │ ├── channels__1__active-theme.json
│ │ ├── pricelists__price_list_assignments__get_all.json
│ │ ├── customers__settings__get.json
│ │ ├── customers__settings__by_channel.json
│ │ ├── catalog__summary__get.json
│ │ ├── catalog__brands__50__get.json
│ │ ├── orders__2__metafields__3__get.json
│ │ ├── price_lists__4__records__by_variant__356__currency__eur.json
│ │ ├── catalog__brands__158__metafields__8__get.json
│ │ ├── catalog__categories__158__metafields__8__get.json
│ │ ├── pages__2__get.json
│ │ ├── catalog__products__variants__158__metafield__get_8.json
│ │ ├── catalog__products__226__reviews__824__get.json
│ │ ├── site__routes__get_all.json
│ │ ├── catalog__products__modifiers__222__values__190__get.json
│ │ ├── content__widget_templates__get.json
│ │ ├── catalog__categories__39__get.json
│ │ ├── scripts__create.json
│ │ ├── storefront__redirects.json
│ │ ├── catalog__products__bulk_pricing_rules__get_all.json
│ │ ├── storelogs__systemlogs__get.json
│ │ ├── scripts__get.json
│ │ ├── templates__get_all.json
│ │ ├── orders__order_refunds__create.json
│ │ ├── channels__391563__get.json
│ │ ├── wishlist__30__get.json
│ │ ├── catalog__categories__get_tree.json
│ │ ├── catalog__products__1__reviews__get_all.json
│ │ ├── price_lists__get_all.json
│ │ ├── catalog__products__158__images__485__get.json
│ │ ├── sites__get_all.json
│ │ ├── orders__order_refunds__get_all.json
│ │ ├── catalog__products__variants__384__get.json
│ │ ├── channels__get_all.json
│ │ ├── sites__23__get.json
│ │ └── channel__42527118__listings__get.json
│ ├── requests
│ │ └── orange-catalog-icon-1.png
│ └── Api
│ │ ├── Catalog
│ │ ├── CustomUrl.php
│ │ ├── SummaryApiTest.php
│ │ ├── Products
│ │ │ ├── OptionsApiTest.php
│ │ │ ├── ComplexRulesApiTest.php
│ │ │ └── CustomFieldsApiTest.php
│ │ └── Categories
│ │ │ └── CategoryImageApiTest.php
│ │ ├── Customers
│ │ ├── CustomerConsentApiTest.php
│ │ ├── CustomerFormFieldValuesApiTest.php
│ │ ├── CustomerAddressesApiTest.php
│ │ ├── CustomerAttributesApiTest.php
│ │ ├── CustomerAttributeValuesApiTest.php
│ │ └── CustomerSettingsApiTest.php
│ │ ├── StoreLogs
│ │ └── StoreLogsApiTest.php
│ │ ├── Widgets
│ │ ├── RegionApiTest.php
│ │ └── WidgetTemplateApiTest.php
│ │ ├── Subscribers
│ │ └── SubscribersApiTest.php
│ │ ├── Channels
│ │ └── ChannelSitesApiTest.php
│ │ ├── Pages
│ │ └── PagesApiTest.php
│ │ ├── Wishlists
│ │ └── WishlistsApiTest.php
│ │ ├── Themes
│ │ ├── ThemeJobsApiTest.php
│ │ └── ThemeActionsApiTest.php
│ │ ├── Sites
│ │ └── SitesApiTest.php
│ │ ├── Orders
│ │ ├── OrderMetafieldsApiTest.php
│ │ └── OrdersApiTest.php
│ │ └── Payments
│ │ └── PaymentsProcessingApiTest.php
└── BigCommerceLegacyApi
│ ├── responses
│ ├── blank.json
│ └── storeinformation_time.json
│ ├── V2ApiClientTest.php
│ └── Api
│ └── Orders
│ ├── OrderProductsApiTest.php
│ └── OrderShippingAddressesApiTest.php
├── docs
└── _config.yml
├── .gitignore
├── RELEASE_NOTES.md
├── src
├── BigCommerceLegacyApi
│ ├── ResourceModels
│ │ ├── Order
│ │ │ ├── OrderShippingAddress.php
│ │ │ ├── OrderBillingAddress.php
│ │ │ ├── OrderAddress.php
│ │ │ └── OrderProduct.php
│ │ └── ResourceReference.php
│ ├── Api
│ │ └── Generic
│ │ │ ├── V2Api.php
│ │ │ └── V2ApiBase.php
│ └── ResponseModels
│ │ └── Order
│ │ ├── OrderStatusCount.php
│ │ ├── OrderProductOption.php
│ │ └── OrderCount.php
└── BigCommerce
│ ├── ResourceModels
│ ├── Customer
│ │ ├── StoredInstruments
│ │ │ ├── StoredPaypalAccount.php
│ │ │ ├── StoredBankAccount.php
│ │ │ ├── StoredInstrument.php
│ │ │ ├── StoredCard.php
│ │ │ ├── CardBillingAddress.php
│ │ │ └── StoredInstrumentFactory.php
│ │ ├── CustomerAttribute.php
│ │ ├── CustomerAuthentication.php
│ │ ├── CustomerCredentialsValidation.php
│ │ ├── CustomerAttributeValue.php
│ │ ├── CustomerSettings
│ │ │ ├── CustomerGroupSettings.php
│ │ │ └── PrivacySettings.php
│ │ ├── AttributeValue.php
│ │ ├── CustomerConsent.php
│ │ ├── CustomerFormFieldValue.php
│ │ ├── CustomerAddress.php
│ │ ├── Subscriber.php
│ │ ├── CustomerSettings.php
│ │ └── CustomerChannelSettings.php
│ ├── Widget
│ │ ├── Region.php
│ │ ├── WidgetConfigurationImage.php
│ │ ├── WidgetConfiguration.php
│ │ ├── WidgetTemplate.php
│ │ ├── Placement.php
│ │ └── Widget.php
│ ├── Theme
│ │ ├── JobResult.php
│ │ ├── JobError.php
│ │ ├── JobWarning.php
│ │ ├── ThemeVariation.php
│ │ ├── Theme.php
│ │ └── ThemeJob.php
│ ├── Order
│ │ ├── OrderMetafield.php
│ │ ├── Order.php
│ │ ├── RefundQuote.php
│ │ ├── OrderRefundItem.php
│ │ ├── Refund.php
│ │ └── Transaction.php
│ ├── Payment
│ │ ├── PaymentAccessToken.php
│ │ └── PaymentMethod.php
│ ├── Catalog
│ │ ├── Brand
│ │ │ ├── BrandMetafield.php
│ │ │ └── Brand.php
│ │ ├── Product
│ │ │ ├── ProductMetafield.php
│ │ │ ├── ProductVariantMetafield.php
│ │ │ ├── WeightAdjuster.php
│ │ │ ├── ProductModifierValueData.php
│ │ │ ├── ProductOptionValue.php
│ │ │ ├── PriceAdjuster.php
│ │ │ ├── ComplexRuleConditions.php
│ │ │ ├── ProductOption.php
│ │ │ ├── ProductVideo.php
│ │ │ ├── ProductBulkPricingRule.php
│ │ │ ├── ProductImage.php
│ │ │ ├── ProductModifierValueAdjuster.php
│ │ │ ├── ProductReview.php
│ │ │ └── CustomField.php
│ │ ├── Category
│ │ │ ├── CategoryMetafield.php
│ │ │ ├── CategoryTreeBranch.php
│ │ │ └── Category.php
│ │ └── Summary.php
│ ├── Wishlist
│ │ └── WishlistItem.php
│ ├── Cart
│ │ ├── CartItem.php
│ │ ├── CartRedirectUrls.php
│ │ └── Cart.php
│ ├── Channel
│ │ ├── ChannelCurrencyAssignment.php
│ │ ├── ChannelListingVariant.php
│ │ ├── ChannelSite.php
│ │ ├── ChannelListing.php
│ │ └── ChannelTheme.php
│ ├── PriceList
│ │ ├── PriceListAssignment.php
│ │ ├── PriceList.php
│ │ └── PriceListRecord.php
│ ├── SystemLog
│ │ └── SystemLog.php
│ ├── Site
│ │ ├── SiteUrl.php
│ │ ├── Site.php
│ │ └── SiteRoute.php
│ ├── CustomTemplateAssociation
│ │ └── CustomTemplateAssociation.php
│ ├── HasCustomUrl.php
│ ├── Redirect
│ │ └── RedirectTo.php
│ └── Page
│ │ └── Page.php
│ ├── ResponseModels
│ ├── Meta
│ │ ├── Links.php
│ │ └── Pagination.php
│ ├── Theme
│ │ ├── JobIdentifierResponse.php
│ │ ├── ThemesResponse.php
│ │ ├── ThemeResponse.php
│ │ └── ThemeJobResponse.php
│ ├── SummaryResponse.php
│ ├── Site
│ │ ├── SitesResponse.php
│ │ ├── SiteResponse.php
│ │ ├── SiteRoutesResponse.php
│ │ └── SiteRouteResponse.php
│ ├── Order
│ │ ├── RefundsResponse.php
│ │ ├── RefundResponse.php
│ │ ├── OrderMetafieldsResponse.php
│ │ ├── RefundQuoteResponse.php
│ │ ├── OrderMetafieldResponse.php
│ │ └── TransactionsResponse.php
│ ├── Page
│ │ ├── PagesResponse.php
│ │ └── PageResponse.php
│ ├── Script
│ │ ├── ScriptsResponse.php
│ │ └── ScriptResponse.php
│ ├── Widget
│ │ ├── WidgetsResponse.php
│ │ ├── PlacementsResponse.php
│ │ ├── WidgetResponse.php
│ │ ├── WidgetTemplatesResponse.php
│ │ ├── PlacementResponse.php
│ │ ├── WidgetTemplateResponse.php
│ │ └── RegionsResponse.php
│ ├── Cart
│ │ ├── CartResponse.php
│ │ └── CartRedirectUrlsResponse.php
│ ├── Channel
│ │ ├── ChannelsResponse.php
│ │ ├── ChannelResponse.php
│ │ ├── ChannelListingsResponse.php
│ │ ├── ChannelSiteResponse.php
│ │ ├── ChannelActiveThemeResponse.php
│ │ ├── ChannelListingResponse.php
│ │ ├── ChannelCurrencyAssignmentsResponse.php
│ │ └── ChannelCurrencyAssignmentResponse.php
│ ├── ComplexRuleResponse.php
│ ├── CustomFieldResponse.php
│ ├── OptionsResponse.php
│ ├── Wishlist
│ │ ├── WishlistsResponse.php
│ │ └── WishlistResponse.php
│ ├── ComplexRulesResponse.php
│ ├── CustomFieldsResponse.php
│ ├── Brand
│ │ ├── BrandResponse.php
│ │ ├── BrandMetafieldsResponse.php
│ │ ├── BrandsResponse.php
│ │ └── BrandMetafieldResponse.php
│ ├── Customer
│ │ ├── SubscribersResponse.php
│ │ ├── CustomersResponse.php
│ │ ├── CustomerAddressesResponse.php
│ │ ├── CustomerResponse.php
│ │ ├── CustomerAttributesResponse.php
│ │ ├── SubscriberResponse.php
│ │ ├── CustomerAttributeValuesResponse.php
│ │ ├── CustomerConsentResponse.php
│ │ ├── CustomerFormFieldValuesResponse.php
│ │ ├── CustomerSettingsResponse.php
│ │ ├── CustomerChannelSettingsResponse.php
│ │ └── ValidateCredentialsResponse.php
│ ├── PriceList
│ │ ├── PriceListsResponse.php
│ │ ├── PriceListRecordsResponse.php
│ │ ├── PriceListAssignmentsResponse.php
│ │ ├── PriceListRecordResponse.php
│ │ └── PriceListResponse.php
│ ├── StoreLogs
│ │ └── SystemLogsResponse.php
│ ├── Product
│ │ ├── ProductsResponse.php
│ │ ├── ProductVideosResponse.php
│ │ ├── ProductImagesResponse.php
│ │ ├── ProductReviewsResponse.php
│ │ ├── ModifiersResponse.php
│ │ ├── ProductResponse.php
│ │ ├── ProductVariantsResponse.php
│ │ ├── ProductMetafieldsResponse.php
│ │ ├── OptionResponse.php
│ │ ├── ProductOptionValuesResponse.php
│ │ ├── ProductVideoResponse.php
│ │ ├── ProductReviewResponse.php
│ │ ├── ProductBulkPricingRulesResponse.php
│ │ ├── ProductVariantMetafieldsResponse.php
│ │ ├── ProductImageResponse.php
│ │ ├── ModifierResponse.php
│ │ ├── ProductBulkPricingRuleResponse.php
│ │ ├── ProductOptionValueResponse.php
│ │ ├── ProductModifierValueResponse.php
│ │ ├── ProductMetafieldResponse.php
│ │ ├── ProductVariantResponse.php
│ │ ├── ProductVariantMetafieldResponse.php
│ │ └── ProductModifierValuesResponse.php
│ ├── Redirect
│ │ └── RedirectsResponse.php
│ ├── Payment
│ │ ├── AcceptedPaymentMethodsResponse.php
│ │ └── PaymentAccessTokenResponse.php
│ ├── SingleResourceResponse.php
│ ├── Category
│ │ ├── CategoryResponse.php
│ │ ├── CategoryMetafieldsResponse.php
│ │ ├── CategoriesResponse.php
│ │ ├── CategoryMetafieldResponse.php
│ │ └── CategoryTreeResponse.php
│ ├── CustomTemplateAssociation
│ │ └── CustomTemplateAssociationsResponse.php
│ └── PaginatedBatchableResponse.php
│ └── Api
│ ├── Generic
│ ├── UuidCompleteResourceApi.php
│ ├── V3Api.php
│ ├── ResourceWithBatchUpdateApi.php
│ ├── UuidResourceApi.php
│ ├── UuidResourceWithUuidParentApi.php
│ ├── DeleteResource.php
│ ├── UpdateResource.php
│ ├── GetResource.php
│ ├── DeleteInIdList.php
│ ├── CreateResource.php
│ ├── GetAllResources.php
│ ├── ResourceImageApi.php
│ ├── CreateImage.php
│ └── V3ApiBase.php
│ ├── Themes
│ └── ThemeJobsApi.php
│ ├── StoreLogs
│ └── StoreLogsApi.php
│ ├── Catalog
│ ├── Brands
│ │ └── BrandImageApi.php
│ ├── Categories
│ │ └── CategoryImageApi.php
│ └── Products
│ │ └── ProductModifier
│ │ └── ProductModifierImagesApi.php
│ └── Customers
│ ├── CustomerConsentApi.php
│ ├── CustomerAddressesApi.php
│ └── CustomerAttributesApi.php
└── .phpcs.xml
/.github/CODEOWNERS:
--------------------------------------------------------------------------------
1 | * @jswift
--------------------------------------------------------------------------------
/tests/BigCommerce/responses/blank.json:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/docs/_config.yml:
--------------------------------------------------------------------------------
1 | theme: jekyll-theme-cayman
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea/
2 | vendor/
3 | .phpdoc
4 |
--------------------------------------------------------------------------------
/tests/BigCommerceLegacyApi/responses/blank.json:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/tests/BigCommerce/responses/customers__validate-credentials.json:
--------------------------------------------------------------------------------
1 | {
2 | "is_valid": false
3 | }
4 |
--------------------------------------------------------------------------------
/tests/BigCommerceLegacyApi/responses/storeinformation_time.json:
--------------------------------------------------------------------------------
1 | {
2 | "time": 1529512970
3 | }
4 |
--------------------------------------------------------------------------------
/tests/BigCommerce/responses/themes__upload.json:
--------------------------------------------------------------------------------
1 | {
2 | "job_id": "ceea1917b1518f5ae491da6ad8a56336"
3 | }
--------------------------------------------------------------------------------
/RELEASE_NOTES.md:
--------------------------------------------------------------------------------
1 | ### Fixes
2 |
3 | - Many deprecation notices for PHP 8.2 about creation of dynamic properties (#201)
--------------------------------------------------------------------------------
/tests/BigCommerce/responses/payments__create_payment_access_token.json:
--------------------------------------------------------------------------------
1 | {
2 | "data": {
3 | "id": "abcdefg"
4 | }
5 | }
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 |
3 | updates:
4 | - package-ecosystem: "composer"
5 | directory: "/"
6 | schedule:
7 | interval: "daily"
--------------------------------------------------------------------------------
/tests/BigCommerce/requests/orange-catalog-icon-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aligent/bigcommerce-v3-api-php-client/HEAD/tests/BigCommerce/requests/orange-catalog-icon-1.png
--------------------------------------------------------------------------------
/tests/BigCommerce/responses/catalog__categories__1__image__create.json:
--------------------------------------------------------------------------------
1 | {
2 | "data": {
3 | "image_url": "https://cdn11.bigcommerce.com/s-{store_hash}/product_images/k/group_1545334669__76009.png"
4 | },
5 | "meta": {}
6 | }
--------------------------------------------------------------------------------
/tests/BigCommerce/responses/content__regions__get.json:
--------------------------------------------------------------------------------
1 | {
2 | "data": [
3 | {
4 | "name": "header_bottom"
5 | },
6 | {
7 | "name": "category_header_banner"
8 | }
9 | ],
10 | "meta": {}
11 | }
--------------------------------------------------------------------------------
/tests/BigCommerce/responses/site__route__60474753_get.json:
--------------------------------------------------------------------------------
1 | {
2 | "data": {
3 | "id": 60474753,
4 | "type": "checkout",
5 | "matching": "5",
6 | "route": "/my-amazing-product"
7 | },
8 | "meta": {}
9 | }
10 |
--------------------------------------------------------------------------------
/src/BigCommerceLegacyApi/ResourceModels/Order/OrderShippingAddress.php:
--------------------------------------------------------------------------------
1 |
2 |
3 | Coding standard configuration for the Bigcommerce V3 API Client.
4 |
5 | src
6 | tests
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResourceModels/Cart/CartRedirectUrls.php:
--------------------------------------------------------------------------------
1 | id = $id;
13 | $this->is_recurring = $is_recurring;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResourceModels/Theme/ThemeVariation.php:
--------------------------------------------------------------------------------
1 | getApi();
10 |
11 | $this->assertEquals('https://api.bigcommerce.com/stores/HASH/v2/', $client->getBaseUri());
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResourceModels/Customer/CustomerSettings/CustomerGroupSettings.php:
--------------------------------------------------------------------------------
1 | uuid;
12 | }
13 |
14 | public function setUuid(string $uuid): void
15 | {
16 | $this->uuid = $uuid;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResourceModels/Catalog/Product/ProductModifierValueData.php:
--------------------------------------------------------------------------------
1 | markTestIncomplete();
12 | }
13 |
14 | public function testCanUpdateCustomerConsent()
15 | {
16 | $this->markTestIncomplete();
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/BigCommerceLegacyApi/ResponseModels/Order/OrderStatusCount.php:
--------------------------------------------------------------------------------
1 | parentUuid;
12 | }
13 |
14 | public function setParentUuid(string $parentUuid): void
15 | {
16 | $this->parentUuid = $parentUuid;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/tests/BigCommerce/responses/catalog__brands__50__get.json:
--------------------------------------------------------------------------------
1 | {
2 | "data": {
3 | "id": 50,
4 | "name": "Common Good",
5 | "meta_keywords": [
6 | "modern, clean, contemporary"
7 | ],
8 | "meta_description": "Common Good is a modern brand",
9 | "image_url": "",
10 | "search_keywords": "kitchen, laundry, cart, storage",
11 | "custom_url": {
12 | "url": "/brands/Common-Good.html",
13 | "is_customized": false
14 | }
15 | },
16 | "meta": {}
17 | }
--------------------------------------------------------------------------------
/tests/BigCommerce/responses/orders__2__metafields__3__get.json:
--------------------------------------------------------------------------------
1 | {
2 | "data": {
3 | "id": 3,
4 | "key": "location_id",
5 | "value": "Shelf 3, Bin 5",
6 | "namespace": "Inventory Namespace",
7 | "permission_set": "read",
8 | "resource_type": "order",
9 | "resource_id": 2,
10 | "description": "Where products are located",
11 | "date_created": "2018-09-13T16:42:37+00:00",
12 | "date_modified": "2018-09-13T16:42:37+00:00"
13 | },
14 | "meta": {}
15 | }
16 |
--------------------------------------------------------------------------------
/tests/BigCommerce/responses/price_lists__4__records__by_variant__356__currency__eur.json:
--------------------------------------------------------------------------------
1 | {
2 | "data": {
3 | "price_list_id": 4,
4 | "variant_id": 356,
5 | "price": 22.544,
6 | "sale_price": null,
7 | "retail_price": null,
8 | "map_price": null,
9 | "calculated_price": 22.544,
10 | "date_created": "2018-09-18T13:18:15Z",
11 | "date_modified": "2018-09-18T13:18:15Z",
12 | "currency": "eur",
13 | "product_id": 185
14 | },
15 | "meta": {}
16 | }
17 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResourceModels/Order/RefundQuote.php:
--------------------------------------------------------------------------------
1 | markTestIncomplete();
12 | }
13 |
14 | public function testCanUpsertCustomerFormFieldValues()
15 | {
16 | $this->markTestIncomplete();
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/tests/BigCommerce/responses/catalog__products__variants__158__metafield__get_8.json:
--------------------------------------------------------------------------------
1 | {
2 | "data": {
3 | "id": 8,
4 | "key": "location_id",
5 | "value": "Shelf 3, Bin 5",
6 | "namespace": "Inventory Namespace",
7 | "permission_set": "read",
8 | "resource_type": "product",
9 | "resource_id": 158,
10 | "description": "Where products are located",
11 | "date_created": "2018-09-13T16:42:37+00:00",
12 | "date_modified": "2018-09-13T16:42:37+00:00"
13 | },
14 | "meta": {}
15 | }
--------------------------------------------------------------------------------
/src/BigCommerce/Api/Generic/DeleteResource.php:
--------------------------------------------------------------------------------
1 | getClient()->getRestClient()->delete($this->singleResourceUrl());
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Theme/JobIdentifierResponse.php:
--------------------------------------------------------------------------------
1 | jobId = json_decode($response->getBody())->job_id;
14 | }
15 |
16 | public function getJobId(): string
17 | {
18 | return $this->jobId;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/tests/BigCommerce/responses/catalog__products__226__reviews__824__get.json:
--------------------------------------------------------------------------------
1 | {
2 | "data": {
3 | "title": "Great Review",
4 | "text": "anim aute",
5 | "status": "Lorem ad sed voluptate",
6 | "rating": 3,
7 | "email": "esse Lorem laborum aute",
8 | "name": "ut in ",
9 | "date_reviewed": "2011-12-31T13:40:42.971Z",
10 | "id": 824,
11 | "product_id": 226,
12 | "date_created": "1985-01-17T07:37:20.439Z",
13 | "date_modified": "2004-09-28T14:38:21.973Z"
14 | },
15 | "meta": {}
16 | }
--------------------------------------------------------------------------------
/tests/BigCommerce/Api/StoreLogs/StoreLogsApiTest.php:
--------------------------------------------------------------------------------
1 | setReturnData('storelogs__systemlogs__get.json');
12 |
13 | $logs = $this->getApi()->storeLogs()->get()->getSystemLogs();
14 |
15 | $this->assertEquals('2019-08-24T14:15:22Z', $logs[0]->date_created);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/tests/BigCommerce/Api/Catalog/SummaryApiTest.php:
--------------------------------------------------------------------------------
1 | setReturnData('catalog__summary__get.json');
12 |
13 | $this->assertEquals(
14 | 'Shop All',
15 | $this->getApi()->catalog()->summary()->get()->getSummary()->primary_category_name
16 | );
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/SummaryResponse.php:
--------------------------------------------------------------------------------
1 | summary;
15 | }
16 |
17 | protected function addData(stdClass $rawData): void
18 | {
19 | $this->summary = new Summary($rawData);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/tests/BigCommerce/responses/site__routes__get_all.json:
--------------------------------------------------------------------------------
1 | {
2 | "data": [
3 | {
4 | "id": 1,
5 | "type": "product",
6 | "matching": "5",
7 | "route": "/products?id={id}"
8 | },
9 | {
10 | "id": 2,
11 | "type": "category",
12 | "matching": "44",
13 | "route": "/category/{slug}"
14 | }
15 | ],
16 | "meta": {
17 | "pagination": {
18 | "total": 1,
19 | "count": 1,
20 | "per_page": 50,
21 | "current_page": 1,
22 | "total_pages": 1
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResourceModels/Widget/WidgetTemplate.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 |
18 | protected function resourceClass(): string
19 | {
20 | return Site::class;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Order/RefundsResponse.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 | protected function resourceClass(): string
18 | {
19 | return Refund::class;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Theme/ThemesResponse.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 |
18 | protected function resourceClass(): string
19 | {
20 | return Theme::class;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/tests/BigCommerce/responses/catalog__products__modifiers__222__values__190__get.json:
--------------------------------------------------------------------------------
1 | {
2 | "data": {
3 | "id": 190,
4 | "option_id": 222,
5 | "label": "Yes",
6 | "sort_order": 0,
7 | "value_data": null,
8 | "is_default": false,
9 | "adjusters": {
10 | "price": {
11 | "adjuster": "relative",
12 | "adjuster_value": 5
13 | },
14 | "weight": null,
15 | "image_url": "",
16 | "purchasing_disabled": {
17 | "status": false,
18 | "message": ""
19 | }
20 | }
21 | },
22 | "meta": {}
23 | }
--------------------------------------------------------------------------------
/tests/BigCommerce/responses/content__widget_templates__get.json:
--------------------------------------------------------------------------------
1 | {
2 | "data": {
3 | "current_version_uuid": "c48b131a-ae9d-4767-b5d6-63d9e43bcf75",
4 | "date_created": "2020-11-03T18:51:22.877Z",
5 | "date_modified": "2020-11-03T18:51:22.877Z",
6 | "icon_name": "default",
7 | "kind": "custom",
8 | "name": "Header Images",
9 | "schema": [],
10 | "template": "{{#each images}}
{{/each}}",
11 | "uuid": "b9790903-09b9-4736-87ca-19ff61582ee7"
12 | },
13 | "meta": {}
14 | }
--------------------------------------------------------------------------------
/src/BigCommerce/ResourceModels/Catalog/Product/ProductBulkPricingRule.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 |
18 | protected function resourceClass(): string
19 | {
20 | return Page::class;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Script/ScriptsResponse.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 |
18 | protected function resourceClass(): string
19 | {
20 | return Script::class;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Widget/WidgetsResponse.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 |
18 | protected function resourceClass(): string
19 | {
20 | return Widget::class;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/tests/BigCommerce/Api/Widgets/RegionApiTest.php:
--------------------------------------------------------------------------------
1 | setReturnData('content__regions__get.json');
12 |
13 | $regions = $this->getApi()->widgets()->regions('pages/home')->get()->getRegions();
14 | $this->assertCount(2, $regions);
15 | $this->assertEquals('category_header_banner', $regions[1]->name);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Cart/CartResponse.php:
--------------------------------------------------------------------------------
1 | cart;
16 | }
17 |
18 | protected function addData(stdClass $rawData): void
19 | {
20 | $this->cart = new Cart($rawData);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Channel/ChannelsResponse.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 |
18 | protected function resourceClass(): string
19 | {
20 | return Channel::class;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Page/PageResponse.php:
--------------------------------------------------------------------------------
1 | page;
16 | }
17 |
18 | protected function addData(stdClass $rawData): void
19 | {
20 | $this->page = new Page($rawData);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Site/SiteResponse.php:
--------------------------------------------------------------------------------
1 | site;
16 | }
17 |
18 | protected function addData(stdClass $rawData): void
19 | {
20 | $this->site = new Site($rawData);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Site/SiteRoutesResponse.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 |
18 | protected function resourceClass(): string
19 | {
20 | return SiteRoute::class;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/ComplexRuleResponse.php:
--------------------------------------------------------------------------------
1 | complexRule;
15 | }
16 |
17 | protected function addData(stdClass $rawData): void
18 | {
19 | $this->complexRule = new ComplexRule($rawData);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/CustomFieldResponse.php:
--------------------------------------------------------------------------------
1 | customField;
15 | }
16 |
17 | protected function addData(stdClass $rawData): void
18 | {
19 | $this->customField = new CustomField($rawData);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/OptionsResponse.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 |
18 | protected function resourceClass(): string
19 | {
20 | return ProductOption::class;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Theme/ThemeResponse.php:
--------------------------------------------------------------------------------
1 | theme;
16 | }
17 |
18 | protected function addData(stdClass $rawData): void
19 | {
20 | $this->theme = new Theme($rawData);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Widget/PlacementsResponse.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 |
18 | protected function resourceClass(): string
19 | {
20 | return Placement::class;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Wishlist/WishlistsResponse.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 |
18 | protected function resourceClass(): string
19 | {
20 | return Wishlist::class;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/tests/BigCommerce/Api/Catalog/Products/OptionsApiTest.php:
--------------------------------------------------------------------------------
1 | markTestIncomplete();
12 | }
13 |
14 | public function testCanGetOption(): void
15 | {
16 | $this->markTestIncomplete();
17 | }
18 |
19 | public function testCanGetAllOptions(): void
20 | {
21 | $this->markTestIncomplete();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/ComplexRulesResponse.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 |
18 | protected function resourceClass(): string
19 | {
20 | return ComplexRule::class;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/CustomFieldsResponse.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 |
18 | protected function resourceClass(): string
19 | {
20 | return CustomField::class;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Brand/BrandResponse.php:
--------------------------------------------------------------------------------
1 | brand;
16 | }
17 |
18 | protected function addData(stdClass $rawData): void
19 | {
20 | $this->brand = new Brand($rawData);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Customer/SubscribersResponse.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 |
18 | protected function resourceClass(): string
19 | {
20 | return Subscriber::class;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Order/RefundResponse.php:
--------------------------------------------------------------------------------
1 | refund;
16 | }
17 |
18 | protected function addData(stdClass $rawData): void
19 | {
20 | $this->refund = new Refund($rawData);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/PriceList/PriceListsResponse.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 |
18 | protected function resourceClass(): string
19 | {
20 | return PriceList::class;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/StoreLogs/SystemLogsResponse.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 |
18 | protected function resourceClass(): string
19 | {
20 | return SystemLog::class;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Theme/ThemeJobResponse.php:
--------------------------------------------------------------------------------
1 | job;
16 | }
17 |
18 | protected function addData(stdClass $rawData): void
19 | {
20 | $this->job = new ThemeJob($rawData);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Product/ProductsResponse.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 |
18 | protected function resourceClass(): string
19 | {
20 | return Product::class;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Script/ScriptResponse.php:
--------------------------------------------------------------------------------
1 | script;
16 | }
17 |
18 | protected function addData(stdClass $rawData): void
19 | {
20 | $this->script = new Script($rawData);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Widget/WidgetResponse.php:
--------------------------------------------------------------------------------
1 | widget;
16 | }
17 |
18 | protected function addData(stdClass $rawData): void
19 | {
20 | $this->widget = new Widget($rawData);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/tests/BigCommerce/Api/Customers/CustomerAddressesApiTest.php:
--------------------------------------------------------------------------------
1 | markTestIncomplete();
12 | }
13 |
14 | public function testCanUpdateCustomerAddresses()
15 | {
16 | $this->markTestIncomplete();
17 | }
18 |
19 | public function testCanDeleteCustomerAddresses()
20 | {
21 | $this->markTestIncomplete();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Customer/CustomersResponse.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 |
18 | protected function resourceClass(): string
19 | {
20 | return Customer::class;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Order/OrderMetafieldsResponse.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 |
18 | protected function resourceClass(): string
19 | {
20 | return OrderMetafield::class;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Product/ProductVideosResponse.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 |
18 | protected function resourceClass(): string
19 | {
20 | return ProductVideo::class;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Redirect/RedirectsResponse.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 |
18 | protected function resourceClass(): string
19 | {
20 | return Redirect::class;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/tests/BigCommerce/Api/Catalog/Products/ComplexRulesApiTest.php:
--------------------------------------------------------------------------------
1 | markTestIncomplete();
12 | }
13 |
14 | public function testCanGetComplexRule(): void
15 | {
16 | $this->markTestIncomplete();
17 | }
18 |
19 | public function testCanGetAllComplexRules(): void
20 | {
21 | $this->markTestIncomplete();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/tests/BigCommerce/Api/Catalog/Products/CustomFieldsApiTest.php:
--------------------------------------------------------------------------------
1 | markTestIncomplete();
12 | }
13 |
14 | public function testCanGetCustomField(): void
15 | {
16 | $this->markTestIncomplete();
17 | }
18 |
19 | public function testCanGetAllCustomFields(): void
20 | {
21 | $this->markTestIncomplete();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/tests/BigCommerce/Api/Customers/CustomerAttributesApiTest.php:
--------------------------------------------------------------------------------
1 | markTestIncomplete();
12 | }
13 |
14 | public function testCanUpdateCustomerAttributes()
15 | {
16 | $this->markTestIncomplete();
17 | }
18 |
19 | public function testCanDeleteCustomerAttributes()
20 | {
21 | $this->markTestIncomplete();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Widget/WidgetTemplatesResponse.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 |
18 | protected function resourceClass(): string
19 | {
20 | return WidgetTemplate::class;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Brand/BrandMetafieldsResponse.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 |
18 | protected function resourceClass(): string
19 | {
20 | return BrandMetafield::class;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Channel/ChannelResponse.php:
--------------------------------------------------------------------------------
1 | channel;
16 | }
17 |
18 | protected function addData(stdClass $rawData): void
19 | {
20 | $this->channel = new Channel($rawData);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Product/ProductImagesResponse.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 |
18 | protected function resourceClass(): string
19 | {
20 | return ProductImage::class;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Product/ProductReviewsResponse.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 |
18 | protected function resourceClass(): string
19 | {
20 | return ProductReview::class;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Channel/ChannelListingsResponse.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 |
18 | protected function resourceClass(): string
19 | {
20 | return ChannelListing::class;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Customer/CustomerAddressesResponse.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 |
18 | protected function resourceClass(): string
19 | {
20 | return CustomerAddress::class;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Payment/AcceptedPaymentMethodsResponse.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 |
18 | protected function resourceClass(): string
19 | {
20 | return PaymentMethod::class;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/PriceList/PriceListRecordsResponse.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 |
18 | protected function resourceClass(): string
19 | {
20 | return PriceListRecord::class;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Product/ModifiersResponse.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 |
18 | protected function resourceClass(): string
19 | {
20 | return ProductModifier::class;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Product/ProductResponse.php:
--------------------------------------------------------------------------------
1 | product;
16 | }
17 |
18 | protected function addData(stdClass $rawData): void
19 | {
20 | $this->product = new Product($rawData);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Channel/ChannelSiteResponse.php:
--------------------------------------------------------------------------------
1 | site;
16 | }
17 |
18 | protected function addData(stdClass $rawData): void
19 | {
20 | $this->site = new ChannelSite($rawData);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Customer/CustomerResponse.php:
--------------------------------------------------------------------------------
1 | customer;
16 | }
17 |
18 | protected function addData(stdClass $rawData): void
19 | {
20 | $this->customer = new Customer($rawData);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Order/RefundQuoteResponse.php:
--------------------------------------------------------------------------------
1 | quote;
16 | }
17 |
18 | protected function addData(stdClass $rawData): void
19 | {
20 | $this->quote = new RefundQuote($rawData);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Product/ProductVariantsResponse.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 |
18 | protected function resourceClass(): string
19 | {
20 | return ProductVariant::class;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/SingleResourceResponse.php:
--------------------------------------------------------------------------------
1 | addData($this->decodeResponseBody(json_decode($response->getBody())));
13 | }
14 |
15 | protected function decodeResponseBody(object $responseBody): object
16 | {
17 | return $responseBody->data;
18 | }
19 |
20 | abstract protected function addData(stdClass $rawData): void;
21 | }
22 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Site/SiteRouteResponse.php:
--------------------------------------------------------------------------------
1 | siteRoute;
16 | }
17 |
18 | protected function addData(stdClass $rawData): void
19 | {
20 | $this->siteRoute = new SiteRoute($rawData);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Wishlist/WishlistResponse.php:
--------------------------------------------------------------------------------
1 | wishlist;
16 | }
17 |
18 | protected function addData(stdClass $rawData): void
19 | {
20 | $this->wishlist = new Wishlist($rawData);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/tests/BigCommerce/responses/catalog__categories__39__get.json:
--------------------------------------------------------------------------------
1 | {
2 | "data": {
3 | "id": 39,
4 | "parent_id": 19,
5 | "name": "Bath",
6 | "description": "",
7 | "views": 0,
8 | "sort_order": 0,
9 | "page_title": "",
10 | "meta_keywords": [
11 | ""
12 | ],
13 | "meta_description": "",
14 | "layout_file": "category.html",
15 | "image_url": "",
16 | "is_visible": true,
17 | "search_keywords": "",
18 | "default_product_sort": "use_store_settings",
19 | "custom_url": {
20 | "url": "/garden/bath/",
21 | "is_customized": false
22 | }
23 | },
24 | "meta": {}
25 | }
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Customer/CustomerAttributesResponse.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 |
18 | protected function resourceClass(): string
19 | {
20 | return CustomerAttribute::class;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Product/ProductMetafieldsResponse.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 |
18 | protected function resourceClass(): string
19 | {
20 | return ProductMetafield::class;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Widget/PlacementResponse.php:
--------------------------------------------------------------------------------
1 | placement;
16 | }
17 |
18 | protected function addData(stdClass $rawData): void
19 | {
20 | $this->placement = new Placement($rawData);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerceLegacyApi/ResourceModels/Order/OrderAddress.php:
--------------------------------------------------------------------------------
1 | markTestIncomplete();
12 | }
13 |
14 | public function testCanUpdateCustomerAttributeValues()
15 | {
16 | $this->markTestIncomplete();
17 | }
18 |
19 | public function testCanDeleteCustomerAttributeValues()
20 | {
21 | $this->markTestIncomplete();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Category/CategoryResponse.php:
--------------------------------------------------------------------------------
1 | category;
16 | }
17 |
18 | protected function addData(stdClass $rawData): void
19 | {
20 | $this->category = new Category($rawData);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Category/CategoryMetafieldsResponse.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 |
18 | protected function resourceClass(): string
19 | {
20 | return CategoryMetafield::class;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Product/OptionResponse.php:
--------------------------------------------------------------------------------
1 | option;
16 | }
17 |
18 | protected function addData(stdClass $rawData): void
19 | {
20 | $this->option = new ProductOption($rawData);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResourceModels/Catalog/Summary.php:
--------------------------------------------------------------------------------
1 | subscriber;
16 | }
17 |
18 | protected function addData(stdClass $rawData): void
19 | {
20 | $this->subscriber = new Subscriber($rawData);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/PriceList/PriceListAssignmentsResponse.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 |
18 | protected function resourceClass(): string
19 | {
20 | return PriceListAssignment::class;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Product/ProductOptionValuesResponse.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 |
18 | protected function resourceClass(): string
19 | {
20 | return ProductOptionValue::class;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Product/ProductVideoResponse.php:
--------------------------------------------------------------------------------
1 | video;
16 | }
17 |
18 | protected function addData(stdClass $rawData): void
19 | {
20 | $this->video = new ProductVideo($rawData);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Customer/CustomerAttributeValuesResponse.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 |
18 | protected function resourceClass(): string
19 | {
20 | return CustomerAttributeValue::class;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/tests/BigCommerce/responses/scripts__create.json:
--------------------------------------------------------------------------------
1 | {
2 | "data": {
3 | "uuid": "311a146b-8322-4b6e-905f-6c9a6037514b",
4 | "name": "jQuery",
5 | "description": "The Write Less, Do More, JavaScript Library.",
6 | "html": "",
7 | "src": "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js",
8 | "auto_uninstall": true,
9 | "load_method": "default",
10 | "location": "head",
11 | "visibility": "storefront",
12 | "kind": "src",
13 | "date_created": "2018-09-17T16:39:43.472Z",
14 | "date_modified": "2018-09-17T16:39:43.472Z",
15 | "api_client_id": "2d63fbe890f4ac83794d69f361e055"
16 | },
17 | "meta": {}
18 | }
--------------------------------------------------------------------------------
/src/BigCommerce/ResourceModels/Customer/CustomerAddress.php:
--------------------------------------------------------------------------------
1 | getData();
19 | }
20 |
21 | protected function resourceClass(): string
22 | {
23 | return Brand::class;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Order/OrderMetafieldResponse.php:
--------------------------------------------------------------------------------
1 | metafield;
16 | }
17 |
18 | protected function addData(stdClass $rawData): void
19 | {
20 | $this->metafield = new OrderMetafield($rawData);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Product/ProductReviewResponse.php:
--------------------------------------------------------------------------------
1 | review;
16 | }
17 |
18 | protected function addData(stdClass $rawData): void
19 | {
20 | $this->review = new ProductReview($rawData);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Widget/WidgetTemplateResponse.php:
--------------------------------------------------------------------------------
1 | template;
16 | }
17 |
18 | protected function addData(stdClass $rawData): void
19 | {
20 | $this->template = new WidgetTemplate($rawData);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/tests/BigCommerce/responses/storefront__redirects.json:
--------------------------------------------------------------------------------
1 | {
2 | "data": [
3 | {
4 | "from_path": "/old-url",
5 | "site_id": 0,
6 | "to": {
7 | "type": "product",
8 | "entity_id": 0,
9 | "url": "/new-url"
10 | },
11 | "id": 0,
12 | "to_url": "https://store-domain.com/new-url"
13 | }
14 | ],
15 | "meta": {
16 | "pagination": {
17 | "total": 246,
18 | "count": 5,
19 | "per_page": 5,
20 | "current_page": 1,
21 | "total_pages": 50,
22 | "links": {
23 | "next": "?limit=5&page=2",
24 | "current": "?limit=5&page=1"
25 | }
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResourceModels/Customer/StoredInstruments/StoredCard.php:
--------------------------------------------------------------------------------
1 | buildPropertyObject('billing_address', CardBillingAddress::class);
18 | parent::beforeBuildObject();
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/tests/BigCommerce/Api/Subscribers/SubscribersApiTest.php:
--------------------------------------------------------------------------------
1 | markTestIncomplete();
12 | }
13 |
14 | public function testCanGetSubscribers(): void
15 | {
16 | $this->setReturnData('no-data-paginated.json');
17 |
18 | $this->getApi()->customers()->subscribers()->getAll()->getSubscribers();
19 | $this->assertEquals('customers/subscribers', $this->getLastRequestPath());
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Brand/BrandMetafieldResponse.php:
--------------------------------------------------------------------------------
1 | metafield;
16 | }
17 |
18 | protected function addData(stdClass $rawData): void
19 | {
20 | $this->metafield = new BrandMetafield($rawData);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Customer/CustomerConsentResponse.php:
--------------------------------------------------------------------------------
1 | consent;
16 | }
17 |
18 | protected function addData(stdClass $rawData): void
19 | {
20 | $this->consent = new CustomerConsent($rawData);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/PriceList/PriceListRecordResponse.php:
--------------------------------------------------------------------------------
1 | record;
16 | }
17 |
18 | protected function addData(stdClass $rawData): void
19 | {
20 | $this->record = new PriceListRecord($rawData);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Product/ProductBulkPricingRulesResponse.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 |
18 | protected function resourceClass(): string
19 | {
20 | return ProductBulkPricingRule::class;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Product/ProductVariantMetafieldsResponse.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 |
18 | protected function resourceClass(): string
19 | {
20 | return ProductVariantMetafield::class;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Widget/RegionsResponse.php:
--------------------------------------------------------------------------------
1 | regions = json_decode($response->getBody())->data;
18 | }
19 |
20 | /**
21 | * @return Region[]
22 | */
23 | public function getRegions(): array
24 | {
25 | return $this->regions;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/tests/BigCommerce/Api/Channels/ChannelSitesApiTest.php:
--------------------------------------------------------------------------------
1 | setReturnData('channels__18735__site__1__get.json');
12 | $channelId = 18735;
13 |
14 | $site = $this->getApi()->channel($channelId)->site()->get()->getSite();
15 | $this->assertEquals('https://www.my-awesome-site.com', $site->url);
16 | $this->assertEquals("channels/$channelId/site", $this->getLastRequest()->getUri()->getPath());
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/tests/BigCommerce/responses/catalog__products__bulk_pricing_rules__get_all.json:
--------------------------------------------------------------------------------
1 | {
2 | "data": [
3 | {
4 | "id": 83,
5 | "quantity_min": 1,
6 | "quantity_max": 3,
7 | "type": "price",
8 | "amount": 1
9 | },
10 | {
11 | "id": 84,
12 | "quantity_min": 4,
13 | "quantity_max": 0,
14 | "type": "price",
15 | "amount": 1.25
16 | }
17 | ],
18 | "meta": {
19 | "pagination": {
20 | "total": 2,
21 | "count": 2,
22 | "per_page": 50,
23 | "current_page": 1,
24 | "total_pages": 1,
25 | "links": {
26 | "current": "?page=1&limit=50"
27 | }
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/tests/BigCommerce/responses/storelogs__systemlogs__get.json:
--------------------------------------------------------------------------------
1 | {
2 | "data": [
3 | {
4 | "id": 0,
5 | "type": "string",
6 | "module": "string",
7 | "severity": "string",
8 | "summary": "string",
9 | "message": "string",
10 | "date_created": "2019-08-24T14:15:22Z"
11 | }
12 | ],
13 | "meta": {
14 | "pagination": {
15 | "total": 1,
16 | "count": 1,
17 | "per_page": 50,
18 | "current_page": 1,
19 | "total_pages": 1,
20 | "links": {
21 | "previous": "?page=1&limit=50",
22 | "current": "?page=1&limit=50",
23 | "next": "?page=1&limit=50"
24 | }
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/src/BigCommerce/ResourceModels/Catalog/Product/ProductImage.php:
--------------------------------------------------------------------------------
1 | getData();
17 | }
18 |
19 | protected function resourceClass(): string
20 | {
21 | return CustomerFormFieldValue::class;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Payment/PaymentAccessTokenResponse.php:
--------------------------------------------------------------------------------
1 | token;
16 | }
17 |
18 | protected function addData(stdClass $rawData): void
19 | {
20 | $this->token = new PaymentAccessToken($rawData);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Product/ProductImageResponse.php:
--------------------------------------------------------------------------------
1 | productImage;
16 | }
17 |
18 | protected function addData(stdClass $rawData): void
19 | {
20 | $this->productImage = new ProductImage($rawData);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResourceModels/Customer/CustomerSettings/PrivacySettings.php:
--------------------------------------------------------------------------------
1 | channelTheme;
16 | }
17 |
18 | protected function addData(stdClass $rawData): void
19 | {
20 | $this->channelTheme = new ChannelTheme($rawData);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResourceModels/Catalog/Product/ProductModifierValueAdjuster.php:
--------------------------------------------------------------------------------
1 | buildPropertyObject('price', PriceAdjuster::class);
18 | $this->buildPropertyObject('weight', WeightAdjuster::class);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Order/TransactionsResponse.php:
--------------------------------------------------------------------------------
1 | getData();
19 | }
20 |
21 | protected function resourceClass(): string
22 | {
23 | return Transaction::class;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/BigCommerce/Api/Generic/UpdateResource.php:
--------------------------------------------------------------------------------
1 | getClient()->getRestClient()->put(
17 | $this->singleResourceUrl(),
18 | [
19 | RequestOptions::JSON => $resource,
20 | ]
21 | );
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Category/CategoriesResponse.php:
--------------------------------------------------------------------------------
1 | getData();
19 | }
20 |
21 | protected function resourceClass(): string
22 | {
23 | return Category::class;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Channel/ChannelListingResponse.php:
--------------------------------------------------------------------------------
1 | channelListing;
16 | }
17 |
18 | protected function addData(stdClass $rawData): void
19 | {
20 | $this->channelListing = new ChannelListing($rawData);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Product/ModifierResponse.php:
--------------------------------------------------------------------------------
1 | productModifier;
16 | }
17 |
18 | protected function addData(stdClass $rawData): void
19 | {
20 | $this->productModifier = new ProductModifier($rawData);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResourceModels/Customer/Subscriber.php:
--------------------------------------------------------------------------------
1 | metafield;
16 | }
17 |
18 | protected function addData(stdClass $rawData): void
19 | {
20 | $this->metafield = new CategoryMetafield($rawData);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/tests/BigCommerce/responses/scripts__get.json:
--------------------------------------------------------------------------------
1 | {
2 | "data": {
3 | "uuid": "311a146b-8322-4b6e-905f-6c9a6037514b",
4 | "name": "jQuery",
5 | "description": "The Write Less, Do More, JavaScript Library.",
6 | "html": "",
7 | "src": "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js",
8 | "auto_uninstall": true,
9 | "load_method": "default",
10 | "location": "head",
11 | "visibility": "storefront",
12 | "kind": "src",
13 | "date_created": "2018-09-17T16:39:43.472Z",
14 | "date_modified": "2018-09-17T16:39:43.472Z",
15 | "api_client_id": "2d63fbe890f4ac83794d69f361e055",
16 | "consent_category": "essential"
17 | },
18 | "meta": {}
19 | }
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Cart/CartRedirectUrlsResponse.php:
--------------------------------------------------------------------------------
1 | cartRedirectUrls;
16 | }
17 |
18 | protected function addData(stdClass $rawData): void
19 | {
20 | $this->cartRedirectUrls = new CartRedirectUrls($rawData);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/PriceList/PriceListResponse.php:
--------------------------------------------------------------------------------
1 | priceList;
19 | }
20 |
21 | protected function addData(stdClass $rawData): void
22 | {
23 | $this->priceList = new PriceList($rawData);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/BigCommerce/Api/Generic/GetResource.php:
--------------------------------------------------------------------------------
1 | getClient()->getRestClient()->get(
17 | $this->singleResourceUrl(),
18 | [
19 | RequestOptions::QUERY => $queryParams,
20 | ]
21 | );
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Product/ProductBulkPricingRuleResponse.php:
--------------------------------------------------------------------------------
1 | rule;
16 | }
17 |
18 | protected function addData(stdClass $rawData): void
19 | {
20 | $this->rule = new ProductBulkPricingRule($rawData);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/Api/Themes/ThemeJobsApi.php:
--------------------------------------------------------------------------------
1 | getResource());
18 | }
19 |
20 | public function singleResourceUrl(): string
21 | {
22 | return sprintf(self::THEME_JOB_ENDPOINT, $this->getUuid());
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResourceModels/Customer/StoredInstruments/CardBillingAddress.php:
--------------------------------------------------------------------------------
1 | customerSettings;
16 | }
17 |
18 | protected function addData(stdClass $rawData): void
19 | {
20 | $this->customerSettings = new CustomerSettings($rawData);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Product/ProductOptionValueResponse.php:
--------------------------------------------------------------------------------
1 | optionValue;
16 | }
17 |
18 | protected function addData(stdClass $rawData): void
19 | {
20 | $this->optionValue = new ProductOptionValue($rawData);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/Api/StoreLogs/StoreLogsApi.php:
--------------------------------------------------------------------------------
1 | getClient()->getRestClient()->get(
16 | self::SYSTEM_LOGS_ENDPOINT,
17 | [
18 | RequestOptions::QUERY => $queryParams,
19 | ]
20 | ));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/tests/BigCommerceLegacyApi/Api/Orders/OrderProductsApiTest.php:
--------------------------------------------------------------------------------
1 | setReturnData('orders_v2__149__products__get_all.json');
12 |
13 | $orderProducts = $this->getApi()->order(149)->products()->getAll();
14 |
15 | $this->assertCount(2, $orderProducts);
16 | $this->assertEquals('Fog Linen Chambray Towel - Beige Stripe', $orderProducts[0]->name);
17 | $this->assertEquals('Size', $orderProducts[0]->product_options[0]->display_name);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Product/ProductModifierValueResponse.php:
--------------------------------------------------------------------------------
1 | modifierValue;
16 | }
17 |
18 | protected function addData(stdClass $rawData): void
19 | {
20 | $this->modifierValue = new ProductModifierValue($rawData);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/tests/BigCommerce/responses/templates__get_all.json:
--------------------------------------------------------------------------------
1 | {
2 | "data": [
3 | {
4 | "id": 1,
5 | "channel_id": 1,
6 | "entity_type": "product",
7 | "entity_id": 123,
8 | "file_name": "custom-product-1.html"
9 | },
10 | {
11 | "id": 2,
12 | "channel_id": 12345,
13 | "entity_type": "page",
14 | "entity_id": 123,
15 | "file_name": "custom-page.html"
16 | }
17 | ],
18 | "meta": {
19 | "pagination": {
20 | "total": 246,
21 | "count": 5,
22 | "per_page": 5,
23 | "current_page": 1,
24 | "total_pages": 50,
25 | "links": {
26 | "next": "?limit=5&page=2",
27 | "current": "?limit=5&page=1"
28 | }
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Customer/CustomerChannelSettingsResponse.php:
--------------------------------------------------------------------------------
1 | channelSettings;
16 | }
17 |
18 | protected function addData(stdClass $rawData): void
19 | {
20 | $this->channelSettings = new CustomerChannelSettings($rawData);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Product/ProductMetafieldResponse.php:
--------------------------------------------------------------------------------
1 | metafield;
19 | }
20 |
21 | protected function addData(stdClass $rawData): void
22 | {
23 | $this->metafield = new ProductMetafield($rawData);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/tests/BigCommerce/responses/orders__order_refunds__create.json:
--------------------------------------------------------------------------------
1 | {
2 | "data": {
3 | "id": 1,
4 | "order_id": 1,
5 | "user_id": 1,
6 | "created": "",
7 | "reason": "test reason",
8 | "total_amount": 1.99,
9 | "total_tax": 1,
10 | "items": [
11 | {
12 | "item_type": "HANDLING",
13 | "item_id": 1,
14 | "reason": "",
15 | "quantity": 1,
16 | "requested_amount": 0.05
17 | }
18 | ],
19 | "payments": [
20 | {
21 | "id": 1,
22 | "provider_id": "checkout_paypalexpress",
23 | "amount": 1.99,
24 | "offline": true,
25 | "is_declined": true,
26 | "declined_message": ""
27 | }
28 | ]
29 | },
30 | "meta": {}
31 | }
32 |
--------------------------------------------------------------------------------
/tests/BigCommerceLegacyApi/Api/Orders/OrderShippingAddressesApiTest.php:
--------------------------------------------------------------------------------
1 | markTestIncomplete();
12 | }
13 |
14 | public function testCanGetShippingAddresses()
15 | {
16 | $this->setReturnData('orders_v2__229__shipping_addresses__get_all.json');
17 | $addresses = $this->getApi()->order(229)->shippingAddresses()->getAll();
18 |
19 | $this->assertCount(2, $addresses);
20 | $this->assertEquals('555 Main Street', $addresses[1]->street_1);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Product/ProductVariantResponse.php:
--------------------------------------------------------------------------------
1 | productVariant;
19 | }
20 |
21 | protected function addData(stdClass $rawData): void
22 | {
23 | $this->productVariant = new ProductVariant($rawData);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Channel/ChannelCurrencyAssignmentsResponse.php:
--------------------------------------------------------------------------------
1 | getData();
17 | }
18 |
19 | protected function resourceClass(): string
20 | {
21 | return ChannelCurrencyAssignment::class;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/CustomTemplateAssociation/CustomTemplateAssociationsResponse.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 |
18 | protected function resourceClass(): string
19 | {
20 | return CustomTemplateAssociation::class;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/BigCommerce/Api/Generic/DeleteInIdList.php:
--------------------------------------------------------------------------------
1 | getClient()->getRestClient()->delete(
16 | $this->multipleResourceUrl(),
17 | [
18 | RequestOptions::QUERY => [
19 | 'id:in' => implode(',', $ids)
20 | ]
21 | ]
22 | );
23 |
24 | return $response->getStatusCode() === 204;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResourceModels/CustomTemplateAssociation/CustomTemplateAssociation.php:
--------------------------------------------------------------------------------
1 | setReturnData('pages__2__get.json');
12 | $page = $this->getApi()->page(2)->get()->getPage();
13 |
14 | $this->assertEquals('Shipping & Returns', $page->name);
15 | }
16 |
17 | public function testCanGetAll()
18 | {
19 | $this->setReturnData('pages__get_all.json');
20 | $pages = $this->getApi()->pages()->getAll()->getPages();
21 |
22 | $this->assertEquals('fullname,companyname,phone,orderno,rma', $pages[2]->contact_fields);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/BigCommerce/Api/Generic/CreateResource.php:
--------------------------------------------------------------------------------
1 | getClient()->getRestClient()->post(
17 | $this->multipleResourceUrl(),
18 | [
19 | RequestOptions::JSON => $resource,
20 | RequestOptions::QUERY => $query,
21 | ]
22 | );
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/BigCommerceLegacyApi/ResponseModels/Order/OrderProductOption.php:
--------------------------------------------------------------------------------
1 | buildObjectArray('urls', SiteUrl::class);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/tests/BigCommerce/Api/Catalog/Categories/CategoryImageApiTest.php:
--------------------------------------------------------------------------------
1 | setReturnData('catalog__categories__1__image__create.json');
12 | $response = $this->getApi()
13 | ->catalog()
14 | ->category(1)
15 | ->image()
16 | ->create(self::REQUESTS_PATH . 'orange-catalog-icon-1.png');
17 |
18 | $this->assertEquals(
19 | 'https://cdn11.bigcommerce.com/s-{store_hash}/product_images/k/group_1545334669__76009.png',
20 | $response
21 | );
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Product/ProductVariantMetafieldResponse.php:
--------------------------------------------------------------------------------
1 | metafield;
19 | }
20 |
21 | protected function addData(stdClass $rawData): void
22 | {
23 | $this->metafield = new ProductVariantMetafield($rawData);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/tests/BigCommerce/responses/channels__391563__get.json:
--------------------------------------------------------------------------------
1 | {
2 | "data": {
3 | "id": 391563,
4 | "name": "Amazon US",
5 | "platform": "amazon",
6 | "type": "marketplace",
7 | "date_created": "2020-08-25T18:45:11Z",
8 | "date_modified": "2020-08-25T18:45:11Z",
9 | "external_id": "",
10 | "is_listable_from_ui": true,
11 | "is_enabled": true,
12 | "is_visible": true,
13 | "status": "connected",
14 | "config_meta": {
15 | "app": {
16 | "id": 123,
17 | "sections": [
18 | {
19 | "title": "Overview",
20 | "query_path": "overview"
21 | },
22 | {
23 | "title": "Settings",
24 | "query_path": "settings"
25 | }
26 | ]
27 | }
28 | }
29 | },
30 | "meta": {}
31 | }
32 |
--------------------------------------------------------------------------------
/tests/BigCommerce/responses/wishlist__30__get.json:
--------------------------------------------------------------------------------
1 | {
2 | "data": {
3 | "id": 30,
4 | "customer_id": 10,
5 | "name": "Christmas List",
6 | "is_public": true,
7 | "token": "d2d55481-13eb-4d1e-9d79-9062b518570d",
8 | "items": [
9 | {
10 | "id": 44,
11 | "product_id": 77,
12 | "variant_id": 1
13 | },
14 | {
15 | "id": 45,
16 | "product_id": 80,
17 | "variant_id": 1
18 | },
19 | {
20 | "id": 46,
21 | "product_id": 81,
22 | "variant_id": 1
23 | },
24 | {
25 | "id": 47,
26 | "product_id": 86,
27 | "variant_id": 1
28 | },
29 | {
30 | "id": 48,
31 | "product_id": 88,
32 | "variant_id": 1
33 | }
34 | ]
35 | },
36 | "meta": {}
37 | }
--------------------------------------------------------------------------------
/src/BigCommerceLegacyApi/ResponseModels/Order/OrderCount.php:
--------------------------------------------------------------------------------
1 | statuses = [];
19 | foreach ($optionObject->statuses as $status) {
20 | $statusCount = new OrderStatusCount($status);
21 | $this->statuses[$statusCount->name] = $statusCount;
22 | }
23 | unset($optionObject->statuses);
24 |
25 | parent::__construct($optionObject);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResourceModels/Catalog/Brand/Brand.php:
--------------------------------------------------------------------------------
1 | buildCustomUrl($optionObject);
25 | }
26 | parent::__construct($optionObject);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResourceModels/Customer/CustomerSettings.php:
--------------------------------------------------------------------------------
1 | buildPropertyObject('privacy_settings', PrivacySettings::class);
17 | $this->buildPropertyObject('customer_group_settings', CustomerGroupSettings::class);
18 |
19 | parent::beforeBuildObject();
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/tests/BigCommerce/responses/catalog__categories__get_tree.json:
--------------------------------------------------------------------------------
1 | {"data":[{"id":23,"parent_id":0,"name":"Shop All","is_visible":true,"url":"\/shop-all\/","children":[]},{"id":18,"parent_id":0,"name":"Bath","is_visible":true,"url":"\/bath\/","children":[{"id":24,"parent_id":18,"name":"Small Baths","is_visible":true,"url":"\/bath\/small-baths\/","children":[{"id":25,"parent_id":24,"name":"Small Red Baths","is_visible":true,"url":"\/bath\/small-baths\/small-red-baths\/","children":[]}]}]},{"id":19,"parent_id":0,"name":"Garden","is_visible":true,"url":"\/garden\/","children":[]},{"id":21,"parent_id":0,"name":"Kitchen","is_visible":true,"url":"\/kitchen\/","children":[]},{"id":20,"parent_id":0,"name":"Publications","is_visible":true,"url":"\/publications\/","children":[]},{"id":22,"parent_id":0,"name":"Utility","is_visible":true,"url":"\/utility\/","children":[]}],"meta":{}}
--------------------------------------------------------------------------------
/tests/BigCommerce/responses/catalog__products__1__reviews__get_all.json:
--------------------------------------------------------------------------------
1 | {
2 | "data": [{
3 | "title": "Great Product",
4 | "text": "This product is amazing!!!",
5 | "status": "approved",
6 | "rating": 5,
7 | "email": "janedoe@email.com",
8 | "name": "Jane Doe",
9 | "date_reviewed": "2018-05-07T19:37:13+00:00",
10 | "id": 5,
11 | "product_id": 1,
12 | "date_created": "2018-05-07T19:37:13+00:00\"",
13 | "date_modified": "2018-05-07T19:38:36+00:00"
14 | }],
15 | "meta": {
16 | "pagination": {
17 | "total": 1,
18 | "count": 1,
19 | "per_page": 50,
20 | "current_page": 1,
21 | "total_pages": 1,
22 | "links": {
23 | "previous": "?page=1&limit=50",
24 | "current": "?page=1&limit=50",
25 | "next": "?page=1&limit=50"
26 | }
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/src/BigCommerceLegacyApi/ResourceModels/Order/OrderProduct.php:
--------------------------------------------------------------------------------
1 | name = $name;
20 | $product->quantity = $quantity;
21 | $product->price_ex_tax = $price_ex_tax;
22 | $product->price_inc_tax = $price_inc_tax;
23 |
24 | return $product;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/tests/BigCommerce/responses/price_lists__get_all.json:
--------------------------------------------------------------------------------
1 | {
2 | "data": [
3 | {
4 | "id": 1,
5 | "name": "Warehouse",
6 | "date_created": "2018-02-26T17:33:11Z",
7 | "date_modified": "2018-05-08T14:05:27Z",
8 | "active": true
9 | },
10 | {
11 | "id": 2,
12 | "name": "B2B",
13 | "date_created": "2018-02-26T17:37:01Z",
14 | "date_modified": "2018-02-26T17:37:01Z",
15 | "active": true
16 | },
17 | {
18 | "id": 3,
19 | "name": "Wholesale",
20 | "date_created": "2018-04-05T16:05:12Z",
21 | "date_modified": "2018-04-05T16:05:12Z",
22 | "active": true
23 | }
24 | ],
25 | "meta": {
26 | "pagination": {
27 | "total": 3,
28 | "count": 3,
29 | "per_page": 50,
30 | "current_page": 1,
31 | "total_pages": 1
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/src/BigCommerce/ResourceModels/Order/Refund.php:
--------------------------------------------------------------------------------
1 | items = array_map(fn($i) => new OrderRefundItem($i), $optionObject->items);
26 | unset($optionObject->items);
27 | parent::__construct($optionObject);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/tests/BigCommerce/Api/Wishlists/WishlistsApiTest.php:
--------------------------------------------------------------------------------
1 | setReturnData('wishlist__30__get.json');
12 | $wishlist = $this->getApi()->wishlist(30)->get()->getWishlist();
13 |
14 | $this->assertEquals('Christmas List', $wishlist->name);
15 | $this->assertEquals(80, $wishlist->items[1]->product_id);
16 | }
17 |
18 | public function testCanGetWishlists()
19 | {
20 | $this->setReturnData('wishlist__get_all.json');
21 |
22 | $wishlists = $this->getApi()->wishlists()->getAll()->getWishlists();
23 | $this->assertEquals(20, $wishlists[2]->customer_id);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/tests/BigCommerce/Api/Themes/ThemeJobsApiTest.php:
--------------------------------------------------------------------------------
1 | setReturnData('themes__jobs__get.json');
13 | $expectedId = 'ceea1917b1518f5ae491da6ad8a56336';
14 | $expectedThemeId = 'ed1982d0-9d78-0136-33ba-0d84a0c6431b';
15 |
16 | $response = $this->getApi()->themes()->job($expectedId)->get();
17 | $this->assertEquals($expectedId, $response->getJob()->id);
18 | $this->assertEquals(ThemeJob::STATUS__COMPLETED, $response->getJob()->status);
19 | $this->assertEquals($expectedThemeId, $response->getJob()->getThemeId());
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/BigCommerce/Api/Generic/GetAllResources.php:
--------------------------------------------------------------------------------
1 | getClient()->getRestClient()->get(
17 | $this->multipleResourceUrl(),
18 | [
19 | RequestOptions::QUERY => array_merge($filters, [
20 | 'page' => $page,
21 | 'limit' => $limit,
22 | ])
23 | ]
24 | );
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/tests/BigCommerce/Api/Themes/ThemeActionsApiTest.php:
--------------------------------------------------------------------------------
1 | setReturnData('themes__upload.json');
13 | $this->assertEquals(
14 | 'ceea1917b1518f5ae491da6ad8a56336',
15 | $this->getApi()->theme('abcdefg')->actions()->download(ThemeActionsApi::LAST_CREATED)->getJobId()
16 | );
17 | }
18 |
19 | public function testCanActivateTheme()
20 | {
21 | $this->setReturnData(self::EMPTY_RESPONSE, 200);
22 |
23 | $this->assertTrue($this->getApi()->themes()->actions()->activate('abc', ThemeActionsApi::ORIGINAL));
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/tests/BigCommerce/Api/Sites/SitesApiTest.php:
--------------------------------------------------------------------------------
1 | setReturnData('sites__23__get.json');
13 | $site = $this->getApi()->site(23)->get()->getSite();
14 | $this->assertEquals('https://example.com', $site->url);
15 | $this->assertEquals('https://checkout.example.com', $site->urls[2]->url);
16 | }
17 |
18 | public function testCanGetSites()
19 | {
20 | $this->setReturnData('sites__get_all.json');
21 | $sites = $this->getApi()->sites()->getAll()->getSites();
22 | $this->assertEquals(Site::SSL_STATUS_DEDICATED, $sites[0]->ssl_status);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResourceModels/HasCustomUrl.php:
--------------------------------------------------------------------------------
1 | custom_url = new CustomUrl();
19 | $this->custom_url->url = $url;
20 | $this->custom_url->is_customized = true;
21 | }
22 |
23 | protected function buildCustomUrl(\stdClass $data): void
24 | {
25 | if (isset($data->custom_url)) {
26 | $this->custom_url = new CustomUrl($data->custom_url);
27 | unset($data->custom_url);
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Product/ProductModifierValuesResponse.php:
--------------------------------------------------------------------------------
1 | getData();
16 | }
17 |
18 | protected function addData(array $data): void
19 | {
20 | $this->setData(array_map(function (\stdClass $v) {
21 | return new ProductModifierValue($v);
22 | }, $data));
23 | }
24 |
25 | protected function resourceClass(): string
26 | {
27 | return ProductModifierValue::class;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResourceModels/Customer/StoredInstruments/StoredInstrumentFactory.php:
--------------------------------------------------------------------------------
1 | StoredBankAccount::class,
9 | StoredInstrument::TYPE__CARD => StoredCard::class,
10 | StoredInstrument::TYPE__PAYPAL => StoredPaypalAccount::class,
11 | ];
12 |
13 | public function build(object $storedInstrumentData): StoredInstrument
14 | {
15 | if (array_key_exists($storedInstrumentData->type, $this->map)) {
16 | return new $this->map[$storedInstrumentData->type]($storedInstrumentData);
17 | }
18 |
19 | throw new \UnexpectedValueException("Unrecognised stored instrument '{$storedInstrumentData->type}'");
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResourceModels/Catalog/Product/ProductReview.php:
--------------------------------------------------------------------------------
1 | routes)) {
24 | foreach ($optionObject->routes as $route) {
25 | $this->routes[] = new ChannelSiteRoute($route);
26 | }
27 |
28 | unset($optionObject->routes);
29 | }
30 |
31 | parent::__construct($optionObject);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/PaginatedBatchableResponse.php:
--------------------------------------------------------------------------------
1 | appendData($data);
25 | }
26 |
27 | return $paginatedResponse;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Customer/ValidateCredentialsResponse.php:
--------------------------------------------------------------------------------
1 | credentialsValidation;
21 | }
22 |
23 | protected function addData(stdClass $rawData): void
24 | {
25 | $this->credentialsValidation = new CustomerCredentialsValidation($rawData);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResourceModels/Site/SiteRoute.php:
--------------------------------------------------------------------------------
1 | setReturnData('orders__2__metafields__3__get.json');
12 |
13 | $this->getApi()->order(2)->metafield(3)->get();
14 | $this->assertEquals('orders/2/metafields/3', $this->getLastRequestPath());
15 | }
16 |
17 | public function testCanGetAllOrderMetafields(): void
18 | {
19 | $this->setReturnData('orders__1__metafields__get_all.json');
20 |
21 | $response = $this->getApi()->order(1)->metafields()->getAll();
22 | $this->assertEquals(2, $response->getPagination()->total);
23 | $this->assertEquals('orders/1/metafields', $this->getLastRequestPath());
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Channel/ChannelCurrencyAssignmentResponse.php:
--------------------------------------------------------------------------------
1 | currencyAssignment;
20 | }
21 |
22 | protected function addData(stdClass $rawData): void
23 | {
24 | $this->currencyAssignment = new ChannelCurrencyAssignment($rawData);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/BigCommerceLegacyApi/Api/Generic/V2ApiBase.php:
--------------------------------------------------------------------------------
1 | client = $client;
16 | $this->resourceId = $resourceId;
17 | $this->parentResourceId = $parentResourceId;
18 | }
19 |
20 | public function getResourceId(): ?int
21 | {
22 | return $this->resourceId;
23 | }
24 |
25 | public function getParentResourceId(): ?int
26 | {
27 | return $this->parentResourceId;
28 | }
29 |
30 | public function getClient(): BaseApiClient
31 | {
32 | return $this->client;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/BigCommerce/Api/Catalog/Brands/BrandImageApi.php:
--------------------------------------------------------------------------------
1 | catalog()->brand(1)->image()->create('/path/to/image.png');
16 | * ```
17 | *
18 | * @see https://developer.bigcommerce.com/api-reference/store-management/catalog/brand-images/createbrandimage
19 | * @see \BigCommerce\ApiV3\Api\Generic\CreateImage::create()
20 | *
21 | */
22 | class BrandImageApi extends ResourceImageApi
23 | {
24 | private const BRAND_IMAGE_ENDPOINT = 'catalog/brands/%d/image';
25 |
26 | protected function singleResourceEndpoint(): string
27 | {
28 | return self::BRAND_IMAGE_ENDPOINT;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResourceModels/Redirect/RedirectTo.php:
--------------------------------------------------------------------------------
1 | type = $type;
24 | $redirectTo->entity_id = $entityId;
25 | $redirectTo->url = $url;
26 |
27 | return $redirectTo;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResourceModels/Catalog/Category/CategoryTreeBranch.php:
--------------------------------------------------------------------------------
1 | children as $categoryData) {
24 | $this->children[] = $categoryData instanceof CategoryTreeBranch
25 | ? $categoryData : new CategoryTreeBranch($categoryData);
26 | }
27 |
28 | unset($optionObject->children);
29 | parent::__construct($optionObject);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/tests/BigCommerce/responses/sites__get_all.json:
--------------------------------------------------------------------------------
1 | {
2 | "data": [
3 | {
4 | "id": 0,
5 | "url": "http://kittens.mybigcommerce.com/",
6 | "channel_id": 0,
7 | "created_at": "2018-01-04T04:15:50.000Z",
8 | "updated_at": "2018-01-04T04:15:50.000Z",
9 | "ssl_status": "dedicated",
10 | "urls": [
11 | {
12 | "url": "string",
13 | "type": "primary",
14 | "created_at": "2018-01-04T04:15:50.000Z",
15 | "updated_at": "2018-01-04T04:15:50.000Z"
16 | }
17 | ],
18 | "is_checkout_url_customized": true
19 | }
20 | ],
21 | "meta": {
22 | "pagination": {
23 | "total": 3,
24 | "count": 1,
25 | "per_page": 1,
26 | "current_page": 2,
27 | "total_pages": 3,
28 | "links": {
29 | "previous": "?limit=1&page=1",
30 | "next": "?limit=1&page=3",
31 | "current": "?limit=1&page=2"
32 | }
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResourceModels/Catalog/Product/CustomField.php:
--------------------------------------------------------------------------------
1 | setName($name);
20 | $field->setValue($value);
21 |
22 | return $field;
23 | }
24 |
25 | public function setValue(string $value): void
26 | {
27 | $this->value = substr($value, 0, self::MAX_LENGTH_VALUE);
28 | }
29 |
30 | public function setName(string $name): void
31 | {
32 | $this->name = substr($name, 0, self::MAX_LENGTH_NAME);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/tests/BigCommerce/Api/Customers/CustomerSettingsApiTest.php:
--------------------------------------------------------------------------------
1 | setReturnData('customers__settings__get.json');
12 |
13 | $settings = $this->getApi()->customers()->settings()->get()->getCustomerSettings();
14 |
15 | $this->assertEquals('https://bigcommmerce.com/policy', $settings->privacy_settings->policy_url);
16 | }
17 |
18 | public function testCanGetCustomerSettingsPerChannel()
19 | {
20 | $this->setReturnData('customers__settings__by_channel.json');
21 | $settings = $this->getApi()->customers()->settings()->channel(1)->get()->getChannelSettings();
22 |
23 | $this->assertEquals('https://aligent.com.au/takeflight', $settings->privacy_settings->policy_url);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/BigCommerce/Api/Catalog/Categories/CategoryImageApi.php:
--------------------------------------------------------------------------------
1 | catalog()->category(1)->image()->create('/path/to/image.png');
16 | * ```
17 | *
18 | * @see https://developer.bigcommerce.com/api-reference/store-management/catalog/brand-images/createbrandimage
19 | * @see \BigCommerce\ApiV3\Api\Generic\CreateImage::create()
20 | *
21 | */
22 | class CategoryImageApi extends ResourceImageApi
23 | {
24 | public const CATEGORY_IMAGE_ENDPOINT = 'catalog/categories/%d/image';
25 |
26 | protected function singleResourceEndpoint(): string
27 | {
28 | return self::CATEGORY_IMAGE_ENDPOINT;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResourceModels/Page/Page.php:
--------------------------------------------------------------------------------
1 | getApi()->order($orderId);
15 | $this->assertInstanceOf(OrdersApi::class, $ordersApi);
16 | $this->assertEquals($orderId, $ordersApi->getResourceId());
17 | }
18 |
19 | public function testCanGetOrderTransactions()
20 | {
21 | $this->setReturnData('orders__transactions__get.json');
22 | $orderId = 121;
23 |
24 | $transactionsResponse = $this->getApi()->order($orderId)->transactions();
25 | $this->assertCount(1, $transactionsResponse->getTransactions());
26 | $this->assertEquals(1, $transactionsResponse->getPagination()->total);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResourceModels/Cart/Cart.php:
--------------------------------------------------------------------------------
1 | variants as $variant) {
28 | $this->variants[] = new ChannelListingVariant($variant);
29 | }
30 |
31 | unset($optionObject->variants);
32 | parent::__construct($optionObject);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResourceModels/Order/Transaction.php:
--------------------------------------------------------------------------------
1 | widget)) {
27 | $this->widget = new Widget($optionObject->widget);
28 | unset($optionObject->widget);
29 | }
30 | parent::__construct($optionObject);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/tests/BigCommerce/Api/Payments/PaymentsProcessingApiTest.php:
--------------------------------------------------------------------------------
1 | setReturnData('payments__create_payment_access_token.json', 201);
13 | $order = new Order(1, false);
14 |
15 | $token = $this->getApi()->payments()->createToken($order)->getToken();
16 | $this->assertEquals('abcdefg', $token->id);
17 | }
18 |
19 | public function testCanGetPaymentMethodsForOrder(): void
20 | {
21 | $this->setReturnData('payments__get_accepted_payment_methods.json');
22 | $methods = $this->getApi()->payments()->paymentMethods(123)->getMethods();
23 |
24 | $this->assertCount(1, $methods);
25 | $this->assertEquals('stripe.card', $methods[0]->id);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/BigCommerce/Api/Customers/CustomerConsentApi.php:
--------------------------------------------------------------------------------
1 | getResource());
20 | }
21 |
22 | public function update($consent): CustomerConsentResponse
23 | {
24 | return new CustomerConsentResponse($this->updateResource($consent));
25 | }
26 |
27 | public function singleResourceUrl(): string
28 | {
29 | return sprintf(self::CUSTOMER_CONSENT_ENDPOINT, $this->getResourceId());
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Category/CategoryTreeResponse.php:
--------------------------------------------------------------------------------
1 | getBody();
18 | $rawData = json_decode($body);
19 | $this->decodeResponseData($rawData);
20 | }
21 |
22 | private function decodeResponseData($rawData): void
23 | {
24 | $this->categoryTree = array_map(function (\stdClass $c) {
25 | return new CategoryTreeBranch($c);
26 | }, $rawData->data);
27 | }
28 |
29 | /**
30 | * @return CategoryTreeBranch[]
31 | */
32 | public function getTree(): array
33 | {
34 | return $this->categoryTree;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/tests/BigCommerce/responses/catalog__products__variants__384__get.json:
--------------------------------------------------------------------------------
1 | {
2 | "data": {
3 | "id": 384,
4 | "product_id": 192,
5 | "sku": "SMIT-2",
6 | "sku_id": 350,
7 | "price": null,
8 | "calculated_price": 25,
9 | "sale_price": null,
10 | "retail_price": null,
11 | "map_price": null,
12 | "weight": null,
13 | "calculated_weight": 1,
14 | "width": null,
15 | "height": null,
16 | "depth": null,
17 | "is_free_shipping": false,
18 | "fixed_cost_shipping_price": null,
19 | "purchasing_disabled": false,
20 | "purchasing_disabled_message": "",
21 | "image_url": "",
22 | "cost_price": null,
23 | "upc": "",
24 | "mpn": "",
25 | "gtin": "",
26 | "inventory_level": 0,
27 | "inventory_warning_level": 0,
28 | "bin_picking_number": "",
29 | "option_values": [
30 | {
31 | "id": 176,
32 | "label": "Black",
33 | "option_id": 220,
34 | "option_display_name": "Color"
35 | }
36 | ]
37 | },
38 | "meta": null
39 | }
--------------------------------------------------------------------------------
/src/BigCommerce/ResourceModels/Channel/ChannelTheme.php:
--------------------------------------------------------------------------------
1 | singleResourceEndpoint();
18 | }
19 |
20 | protected function resourceName(): string
21 | {
22 | return self::RESOURCE_NAME;
23 | }
24 |
25 | public function get(): SingleResourceResponse
26 | {
27 | throw new UnexpectedValueException('There is no endpoint for fetching an image');
28 | }
29 |
30 | public function getAll(array $filters = [], int $page = 1, int $limit = 250): PaginatedResponse
31 | {
32 | throw new UnexpectedValueException('There is no endpoint for fetching all images');
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/tests/BigCommerce/responses/channels__get_all.json:
--------------------------------------------------------------------------------
1 | {
2 | "data": [
3 | {
4 | "id": 1,
5 | "type": "storefront",
6 | "platform": "bigcommerce",
7 | "name": "myBC-store.com",
8 | "date_created": "2018-01-04T04:15:50.000Z",
9 | "date_modified": "2018-01-18T01:22:10.000Z",
10 | "external_id": "",
11 | "is_enabled": false
12 | },
13 | {
14 | "id": 2,
15 | "type": "storefront",
16 | "platform": "wordpress",
17 | "name": "mysite.com",
18 | "date_created": "2018-01-04T04:15:50.000Z",
19 | "date_modified": "2018-01-18T01:22:10.000Z",
20 | "external_id": "",
21 | "is_enabled": false
22 | },
23 | {
24 | "id": 3,
25 | "name": "Square",
26 | "platform": "square",
27 | "type": "pos",
28 | "date_created": "2019-03-19T16:05:37Z",
29 | "date_modified": "2019-03-19T16:05:37Z",
30 | "external_id": "",
31 | "is_enabled": true
32 | }
33 | ],
34 | "meta": {
35 | "pagination": {
36 | "total": 1
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/BigCommerce/Api/Generic/CreateImage.php:
--------------------------------------------------------------------------------
1 | getClient()->getRestClient()->post(
23 | $this->multipleResourceUrl(),
24 | [
25 | RequestOptions::MULTIPART => [
26 | ['name' => 'image_file', 'contents' => fopen($filename, 'r')]
27 | ]
28 | ]
29 | );
30 |
31 | return json_decode($response->getBody())->data->image_url;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResourceModels/Customer/CustomerChannelSettings.php:
--------------------------------------------------------------------------------
1 | buildPropertyObject('privacy_settings', PrivacySettings::class);
23 | $this->buildPropertyObject('customer_group_settings', CustomerGroupSettings::class);
24 |
25 | parent::beforeBuildObject();
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResourceModels/Catalog/Category/Category.php:
--------------------------------------------------------------------------------
1 | buildCustomUrl($optionObject);
32 | }
33 | parent::__construct($optionObject);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/BigCommerce/Api/Generic/V3ApiBase.php:
--------------------------------------------------------------------------------
1 | client = $client;
25 | $this->resourceId = $resourceId;
26 | $this->parentResourceId = $parentResourceId;
27 | }
28 |
29 | public function getParentResourceId(): ?int
30 | {
31 | return $this->parentResourceId;
32 | }
33 |
34 | public function getResourceId(): ?int
35 | {
36 | return $this->resourceId;
37 | }
38 |
39 | public function getClient(): Client
40 | {
41 | return $this->client;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/BigCommerce/Api/Customers/CustomerAddressesApi.php:
--------------------------------------------------------------------------------
1 | getAllResources($filters, $page, $limit));
22 | }
23 |
24 | public function create(array $resources): CustomerAddressesResponse
25 | {
26 | return new CustomerAddressesResponse($this->createResources($resources));
27 | }
28 |
29 | public function update(array $resources): CustomerAddressesResponse
30 | {
31 | return new CustomerAddressesResponse($this->updateResources($resources));
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResponseModels/Meta/Pagination.php:
--------------------------------------------------------------------------------
1 | getAllResources($filters, $page, $limit));
22 | }
23 |
24 | public function create(array $attributes): CustomerAttributesResponse
25 | {
26 | return new CustomerAttributesResponse($this->createResources($attributes));
27 | }
28 |
29 | public function update(array $attributes): CustomerAttributesResponse
30 | {
31 | return new CustomerAttributesResponse($this->updateResources($attributes));
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/tests/BigCommerce/Api/Widgets/WidgetTemplateApiTest.php:
--------------------------------------------------------------------------------
1 | setReturnData('content__widget_templates__get.json');
12 | $id = 'c48b131a-ae9d-4767-b5d6-63d9e43bcf75';
13 |
14 | $template = $this->getApi()->widgets()->template($id)->get()->getTemplate();
15 | $this->assertEquals('Header Images', $template->name);
16 | $this->assertEquals("content/widget-templates/$id", $this->getLastRequestPath());
17 | }
18 |
19 | public function testCanGetTemplates(): void
20 | {
21 | $this->setReturnData('content__widget_templates__get_all.json');
22 |
23 | $templates = $this->getApi()->widgets()->templates()->getAll()->getTemplates();
24 | $this->assertCount(12, $templates);
25 | $this->assertEquals('{{{html}}}', $templates[2]->template);
26 | $this->assertEquals("content/widget-templates", $this->getLastRequestPath());
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/tests/BigCommerce/responses/channel__42527118__listings__get.json:
--------------------------------------------------------------------------------
1 | {
2 | "data": [
3 | {
4 | "channel_id": 42527118,
5 | "listing_id": 58667643,
6 | "external_id": "EXT-1",
7 | "product_id": 76825686,
8 | "name": "Baseball bat",
9 | "description": "A steel baseball bat",
10 | "state": "active",
11 | "date_created": "2019-01-20T22:11:39.384Z",
12 | "date_modified": "2019-02-06T22:59:36.867Z",
13 | "variants": [
14 | {
15 | "channel_id": 42527118,
16 | "product_id": 76825686,
17 | "variant_id": 77,
18 | "external_id": "ext-1-var",
19 | "name": "Baseball Bat - short",
20 | "description": "A shorter baseball bat",
21 | "state": "deleted",
22 | "date_created": "2019-01-20T22:11:39.384Z",
23 | "date_modified": "2019-02-06T22:59:36.867Z"
24 | }
25 | ]
26 | }
27 | ],
28 | "meta": {
29 | "pagination": {
30 | "total": 1,
31 | "count": 1,
32 | "total_pages": 1,
33 | "links": {
34 | "current": "?page=1&limit=1000"
35 | }
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/BigCommerce/Api/Catalog/Products/ProductModifier/ProductModifierImagesApi.php:
--------------------------------------------------------------------------------
1 | productId = $productId;
16 | }
17 |
18 | public function getProductId(): int
19 | {
20 | return $this->productId;
21 | }
22 |
23 | protected function singleResourceEndpoint(): string
24 | {
25 | return self::PRODUCT_MODIFIER_IMAGE_ENDPOINT;
26 | }
27 |
28 | protected function singleResourceUrl(): string
29 | {
30 | return sprintf(
31 | $this->singleResourceEndpoint(),
32 | $this->getProductId(),
33 | $this->getParentResourceId() ?? $this->getResourceId(),
34 | $this->getResourceId()
35 | );
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResourceModels/Theme/ThemeJob.php:
--------------------------------------------------------------------------------
1 | result = new JobResult($optionObject->result);
32 | unset($optionObject->result);
33 | parent::__construct($optionObject);
34 | }
35 |
36 | public function getThemeId(): string
37 | {
38 | return $this->result->theme_id;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/.github/workflows/php.yml:
--------------------------------------------------------------------------------
1 | name: Validate PHP dependancies and test
2 |
3 | on:
4 | push:
5 | branches: [ main ]
6 | pull_request:
7 |
8 | jobs:
9 | build:
10 |
11 | runs-on: ubuntu-latest
12 |
13 | steps:
14 | - uses: actions/checkout@v2
15 |
16 | - name: Setup PHP
17 | uses: shivammathur/setup-php@v2
18 | with:
19 | php-version: '7.4'
20 |
21 | - name: Validate composer.json and composer.lock
22 | run: composer validate
23 |
24 | - name: Cache Composer packages
25 | id: composer-cache
26 | uses: actions/cache@v2
27 | with:
28 | path: vendor
29 | key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
30 | restore-keys: |
31 | ${{ runner.os }}-php-
32 |
33 | - name: Install dependencies
34 | if: steps.composer-cache.outputs.cache-hit != 'true'
35 | run: composer install --prefer-dist --no-progress --no-suggest
36 |
37 | - name: Run test suite
38 | run: composer run-script test
39 |
40 | - name: Run linter to check code style
41 | uses: chekalsky/phpcs-action@v1
42 | with:
43 | enable_warnings: true
44 |
--------------------------------------------------------------------------------
/src/BigCommerce/ResourceModels/Widget/Widget.php:
--------------------------------------------------------------------------------
1 | widget_template)) {
22 | $this->widget_template = new WidgetTemplate($optionObject->widget_template);
23 | unset($optionObject->widget_template);
24 | }
25 |
26 | if (isset($optionObject->widget_configuration)) {
27 | $this->widget_configuration = new WidgetConfiguration($optionObject->widget_configuration);
28 | unset($optionObject->widget_configuration);
29 | }
30 |
31 | parent::__construct($optionObject);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------