Create a card instance.

        :param customer: the customer id or object
        :type customer: string|Customer
        :param data: data required to create the card

        :return: The card resource
        :rtype resources.Card
492859
def create(customer, **data):
        
        if isinstance(customer, resources.Customer):
            customer = customer.id

        http_client = HttpClient()
        response, _ = http_client.post(routes.url(routes.CARD_RESOURCE, customer_id=customer), data)
        return resources.Card(**response)
812181
public function addCard($customer, $token)
    {
        $params = [
            'token' => $token,
        ];

        return $this->gateway->commit(
                'post',
                $this->gateway->buildUrlFromString('customer/'.$customer.'/cards'),
                $params
            );
    }
313748
def create_card
      raise StandardError, 'Cliente null' if @client.nil?
      # la instancia de card recibe como parametro el @client al que se le va asociar la tarjeta
      card = PayuLatam::Card.new(@client)
      # hay un metodo card_params que genera el objeto a enviar con los datos correctos
      # se asignan los params correctos para la peticion
      card.params.merge! card_params

      # intento de creacion de tarjeta
      card.create!
      # si todo bien
      if card.success?
        # se llena la variable @card con la instancia de la clase PayuLatam::Card
        @card = card

        # no me acuerdo XD
        @client.remove_cards
        
        # se agrega la tarjeta al array de tarjetas del usuario. Ojo este array esta en memoria no necesariamente
        # es el mismo array de payu
        @client.add_card( card.response )

        # la respuesta de creacion de payu solo incluye el token de la tarjeta, entonces
        # volvemos a consultar la info almacenada en payu para recibier un poco mas de detalle y almacenarlo
        _card = card.load(card.response['token'])
        # se crea un registro de payu_card con la info publica de la tarjeta y el token de payu de la tarjeta
        @current_user.payu_cards.create(token: @card.response['token'], last_4: _card['number'], brand: _card['type'])
      else
        raise StandardError, "Error generando token de tarjeta: #{card.error}"
      end
    end
1175460
def all(self, customer_id, data={}, **kwargs):
        "
        url = "{}/{}/tokens".format(self.base_url, customer_id)
        return self.get_url(url, data, **kwargs)
530714
def create_address(customer_id, data):
    
    Address = client.model('party.address')
    Country = client.model('country.country')
    Subdivision = client.model('country.subdivision')

    country, = Country.find([('code', '=', data['country'])])
    state, = Subdivision.find([
        ('code', 'ilike', '%-' + data['state']),  # state codes are US-CA, IN-KL
        ('country', '=', country['id'])
    ])

    address, = Address.create([{
        'party': customer_id,
        'name': data['name'],
        'street': data['street'],
        'street_bis': data['street_bis'],
        'city': data['city'],
        'zip': data['zip'],
        'country': country['id'],
        'subdivision': state['id'],
    }])
    return address['id']
1019379
def get(self, request, **kwargs):
		
		customer, _created = Customer.get_or_create(
			subscriber=subscriber_request_callback(self.request)
		)

		serializer = SubscriptionSerializer(customer.subscription)
		return Response(serializer.data)
