Skip to content

Commit

Permalink
Shopify setup validation
Browse files Browse the repository at this point in the history
  • Loading branch information
arfenis committed Aug 2, 2024
1 parent 2551d4b commit 514ce1d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
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

0 comments on commit 514ce1d

Please sign in to comment.