newsLetterConfig = $newsLetterConfig; $this->extractCustomerData = $extractCustomerData; $this->createCustomerAccount = $createCustomerAccount; } /** * @inheritdoc */ public function resolve( Field $field, $context, ResolveInfo $info, array $value = null, array $args = null ) { if (empty($args['input']) || !is_array($args['input'])) { throw new GraphQlInputException(__('"input" value should be specified')); } if (!$this->newsLetterConfig->isActive(ScopeInterface::SCOPE_STORE)) { $args['input']['is_subscribed'] = false; } if (isset($args['input']['date_of_birth'])) { $args['input']['dob'] = $args['input']['date_of_birth']; } $customer = $this->createCustomerAccount->execute( $args['input'], $context->getExtensionAttributes()->getStore() ); $data = $this->extractCustomerData->execute($customer); return ['customer' => $data]; } }