@param string|StripeLocalCard $card

@return StripeLocalCharge
978004
public function setSource($card): self
    {
        if ($card instanceof StripeLocalCard) {
            $card = $card->getId();
        }

        $this->source = $card;

        return $this;
    }
1159008
public function exportCardAsRawCard(Card $card)
    {
        $modelSignatures = [];
        foreach ($card->getSignatures() as $cardSignature) {
            $modelSignatures[] = new RawSignature(
                $cardSignature->getSigner(), $cardSignature->getSignature(), $cardSignature->getSnapshot()
            );
        }

        return new RawSignedModel($card->getContentSnapshot(), $modelSignatures);
    }
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;
    }
310959
protected function getStripeCustomer($token = null, array $options = [])
    {
        if (!$this->user->stripe_id) {
            $customer = $this->user->createAsStripeCustomer(
                $token, array_merge($options, array_filter(['coupon' => $this->coupon]))
            );
        } else {
            $customer = $this->user->asStripeCustomer();
            if ($token) {
                $this->user->updateCard($token);
            }
        }

        return $customer;
    }
178110
public function execute()
    {

        //$cardInternational = $this->getRequest()->getParam('card_international');

        try {
            $creditCard = new CreditCardMethod(
                $this->_objectManager->create('Magento\Directory\Api\CountryInformationAcquirerInterface'),
                $this->_objectManager->create('Magento\Framework\App\Config\ScopeConfigInterface'),
                $this->_objectManager->create('Magento\Framework\Module\ModuleList'),
                $this->loadOrder(),
                $this->_objectManager->create('UOL\PagSeguro\Helper\Library'),
                $data = [
                    'sender_document' => $this->helperData()->formatDocument($this->getRequest()->getParam('sender_document')),
                    'sender_hash' => $this->getRequest()->getParam('sender_hash'),
                    'order_id' => $this->lastRealOrderId(),
                    'installment' => [
                        'quantity' => $this->getRequest()->getParam('installment_quantity'),
                        'amount'   => $this->getRequest()->getParam('installment_amount')
                    ],
                    'token' => $this->getRequest()->getParam('card_token'),
                    'holder' => [
                        'name'       => $this->getRequest()->getParam('holder_name'),
                        'birth_date' => $this->getRequest()->getParam('holder_birthdate'),

                    ]
                ]
            );
            return $this->placeOrder($creditCard);

        } catch (\Exception $exception) {
            $this->changeOrderHistory('pagseguro_cancelada');
            $this->clearSession();
            return $this->whenError($exception->getMessage());
        }
    }
1318296
public function refund($charge, array $options = []): StripeRefund
    {
        $options['charge'] = $charge;

        return StripeRefund::create($options, ['api_key' => $this->getStripeKey()]);
    }
540311
public static function deleteCard($card, Payplug\Payplug $payplug = null)
    {
        if ($payplug === null) {
            $payplug = Payplug\Payplug::getDefaultConfiguration();
        }

        if ($card instanceof Card) {
            $card = $card->id;
        }

        $httpClient = new Payplug\Core\HttpClient($payplug);
        $response = $httpClient->delete(Payplug\Core\APIRoutes::getRoute(Payplug\Core\APIRoutes::CARD_RESOURCE, $card));

        return $response;
    }
69249
private static function hash($card) {
    /* We are encoding the password list just because we want to make
     * the file look nice, and to avoid bugs with special characters. */
    $card['list'] = base64_encode(json_encode($card['list']));
    $card['hash'] = hash(self::HASH_TYPE, $card['list']);
    $card['id']   = substr($card['hash'], 0, 12);

    return $card;
  }
1046429
public function chargeWithCardToken(RequestModels\CardTokenChargeCreate
	                                    $requestModel)
	{

		$chargeMapper = new ChargesMapper($requestModel);

		$requestPayload = array (
			'authorization' => $this->_apiSetting->getSecretKey(),
			'mode'          => $this->_apiSetting->getMode(),
			'postedParam'   => $chargeMapper->requestPayloadConverter(),

		);

		$processCharge = \com\checkout\helpers\ApiHttpClient::postRequest($this->_apiUrl->getCardTokensApiUri(),
			$this->_apiSetting->getSecretKey(),$requestPayload);

		$responseModel = new ResponseModels\Charge($processCharge);


		return $responseModel;
	}
210691
public function verifyCard(Card $card)
    {
        if ($this->verifySelfSignature) {
            if (!$this->validateSignerSignature($card, 'self', $card->getPublicKey())) {
                return false;
            }
        }

        if ($this->verifyVirgilSignature) {
            if (!$this->validateSignerSignature($card, 'virgil', $this->virgilPublicKey)) {
                return false;
            }
        }

        foreach ($this->whiteLists as $whiteList) {
            $isOk = false;
            foreach ($whiteList->getCredentials() as $credentials) {
                if ($this->validateSignerSignature($card, $credentials->getSigner(), $credentials->getPublicKey())) {
                    $isOk = true;
                    break;
                }
            }

            if (!$isOk) {
                return false;
            }
        }

        return true;
    }
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;
    }
62863
def cache_card(self, card):
        
        code = card.code
        self.card_cache[code] = card
        if code in self.card_cache_list:
            self.card_cache_list.remove(code)
        self.card_cache_list.append(code)

        if len(self.card_cache_list) > self.cachelimit:
            del self.card_cache[self.card_cache_list.pop(0)]
610823
public static function isValidCvv($card)
	{
		$isValid = false;

		if(isset($card['cvv'])) {

			$isCvvEmpty = CheckoutApi_Lib_Validator::isEmpty($card['cvv']);
			
			if(!$isCvvEmpty && CheckoutApi_Lib_Validator::isValidCvvLen($card['cvv'])) {
			
				$isValid = true;
			
			}
		}
		return $isValid;
	}
930164
public static Cardholder retrieve(String cardholder) throws StripeException {
    return retrieve(cardholder, (Map<String, Object>) null, (RequestOptions) null);
  }
1336768
public function getCard($cardId)
    {
        if (!$this->stripe_id) {
            return null;
        }

        $customer = $this->asStripeCustomer();

        foreach ($customer->sources->data as $card) {
            if ($card->id === $cardId) {
                return $card;
            }
        }

        return null;
    }
645885
public function deleteCard( CustomerVault\Card $card )
    {
        $card->setRequiredFields(array(
            'profileID',
            'id'
        ));
        $card->checkRequiredFields();

        $request = new Request(array(
            'method' => Request::DELETE,
            'uri' => $this->prepareURI("/profiles/" . $card->profileID . "/cards/" . $card->id),
        ));
        $this->client->processRequest($request);

        return true;
    }
967100
public function updateCard($token)
    {
        $customer = $this->asStripeCustomer();

        $token = StripeToken::retrieve($token, ['api_key' => $this->getStripeKey()]);

        // If the given token already has the card as their default source, we can just
        // bail out of the method now. We don't need to keep adding the same card to
        // a model's account every time we go through this particular method call.
        if ($token[$token->type]->id === $customer->default_source) {
            return;
        }

        $card = $customer->sources->create(['source' => $token]);

        $customer->default_source = $card->id;

        $customer->save();

        // Next we will get the default source for this model so we can update the last
        // four digits and the card brand on the record in the database. This allows
        // us to display the information on the front-end when updating the cards.
        $source = $customer->default_source
                    ? $customer->sources->retrieve($customer->default_source)
                    : null;

        $this->fillCardDetails($source);

        $this->save();
    }