Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Shopify setup validation #1776

Merged
merged 2 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions app/GraphQL/Connector/Shopify/Mutations/ShopifyMutation.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@

use Kanvas\Apps\Models\Apps;
use Kanvas\Companies\Models\Companies;
use Kanvas\Connectors\Shopify\Client;
use Kanvas\Connectors\Shopify\DataTransferObject\Shopify as ShopifyDto;
use Kanvas\Connectors\Shopify\ShopifyService;
use Kanvas\Users\Repositories\UsersRepository;

class ShopifyMutation
{
public function shopifySetup(mixed $root, array $request): bool
public function shopifySetup(mixed $root, array $request): String
{
$user = auth()->user();
$company = isset($request['company_id']) ? Companies::getById($request['company_id']) : $user->getCurrentCompany();
Expand All @@ -22,6 +23,9 @@ public function shopifySetup(mixed $root, array $request): bool

$shopifyDto = ShopifyDto::viaRequest($request['input'], $app, $company);

return ShopifyService::shopifySetup($shopifyDto);
Client::getInstance($app, $company, $shopifyDto->region)->Shop->get();
ShopifyService::shopifySetup($shopifyDto);

return "Shopify Integration Successfully";
}
}
2 changes: 1 addition & 1 deletion graphql/schemas/Connector/shopify.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ input ShopifySetupInput {
}

extend type Mutation @guard {
shopifySetup(input: ShopifySetupInput!): Boolean
shopifySetup(input: ShopifySetupInput!): String
@field(
resolver: "App\\GraphQL\\Connector\\Shopify\\Mutations\\ShopifyMutation@shopifySetup"
)
Expand Down
Loading