Fills the user's properties with the source from Stripe.

@param \Stripe\Card|null $card

@return $this
422809
protected function fillCardDetails($card)
    {
        if ($card) {
            $this->card_brand = $card->brand;
            $this->card_last_four = $card->last4;
        }

        return $this;
    }
1091433
final public function load($id = null)
    {
        if ($id === null) {
            $id = $this->id();
        }
        $this->source()->loadItem($id, $this);
        return $this;
    }
529332
private function addCreditcard(CreditCard $creditcard)
    {
        $this->post['CardNumber'] = $creditcard->number;
        $this->post['CardExpiryMonth'] = $this->cc_format($creditcard->month, 'two_digits');
        $this->post['CardExpiryYear'] = $this->cc_format($creditcard->year, 'two_digits');
        $this->post['CustomerFirstName'] = $creditcard->first_name;
        $this->post['CustomerLastName'] = $creditcard->last_name;
        $this->post['CardHoldersName'] = $creditcard->name();

        if ($creditcard->verification_value) {
            $this->post['CVN'] = $creditcard->verification_value;
        }
    }
716452
public function setAlias($alias = null)
    {
        if (!empty($alias)) {
            $this->query['alias'] = $alias;
        } else {
            unset($this->query['alias']);
        }
        return $this;
    }
763623
private function loadCardDetailsModel($id=NULL)
	{
		if ($id == NULL)
			throw new CHttpException(400, Yii::t('Api.card', 'Missing card ID'));

		$model = UserMetadata::model()->getPrototype('UserMetadata', array(
		             'user_id' => $this->user->id,
		             'key' => $id.'_card_settings'
		         ), array('value' => '{}'));

		$model->value = CJSON::decode($model->value);

		return $model;
	}
155048
public function alias($alias = null)
    {
        if (null === $alias) {
            $alias = $this->getTableAlias();
        }
        $this->oosql_table_alias = $alias;
        return $this;
    }
278893
public function setCardData($cardData)
	{
		$this->validateInputIsCardNumber($cardData);

		$cardData = Request::formatCardNumber($cardData);

		$this->cardData = $cardData;

		return $this;
	}
629807
public void doLoad(final Card card) {
        if (mAsyncLoader == null) {
            return;
        }
        if (!card.loading && !card.loaded) {
            card.loading = true;
            mAsyncLoader.loadData(card, new AsyncLoader.LoadedCallback() {
                @Override
                public void finish() {
                    card.loading = false;
                    card.loaded = true;
                }

                @Override
                public void finish(List<BaseCell> cells) {
                    finish();
                    card.addCells(cells);
                    card.notifyDataChange();
                }

                public void fail(boolean loaded) {
                    card.loading = false;
                    card.loaded = loaded;
                }
            });
        }
    }
1223862
public function defaultCard()
    {
        if (! $this->hasStripeId()) {
            return;
        }

        $customer = $this->asStripeCustomer();

        foreach ($customer->sources->data as $card) {
            if ($card->id === $customer->default_source) {
                return $card;
            }
        }
    }
223370
public function setCreditCard(CreditCard $creditCard)
    {
        $creditCard->setContext(Moip::PAYMENT);

        $fundingInstrument = new stdClass;
        $fundingInstrument->method = 'CREDIT_CARD';
        $fundingInstrument->creditCard = $creditCard->getData();

        $this->data->fundingInstrument = $fundingInstrument;

        unset($this->data->fundingInstruments);

        return $this;
    }
1338997
function (card, cb) {

		Card.findOrCreate(card.id, card)
	    .exec(function (err, foundCard){
	      if (err) return cb(err);
	      if (foundCard.lastStripeEvent > card.lastStripeEvent) return cb(null, foundCard);
	      if (foundCard.lastStripeEvent == card.lastStripeEvent) return Card.afterStripeCustomerCardUpdated(foundCard, function(err, card){ return cb(err, card)});
	      Card.update(foundCard.id, card)
	      .exec(function(err, updatedCards){
	      	if (err) return cb(err);
	      	if (!updatedCards) return cb(null, null);
	      	Card.afterStripeCustomerCardUpdated(updatedCards[0], function(err, card){
	      		cb(err, card);
	      	});
	      });
	    });
	}
980430
public function setReference($reference = null)
    {
        $reference === null && $reference = PaymentHelper::generateReference($this->getTransactionId());
        $this->params['reference'] = $reference;
        return $this;
    }
888539
public function setCustomerId($id)
    {
        if (!isset($this->data->customer)) {
            $this->data->customer = new stdClass();
        }
        $this->data->customer->id = $id;

        return $this;
    }
332073
private function sourceExists(StripeLocalCard $card, Collection $sources)
    {
        /** @var Card $source */
        foreach ($sources->data as $source) {
            if ($card->getId() === $source->id) {
                return true;
            }
        }

        return false;
    }
984799
public function switchAceValue()
    {
        return $this->map(function (Card $card) {
            if ($card->isAce() === false) {
                return $card;
            }

            return new Card(14, $card->suit());
        });
    }
1077411
public function getCardReference()
    {
        if (isset($this->data['object']) && 'card' === $this->data['object']) {
            if (! empty($this->data['id'])) {
                return $this->data['id'];
            }
        } elseif (isset($this->data['object']) && 'transaction' === $this->data['object']) {
            return $this->data['card']['id'];
        }

        return null;
    }
2549
public function updateDefaultCard($cardId)
    {
        // first lets update the default source for the stripe customer
        $customer = $this->asStripeCustomer();
        $customer->default_source = $cardId;
        $result = $customer->save();

        // now lets update the users default card
        $card = $this->getCard($cardId);

        $this->card_brand = $card->brand;
        $this->card_last_four = $card->last4;

        $this->save();

        return $this;
    }