91531
final protected function cards() {
		$r = []; /** @var array(string => string) $r */
		$m = $this->m(); /** @var Method $m */
		/**
		 * 2017-07-28
		 * The `$m instanceof Method` check is for the «Square» module:
		 * its server part does not use the Df_StripeClone module, but the client part does use it.
		 * So we need this the `$m instanceof Method` check to evade the error:
		 * «Cannot instantiate abstract class Df\StripeClone\Facade\Customer
		 * in mage2pro/core/Payment/Facade.php:88»: https://github.com/mage2pro/square/issues/2
		 * 
		 * 2018-11-13
		 * Currently, in all modules except one (TBCBank) $customerData is just a customer identifier (a string).
		 * But out framework supports $customerData of artibutrary structure, and the TBCBank module uses it:
		 * $data has the following structure there:
		 *	{
		 *		"4349958401": {
		 *			"CARD_NUMBER": "5***********1223",
		 *			"RECC_PMNT_EXPIRY": "1019"
		 *		},
		 *		"1779958449": {
		 *			"CARD_NUMBER": "4***********3333",
		 *			"RECC_PMNT_EXPIRY": "1120"
		 *		}
		 *	}
		 * The top-level keys are bank card tokens there, 
		 * and their values form the corresponding bank card labels.
		 * So the TBCBank module (unlike the rest modules) does not do any API requests
		 * to retrieve a customer's saved cards.
		 */
		/** @var string|null|array(string => mixed) $customerData */
		if ($m instanceof Method && ($customerData = df_ci_get($this->m()))) {
			$this->s()->init();
			$fc = FCustomer::s($m); /** @var FCustomer $fc */
			// 2018-11-14 $customer is an array for TBCBank: it is the same as $customerData (see above).
			if (!($customer = $fc->get($customerData))/** @var object|array(string => mixed) $customer */) {
				// 2017-02-24
				// We could be here, for example, if the store's administrator has changed
				// his Stripe account in the module's settings: https://mage2.pro/t/3337
				df_ci_save($this->m(), null);
			}
			else {
				$r = array_map(function(Card $c) use($m) {
					/**
					 * 2017-07-24
					 * Unfortunately, the one-liner fails on PHP 5.6.30:
					 * return ['id' => $c->id(), 'label' => (CF::s($m, $c))->label()];
					 * «syntax error, unexpected '->' (T_OBJECT_OPERATOR), expecting ']'»
					 * https://github.com/mage2pro/core/issues/16
					 * See also: https://github.com/mage2pro/core/issues/15
					 *
					 * 2017-07-31
					 * Interestingly, the following code works on all PHP versions >= 5.4.0:
					 * class A {function f() {return __METHOD__;}
					 * echo (new A)->f();
					 * https://3v4l.org/nANqg
					 *
					 * The following code works on all PHP versions >= 5.0.0:
					 *	class A {
					 *		function f() {return __METHOD__;}
					 *		static function s() {return new self;}
					 *	}
					 *	echo A::s()->f();
					 * https://3v4l.org/1qr48
					 *
					 * The same is true for the following code:
					 *	class A {
					 *		function f() {return $this->_v;}
					 *		final protected function __construct($v) {$this->_v = $v;}
					 *		private $_v;
					 *		final static function s($v) {return new self($v);}
					 *	}
					 *	echo A::s('test')->f();
					 * https://3v4l.org/2E8H6
					 *
					 * So, I was unable to reproduce the issue...
					 * Maybe the problem customer uses a non-standard (patched) PHP version?
					 *
					 * 2017-11-08
					 * Note 1.
					 * One-liners like (!($e = $a->e())->b()) are really not supported by PHP < 7:
					 * https://3v4l.org/lJjvS
					 * Note 2.
					 * At the same time, some `))->` one-liners are supported by PHP >= 5.4, e.g:
					 * static function p() {return (new self())->b();}
					 * https://3v4l.org/LJlDE
					 * Note 3.
					 * If we add extra brackets to the code from the Note 2,
					 * then the code will be incompatible with PHP < 7:
					 * static function p() {return ((new self()))->b();}
					 */
					$cf = CF::s($m, $c); /** @var CF $cf */
					return ['id' => $c->id(), 'label' => $cf->label()];
				}, $fc->cardsActive($customer));
			}
		}
		// 2018-11-14
		// It is important, because otherwise this.cards.length will return `undefined` on frontend:
		// https://github.com/mage2pro/core/blob/3.11.1/Payment/view/frontend/web/card.js#L207
		return array_values($r);
	}
1203761
def delete_customer(self, customer_id):
        
        return self.client._delete(self.url + 'customers/{}'.format(customer_id), headers=self.get_headers())
704479
def create_customer(self, full_name, email):
        
        log.warning('Creating customer...')
        data = {'fullName': full_name, 'email': email}

        return self.post('rest/servicedeskapi/customer', headers=self.experimental_headers, data=data)
