Giter Site home page Giter Site logo

getcandy / candy-api Goto Github PK

View Code? Open in Web Editor NEW
443.0 27.0 116.0 2.78 MB

GetCandy v1 E-Commerce API

Home Page: https://getcandy.io

License: Apache License 2.0

PHP 100.00%
api-rest laravel elasticsearch getcandy ecommerce-application ecommerce

candy-api's Introduction

GetCandy

A headless E-Commerce API built on top of Laravel.


Build amazing online stores with full control over functionality and user experience using headless e-commerce. The GetCandy E-Commerce API provides all the features you need to get a storefront up and running using your favourite technology.

๐Ÿ“– Documentation

For installation instructions and usage details, please take a look at the official guides.

๐Ÿ“„ License

GetCandy API is open-sourced software licensed under the Apache License 2.0

candy-api's People

Contributors

alecritson avatar brycelarge avatar glennjacobs avatar j-rods avatar jamiewarb avatar jbaron-mx avatar pietervanpeteghem avatar pjonckiere avatar repox avatar stevethitchman avatar vasiharan avatar youyi1314 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

candy-api's Issues

Fresh install Not Error

Moved from getcandy/candy-store#9 by @mysykez

Hello sir im Fresh install but
im getting error
screenshot from 2018-04-19 15-38-10
How to fix? thanks sir

Client error

Client error: POST http://localhost/oauth/token resulted in a 404 Not Found response: <title>404 Not Found</title>

Not Found (truncated...) (View: C:\Users\jorge\Desktop\Candy laravel\candy-store\resources\views_layouts\base.blade.php) (View: C:\Users\jorge\Desktop\Candy laravel\candy-store\resources\views_layouts\base.blade.php)

Aide pour la configuration

Salut j'ai vraiment besoin d'aide pour l'installation et la configuration. Comment faire pour voir la boutique.

Testing the client

I'm in the process of writing some preliminary tests for our store and need to mock the CandyClient's behaviour.

I've spotted the Client::fake() method... Can you provide some insight on how to write tests, with maybe an example or two? The more details you can give, the better!

getting a cURL error 6: Could not resolve host: candy-store.test (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) (View: /var/www/html/candy-store/resources/views/_layouts/base.blade.php) (View: /var/www/html/candy-store/resources/views/_layouts/base.blade.php)

Expected Behavior

I want to launch the quick start store doing php artisan serve but instead I get an error when I click the URL.

Current Behavior

Getting this error.

Possible Solution

No idea. I'm new to this.

Steps to Reproduce

  1. I followed the quickstart installation instruction wiki, set my .env file, etc
  2. I'm on a LAMP setup, no Homestead, no VM, 18,04 Ubuntu

Context (Environment)

Detailed Description

Possible Implementation

CantTabs event listener not working

CandyEvent.$emit('select-tab', 'product-details'); fires the event in the Vue console in chrome, but doesn't seem to get picked up by the listener.

API client not initiliazed?

Following the examples in the candy-store, I'm attempting to create a user using the API client. Using the new facade name (CandyClient) instead of the old one (GetCandyClient), the client is failing when trying to requestToken:

private function requestToken($params)
    {
        try {
            $response = $this->client->post('oauth/token', [    // <---- HERE
                'form_params' => array_merge(
                    [
                        'client_id' => $this->getClientId(),
                        'client_secret' => $this->getClientSecret()
                    ],
                    $params
                ),
                'verify' => config('services.ecommerce_api.verify'),
            ]);
        } catch (ClientException $e) {
            return new ApiResponse($e->getResponse());
        }
        return new ApiResponse($response);
    }

...complaining that $this->client isn't set. I saw an init() in the client's Candy class that created the client, but I can't see where this method is called in the store (or anywhere else).

Steps to Reproduce

  1. Create a controller/action
  2. Try calling CandyClient::Customers()->create($customer); (or anything else)

Candy hub pulling in app.js rather than hub.js

RE: Whirli (CC @Jamiewarb and @shaunrainer)

Expected Behavior

From looking at the code here https://github.com/getcandy/candy-hub/blob/dev/resources/views/partials/scripts.blade.php when I load the warehouse page it should load candy-hub/js/hub.js.

Current Behavior

It is trying to load candy-hub/js/app.js but getting a 404.

Possible Solution

