Create a customer

@link   https://help.shopify.com/api/reference/customer#create
@param  Customer $customer
@return void
436691
public function create(Customer &$customer)
    {
        $data = $customer->exportData();
        $endpoint = '/admin/customers.json';
        $response = $this->request(
            $endpoint, "POST", array(
            'customer' => $data
            )
        );
        $customer->setData($response['customer']);
    }
136876
public function newAction()
        {

            $oCustomer = new Customer();
            $form      = $this->createCreateForm($oCustomer);

            return $this->render('SlashworksAppBundle:Customer:new.html.twig', array(
                'entity' => $oCustomer,
                'form'   => $form->createView(),
            ));
        }
371777
public function setCustomer($customer)
    {
        $this->data->customer = new stdClass;
        $this->data->customer = $customer;

        return $this;
    }
228976
public function create()
    {
        if (!userHasPermission('admin:invoice:customer:create')) {
            unauthorised();
        }

        $oInput = Factory::service('Input');
        if ($oInput->post()) {

            try {

                $this->formValidation();
                $oCustomerModel = Factory::model('Customer', 'nails/module-invoice');
                if (!$oCustomerModel->create($this->prepPostData())) {
                    throw new NailsException('Failed to create item. ' . $oCustomerModel->lastError(), 1);
                }

                $oSession = Factory::service('Session', 'nails/module-auth');
                $oSession->setFlashData('success', 'Item created successfully.');
                redirect('admin/invoice/customer');

            } catch (\Exception $e) {
                $this->data['error'] = $e->getMessage();
            }
        }

        $this->data['page']->title = 'Create customer';
        Helper::loadView('edit');
    }
493010
public function createCustomer($type, $customerId ,$payment = [], $additional = [])
    {
        $request = new CreateCustomer($this->config->getMerchantId());

        $request->setPType($type);
        $request->setPaymentData($payment);
        $request->setCustomerId($customerId);
        $request->setAdditional($additional);

        $this->request = $request->getXml();

        $this->send();

        $result = new CreateCustomerResponse($this->response);

        return $result;
    }
371740
public function create($customer_id)
    {
        return $this->createResource(sprintf('%s/%s', MoipResource::VERSION, sprintf(self::PATH_POST, $customer_id)));
    }
335936
public function createCustomer()
    {
        $data = [
            "email" => request()->email,
            "first_name" => request()->fname,
            "last_name" => request()->lname,
            "phone" => request()->phone,
            "metadata" => request()->additional_info /* key => value pairs array */

        ];

        $this->setRequestOptions();
        return $this->setHttpResponse('/customer', 'POST', $data)->getResponse();
    }
1040198
public function createFor(Customer $customer, array $options = [], array $filters = [])
    {
        $this->parentId = $customer->id;

        return parent::rest_create($options, $filters);
    }
370221
public function setContactData($customer)
    {
        $this->model = $customer;
        $this->setReviewCollection();
        parent::setContactData($customer);

        return $this;
    }
122661
private function handleProviderQuirks($provider, $customer)
    {
        switch ($provider) {
            case 'Twitter':
                if ($customer->getData('lastname') === '-') {
                    $nameParts = explode(' ', $customer->getData('firstname'));
                    if (count($nameParts) > 1) {
                        $customer->setData('firstname', $nameParts[0]);
                        $lastName = implode(' ', array_slice($nameParts, 1));
                        $customer->setData('lastname', $lastName);
                    }
                }
                break;
        }
    }
1126459
public function execute(Observer $observer)
    {
        /** @var Customer $customer */
        $customer = $observer->getEvent()->getCustomer();

        try {
            $this->customerEventHandler->store(
                $customer->getId(),
                $customer->getWebsiteId(),
                $customer->getStoreId()
            );
        } catch (\Exception $e) {
            $this->logger->warning('Emartech\\Emarsys\\Observers\\CustomerAccountObserver: ' . $e->getMessage());
        }
    }
1274567
public function destroy(Customer $customer)
    {
        try {
            $name = $customer->getName();
            $customer->delete();

            flash()->info(__('Customer :name has been deleted', ['name' => $name]));
        } catch (\Exception $e) {
            flash()->error(__('Error: :msg', ['msg' => $e->getMessage()]));
        }

        return redirect(route('appshell.customer.index'));
    }
782944
public function customerCreate($data) {

		// for API compatibility with version 1.x of this component
		if (isset($data['stripeToken'])) {
			$data['card'] = $data['stripeToken'];
			unset($data['stripeToken']);
		}

		Stripe::setApiKey($this->key);
		$error = null;

		try {
			$customer = Stripe_Customer::create($data);

		} catch(Stripe_CardError $e) {
			$body = $e->getJsonBody();
			$err = $body['error'];
			CakeLog::error(
				'Customer::Stripe_CardError: ' . $err['type'] . ': ' . $err['code'] . ': ' . $err['message'],
				'stripe'
			);
			$error = $err['message'];

		} catch (Stripe_InvalidRequestError $e) {
			$body = $e->getJsonBody();
			$err = $body['error'];
			CakeLog::error(
				'Customer::Stripe_InvalidRequestError: ' . $err['type'] . ': ' . $err['message'],
				'stripe'
			);
			$error = $err['message'];

		} catch (Stripe_AuthenticationError $e) {
			CakeLog::error('Customer::Stripe_AuthenticationError: API key rejected!', 'stripe');
			$error = 'Payment processor API key error.';

		} catch (Stripe_ApiConnectionError $e) {
			CakeLog::error('Customer::Stripe_ApiConnectionError: Stripe could not be reached.', 'stripe');
			$error = 'Network communication with payment processor failed, try again later';

		} catch (Stripe_Error $e) {
			CakeLog::error('Customer::Stripe_Error: Stripe could be down.', 'stripe');
			$error = 'Payment processor error, try again later.';

		} catch (Exception $e) {
			CakeLog::error('Customer::Exception: Unknown error.', 'stripe');
			$error = 'There was an error, try again later.';
		}

		if ($error !== null) {
			// an error is always a string
			return (string)$error;
		}

		CakeLog::info('Customer: customer id ' . $customer->id, 'stripe');

		return $this->_formatResult($customer);
	}
278876
public function createFor(Customer $customer, array $options = [], array $filters = [])
    {
        return $this->createForId($customer->id, $options, $filters);
    }
793539
public Customer createCustomer(Customer customer) {
        if(getCustomer(customer.getEmail()) != null){
            return customerRepository.save(customer);
        }
        return null;
    }
1131029
def create_customer(name, email, phone):
    
    Party = client.model('party.party')
    ContactMechanism = client.model('party.contact_mechanism')

    party, = Party.create([{'name': name}])

    # Bulk create the email and phone
    ContactMechanism.create([
        {'type': 'email', 'value': email, 'party': party},
        {'type': 'phone', 'value': phone, 'party': party},
    ])

    return party
394172
public function add(HpsPayPlanCustomer $customer)
    {
        $data = $customer->getEditableFieldsWithValues();
        $result = $this->doRequest($data, array(
            'verb'     => 'POST',
            'endpoint' => 'customers',
        ));
        return $this->hydrateObject($result, 'HpsPayPlanCustomer');
    }