164381
def query_customer(token_customer_id)
      @logger.debug('Query customer with id:' + token_customer_id.to_s) if @logger
      unless @is_valid
        return make_response_with_exception(Exceptions::APIKeyInvalidException.new('API key, password or Rapid endpoint missing or invalid'), QueryCustomerResponse)
      end
      begin
        url = @web_url + Constants::DIRECT_CUSTOMER_SEARCH_METHOD + Constants::JSON_SUFFIX
        url = URI.encode(url)

        request = Message::CustomerProcess::QueryCustomerMsgProcess.create_request(token_customer_id.to_s)
        response = Message::CustomerProcess::QueryCustomerMsgProcess.send_request(url, @api_key, @password, @version, request)
        Message::CustomerProcess::QueryCustomerMsgProcess.make_result(response)
      rescue => e
        @logger.error(e.to_s) if @logger
        make_response_with_exception(e, QueryCustomerResponse)
      end
    end
1202723
public function saveCustomer(Customer $customer): bool
    {
        if ($customer->id) {
            $record = CustomerRecord::findOne($customer->id);

            if (!$record) {
                throw new Exception(Craft::t('commerce-stripe', 'No customer exists with the ID “{id}”',
                    ['id' => $customer->id]));
            }
        } else {
            $record = new CustomerRecord();
        }

        $record->userId = $customer->userId;
        $record->gatewayId = $customer->gatewayId;
        $record->reference = $customer->reference;
        $record->response = $customer->response;

        $customer->validate();

        if (!$customer->hasErrors()) {
            // Save it!
            $record->save(false);

            // Now that we have a record ID, save it on the model
            $customer->id = $record->id;

            return true;
        }

        return false;
    }
815591
def create(self, card_data):
        
        result = self._post(
            'card/create',
            data=card_data,
            result_processor=lambda x: x['card_id']
        )
        return result
1182465
def create_customer(self, email, displayName):
        
        url = self._options['server'] + '/rest/servicedeskapi/customer'
        headers = {'X-ExperimentalApi': 'opt-in'}
        r = self._session.post(url, headers=headers, data=json.dumps({
            'email': email,
            'displayName': displayName
        }))

        raw_customer_json = json_loads(r)

        if r.status_code != 201:
            raise JIRAError(r.status_code, request=r)
        return Customer(self._options, self._session, raw=raw_customer_json)
173645
def create_qrcode(self, qrcode_data):
        
        result = self._post(
            'card/qrcode/create',
            data=qrcode_data,
            result_processor=lambda x: x['ticket']
        )
        return result
1068527
def credit_card 
      @customer = Customer.find           params[:id]
      @customer.update_credit_card        Card.new params[:credit_card]

      respond_to do |format|
        format.html { redirect_to @customer, 
                      notice: "This customer's card was successfully updated." } 
        format.json { head :ok }
      end 
    end
980099
public function create()
    {
        $instance = self::createPaymentCard($this);
        $this->setId($instance->getId());
        return $instance;
    }
699353
def create_customer(self, name, gender, address, phone, email, vat=None, fax=None,
                        company_name=None, additional_data=None, extension_additional_data=None):
        """"""

        response = self.request(E.createCustomerRequest(
            E.companyName(company_name),
            E.vat(vat),
            E.name(
                E.initials(name.initials),
                E.firstName(name.first_name),
                E.prefix(name.prefix or ''),
                E.lastName(name.last_name),
            ),
            E.gender(gender),
            _get_phone_xml('phone', phone),
            _get_phone_xml('fax', fax),
            E.address(
                E.street(address.street),
                E.number(address.number),
                E.suffix(address.suffix or ''),
                E.zipcode(address.zipcode),
                E.city(address.city),
                E.state(address.state or ''),
                E.country(address.country),
            ),
            E.email(email),
            _additional_data(additional_data),
            _extension_additional_data(extension_additional_data),
        ))

        return str(response.data.handle)