Steps to Reproduce

  1. In the Whirli project, pull down development, composer install etc.
  2. php artisan vendor:publish --tag="public"
  3. php artisan candy:elastic:index
  4. Go to your local whirli environment /warehouse and see in the console the error:
    GET https://whirli.local/candy-hub/js/app.js net::ERR_ABORTED 404 (Not Found).

Context (Environment)

Logging into the candy hub warehouse to make progress on the Whirli site.

Media upload fails

  1. Uploading an image to media section of a product fails with 500 Internal Server Error for the request and malformed error message in UI.
  2. Uploading large files fails with no appropriate error message in UI and 422 Unprocessable Entity for request.

Expected Behavior

a) Image file must be uploaded and appears as an item in media section.
b) When uploading large files an error must indicate why file upload has failed

Current Behavior

a)
image

image

b)
image

image

Possible Solution

Not sure

Steps to Reproduce

  1. Follow instructions to install candy-store
  2. Log into hub
  3. Create a project
  4. Edit the project and go to Media tab
  5. a) Try to upload a jpg image from disk
  6. b) Try to upload a large jpg (6.2MB) file from disk

Context (Environment)

Since master branch is full of bugs and it is almost unusable, I used dev branches of api and hub in candy-store repo. I also had to do a few namespace modifications (mentioned here: #75 (comment)) to get it working.

Detailed Description

I suggest to merge dev into master branch more regularly to cover some serious bugs. master branch is 8 months outdated!!

Possible Implementation

Return value of Vinkla\Hashids\HashidsServiceProvider::registerFactory()

Moved from getcandy/candy-store#8 by @peaksolutions77

I am getting this error after successful installation.

local.ERROR: Type error: Return value of Vinkla\Hashids\HashidsServiceProvider::registerFactory() must be an instance of Vinkla\Hashids\void, none returned {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Type error: Return value of Vinkla\\Hashids\\HashidsServiceProvider::registerFactory() must be an instance of Vinkla\\Hashids\\void, none returned at /var/www/html/ecommerece/vendor/vinkla/hashids/src/HashidsServiceProvider.php:81)

Please help me out.

Error during install

OS: Linux centOS
PHP: 7.2
MySQL: 5.6

Error:
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'json null, `remember_token` varchar(100) null, `created_at` timestamp null, `upd' at line 1 (SQL: create table `user_details` (`id` int unsigned not null auto_increment primary key, `title` varchar(255) null, `firstname` varchar(255) null, `lastname` varchar(255) null, `contact_number` varchar(255) null, `vat_no` varchar(255) null, `company_name` varchar(255) null, `fields` json null, `remember_token` varchar(100) null, `created_at` timestamp null, `updated_at` timestamp null) default character set utf8 collate utf8_unicode_ci)

How to replicate
php artisan candy:install

Elasticsearch free version

Any plans or workaround on how to remove elasticsearch ?
what is the purpose of elasticsearch in Candy ?

Multiple dropColumns in one migration

I'm trying to write a couple of tests for some added functionality to the API and using SQLite for the tests, as CandyAPI seems to be. In the 2018_01_15_120102_add_fields_to_transactions migration there are multiple dropColumns in the same transaction - how did you get that to pass, with SQLite not supporting this behaviour?

Typo

Could it be that I'm the first to notice this?

$router->delete('products/{product}/categories/{category}', 'Products\Produ\ctCategoryController@destroy');

Error Undefind Value

Server error: POST http://.../api/oauth/token resulted in a 500 Internal Server Error response: <!-- ErrorException: Undefined variable: language (View: /home/.../public_html/resources/views/_i (truncated...) (View: /home/.../public_html/resources/views/_layouts/base.blade.php) (View: /home/.../public_html/resources/views/_layouts/base.blade.php)

401 Unauthorized

Expected Behavior

Api endpoint calls via hub interface should not return errors

Current Behavior

Getting '401 Unauthorized' when accessing api endpoint

Possible Solution

??

Steps to Reproduce

Did a fresh install from github

  1. git clone https://github.com/getcandy/candy-store.git
  2. composer install
  3. php artisan vendor:publish --provider="GetCandy\Api\Providers\ApiServiceProvider"
  4. php artisan vendor:publish --tag="public"
  5. Renamed the .env.example to .env and set database vars
  6. php artisan candy:install
  7. set .env CANDY_API vars
    CANDY_API_URL=http://candy-store.test
    CANDY_API_VERIFY=true
    CANDY_API_ID=1
    CANDY_API_SECRET=ekiUgjvrC4KuxrGfdZLo1WMr6R5Vz0cCCqpqLi6X

Context (Environment)

Trying to login to http://candy-store.test/hub and I'm successful except for all http://candy-store.test/api calls are being rejected with a 401 error and the interface features are not useable. Example of api calls generating 401 errors from browser console

http://candy-store.test/api/v1/channels
http://candy-store.test/api/v1/taxes
http://candy-store.test/api/v1/languages

Missing rollbacks in migrations

Hi guys,

There are a few migration rollbacks missing from the most recent migration files.

I've added these in the following PR #85

Cheers!

Undefined variable: loader when running PHPUnit

When running PHPUnit I get the error:

Undefined variable: loader

/home/vagrant/Code/candy/bootstrap/app.php:44
/home/vagrant/Code/candy/tests/CreatesApplication.php:16
/home/vagrant/Code/candy/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:89
/home/vagrant/Code/candy/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:66

Which I assume is to do with this $app->instance('composer_loader', $loader);.

If I remove it then I get ReflectionException: Class composer_loader does not exist

No validation on variant options atm

The way that Laravel validates arrays has made it a bit awkward.
I know if solved a similar problem like this before, think my minds just a bit melted so will check back in the morning!

Is using ElasticSearch a wise decision?

Hi,

I am not familiar with Elasticsearch so pardon me if I am misunderstanding something. Seems that search function is bound to Elasticsearch. Since not all installation will run on a dedicated server and not all hosting providers support Elasticsearch is it OK to limit search function to a third party like Elasticsearch? I think some internal indexing might be a better choice.

Regards

cURL error 60: SSL certificate problem: unable to get local issuer certificate

Expected Behavior

Current Behavior

cURL error 60: SSL certificate problem: unable to get local issuer certificate

Possible Solution

Steps to Reproduce

  1. I'd downloaded file cacert.pem into c:/openserver/modules/php/PHP-7.1/extras/ssl

  2. My php.ini:

[curl]
curl.cainfo = "c:/openserver/modules/php/PHP-7.1/extras/ssl/cacert.pem"

  1. Then I restarted Open Server

Context (Environment)

Detailed Description

Possible Implementation

Incorrect 'hashids.php' file being loaded

โžœ  candy tinker
Psy Shell v0.8.18 (PHP 7.1.13 โ€” cli) by Justin Hileman
>>> config('hashids.connections')
=> [
     "main" => [
       "salt" => "your-salt-string",
       "length" => "your-length-integer",
     ],
     "alternative" => [
       "salt" => "your-salt-string",
       "length" => "your-length-integer",
     ],
   ]

This comes from the vendor/vinkla/hashids/config/hashids.php file, instead of the candy-api one. This results in errors on multiple api calls on every Hub page:

{
    "message": "Connection [channel] not configured.",
    "exception": "InvalidArgumentException",
    "file": "/Users/askirius/Sites/candy/vendor/graham-campbell/manager/src/AbstractManager.php",
    "line": 164,
    "trace": [
        {
            "file": "/Users/askirius/Sites/candy/vendor/graham-campbell/manager/src/AbstractManager.php",
            "line": 126,
            "function": "getConnectionConfig",
            "class": "GrahamCampbell\\Manager\\AbstractManager",
            "type": "->"
        },
        {
            "file": "/Users/askirius/Sites/candy/vendor/graham-campbell/manager/src/AbstractManager.php",
            "line": 72,
            "function": "makeConnection",
            "class": "GrahamCampbell\\Manager\\AbstractManager",
            "type": "->"
        },
        {
            "file": "/Users/askirius/Sites/candy/vendor/getcandy/candy-api/src/Api/Traits/Hashids.php",
            "line": 25,
            "function": "connection",
            "class": "GrahamCampbell\\Manager\\AbstractManager",
            "type": "->"
        },

...

GetCandy's hashids.php should be loaded instead.

count(null) throws error on php >=7.2

On fresh candy-store install on php 7.2.1:

Visiting:
https://getcandy.local/hub/catalogue-manager/products

(no products set-up in store)

get a loading icon instead of No Products Found

This is because a call to the api at:
https://getcandy.local/api/v1/products?type=product&per_page=25&current_page=1&includes=channels,customer_groups,family,attribute_groups

sends back a response of:
message: "count(): Parameter must be an array or an object that implements Countable"

because:-

if (count($ids)) { }

[ie. count(null)] throws an error on php >=7.2 in the following classes:

/src/API/Products/Services/ProductService.php
/src/API/User/Services/UserService.php

Use instead:
if (!empty($ids)) { }

further:
yiisoft/yii#4167

let me know if you want a pull request for this.

great job!

As a beginner, I wonder if i should make "composer require ..." command on a new directory or a laravel project?
Thx!
And it would be very nice if you could provide more detail document or some guide for a new beginner.

Migration Error

Ported from getcandy/candy-store#2 by @xJoeyv

   Illuminate\Database\QueryException  : SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in yo
ur SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'json n
ull, `remember_token` varchar(100) null, `created_at` timestamp null, `upd' at line 1 (SQL: create table `user_details`
(`id` int unsigned not null auto_increment primary key, `title` varchar(255) null, `firstname` varchar(255) null, `lastn
ame` varchar(255) null, `contact_number` varchar(255) null, `vat_no` varchar(255) null, `company_name` varchar(255) null
, `fields` json null, `remember_token` varchar(100) null, `created_at` timestamp null, `updated_at` timestamp null) defa
ult character set utf8mb4 collate utf8mb4_unicode_ci)

  at D:\xampp\htdocs\Candy\vendor\laravel\framework\src\Illuminate\Database\Connection.php: 664
    660|         // If an exception occurs when attempting to run a query, we'll format the error
    661|         // message to include the bindings with SQL, which will make this exception a
    662|         // lot more helpful to the developer instead of just the database's errors.
    663|         catch (Exception $e) {
  > 664|             throw new QueryException(
    665|                 $query, $this->prepareBindings($bindings), $e
    666|             );
    667|         }
    668|

  Exception trace:

  1   PDOException::("SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; chec
k the manual that corresponds to your MariaDB server version for the right syntax to use near 'json null, `remember_toke
n` varchar(100) null, `created_at` timestamp null, `upd' at line 1")
      D:\xampp\htdocs\Candy\vendor\laravel\framework\src\Illuminate\Database\Connection.php : 452

  2   PDO::prepare("create table `user_details` (`id` int unsigned not null auto_increment primary key, `title` varchar(
255) null, `firstname` varchar(255) null, `lastname` varchar(255) null, `contact_number` varchar(255) null, `vat_no` var
char(255) null, `company_name` varchar(255) null, `fields` json null, `remember_token` varchar(100) null, `created_at` t
imestamp null, `updated_at` timestamp null) default character set utf8mb4 collate utf8mb4_unicode_ci")
      D:\xampp\htdocs\Candy\vendor\laravel\framework\src\Illuminate\Database\Connection.php : 452

  Please use the argument -v to see more details.

This is the issue that came up upon starting the installation. I'm looking into this asap aswell. Unless you got a quick fix.

BasketController@update route, method non-existant

Afternoon guys ๐Ÿ‘‹

So, the route api/v1/baskets/saved/{basket} api/v1/baskets/{basket} (EDIT) is defined in routes/api.client.php, at line 45, the method it calls (BasketController@update) has no implementation. Is it possible it is missing, or that it shouldn't have been defined in the first place?

It seems @store is doing the PUT behaviour instead, but by passing the ID in the request under the key basket_id.

Just wanted to check this is intentional, and not accidentally missed?

Context (Environment)

I'm looking to create and then update a basket, and wasn't clear the routine based on these methods.

Currently I seem to have to do the following:

// Create an empty basket for a user
CandyClient::Basket()->Update([
    'user' => 'l8mabw7w',
]);

// Create a basket for a user with products in it
CandyClient::Basket()->Update([
    'user' => 'l8mabw7w',
    'variants' => [
        [
            'id' => 'lmawh7sd',
            'quantity' => 1,
        ],
    ],
]);

// Update an existing basket to set different products
CandyClient::Basket()->Update([
    'basket_id' => '24lpwzf2',
    'variants' => [
        [
            'id' => '7ujjyans',
            'quantity' => 2,
        ],
    ],
]);

Does this seem correct? The above all uses the @store method on BasketController, rather than the last one using @update, which I would have expected it to use.

Cheers!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.