diff --git a/Model/Resolver/BecomeSeller.php b/Model/Resolver/BecomeSeller.php index 868bd4d..ffe1341 100644 --- a/Model/Resolver/BecomeSeller.php +++ b/Model/Resolver/BecomeSeller.php @@ -110,7 +110,17 @@ public function resolve( ->setUrl($args['url_key']) ->setCustomerId($args['customer_id']); - return $this->_createSeller->createSeller($sellerInterface, $args['customer_id']); + $data = $this->_createSeller->createSeller($sellerInterface, $args['customer_id']); + $code = 0; + $message = "We can not create seller account at now"; + if ($data && $data->getSellerId()) { + $code = $data->getSellerId(); + $message = "Your seller account was created successfully. We will connect with you soon."; + } + return [ + "code" => $code, + "message" => $message + ]; } diff --git a/Model/Resolver/CreateSeller.php b/Model/Resolver/CreateSeller.php index dfe75d2..cbb00ba 100644 --- a/Model/Resolver/CreateSeller.php +++ b/Model/Resolver/CreateSeller.php @@ -143,6 +143,16 @@ public function resolve( ->setEmail($customer['email']) ->setAddresses($addressArr); - return $this->_createSeller->registerSeller($customerInterface, $data, $password); + $data = $this->_createSeller->registerSeller($customerInterface, $data, $password); + $code = 0; + $message = "We can not register seller account at now"; + if ($data && $data->getSellerId()) { + $code = $data->getSellerId(); + $message = "Your seller account was registered successfully. We will connect with you soon."; + } + return [ + "code" => $code, + "message" => $message + ]; } } diff --git a/Model/Resolver/Customer/SendMessage.php b/Model/Resolver/Customer/SendMessage.php index 6ff8cfa..d29cce1 100644 --- a/Model/Resolver/Customer/SendMessage.php +++ b/Model/Resolver/Customer/SendMessage.php @@ -58,6 +58,7 @@ public function resolve( array $value = null, array $args = null ) { + if (!$context->getExtensionAttributes()->getIsCustomer()) { throw new GraphQlAuthorizationException(__('The current customer isn\'t authorized.')); } diff --git a/Model/Resolver/DataProvider/CreateSeller.php b/Model/Resolver/DataProvider/CreateSeller.php index 73bbdf1..714af90 100755 --- a/Model/Resolver/DataProvider/CreateSeller.php +++ b/Model/Resolver/DataProvider/CreateSeller.php @@ -65,7 +65,7 @@ public function createSeller($data, $customerId) * @param CustomerInterface $customer * @param $data * @param $password - * @return CustomerInterface + * @return \Lof\MarketPlace\Api\Data\SellerInterface|array|mixed|string|null * @throws InputException * @throws LocalizedException * @throws InputMismatchException diff --git a/Model/Resolver/ReviewSeller.php b/Model/Resolver/ReviewSeller.php index 8efe863..8bb0a97 100644 --- a/Model/Resolver/ReviewSeller.php +++ b/Model/Resolver/ReviewSeller.php @@ -45,12 +45,14 @@ class ReviewSeller implements ResolverInterface * @var SellerInterface */ private $sellerInterface; + /** * @var RatingFactory */ private $_rateSeller; + /** - * @var SellersRepositoryInterface + * @var SellersFrontendRepositoryInterface */ private $sellerRepository; /** @@ -98,7 +100,7 @@ public function resolve( throw new GraphQlInputException(__('"input" value should be specified')); } $args = $args['input']; - $seller = $this->sellerRepository->getById($args['seller_id']); + $seller = $this->sellerRepository->get((int)$args['seller_id']); if (!isset($seller['seller_id']) || !$seller['seller_id']) { return [ "code" => 1, diff --git a/README.md b/README.md index 5652909..31ea656 100755 --- a/README.md +++ b/README.md @@ -557,8 +557,7 @@ mutation { content : String! } ) { - code - message + message_id } } ``` @@ -573,8 +572,7 @@ mutation { content : String! } ) { - code - message + created_at } } ``` diff --git a/etc/schema.graphqls b/etc/schema.graphqls index f3adb75..19649fc 100755 --- a/etc/schema.graphqls +++ b/etc/schema.graphqls @@ -121,9 +121,9 @@ type Mutation { reviewSeller(input: ReviewInput!): MarketplaceOuput @resolver(class: "\\Lof\\MarketplaceGraphQl\\Model\\Resolver\\ReviewSeller") @doc(description: "Review Seller") - customerSendMessage(input: CustomerMessageInput!): MarketplaceOuput @resolver(class:"\\Lof\\MarketplaceGraphQl\\Model\\Resolver\\Customer\\SendMessage") @doc(description: "Customer send message to seller") + customerSendMessage(input: CustomerMessageInput!): SellerMessage @resolver(class:"\\Lof\\MarketplaceGraphQl\\Model\\Resolver\\Customer\\SendMessage") @doc(description: "Customer send message to seller") - customerReplyMessage(input: ReplyMessageInput!): MarketplaceOuput @resolver(class:"\\Lof\\MarketplaceGraphQl\\Model\\Resolver\\Customer\\ReplyMessage") @doc(description: "Customer reply Messaage") + customerReplyMessage(input: ReplyMessageInput!): SellerMessageDetail @resolver(class:"\\Lof\\MarketplaceGraphQl\\Model\\Resolver\\Customer\\ReplyMessage") @doc(description: "Customer reply Messaage") }