Checks if the given card is set source in the StripeCustomer object.

Perfrom this check guarantees that the local database is ever in sync with the Stripe Account.

@param StripeLocalCard $card
@param Collection      $sources

@return bool
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;
    }
302326
public static function twoPair(CardCollection $cards)
    {
        $pairOne = self::nNumberOfCardsInSet($cards, 2);
        $pairTwo = self::nNumberOfCardsInSet($cards->diff($pairOne), 2);

        if ($pairTwo === null) {
            return false;
        }

        $pairs = $pairOne->merge($pairTwo);

        $highCard = self::highCard($cards->diff($pairs))->last();

        return $pairs
            ->push($highCard)
            ->switchAceValue();
    }
1075246
public function setCodeUnavailable($code, $card_id = null)
    {
        if (empty($code)) {
            return false;
        }
        $result = $this->httpRaw(static::WECHAT_SET_CARD_CODE_UNAVAILABLE_URL . 'access_token=' . $this->getAccessToken(), [
            'code' => $code,
            empty($card_id) && 'card_id' => $card_id
        ]);
        return isset($result['errmsg']) && $result['errmsg'] === 'ok' ? true : false;
    }
187545
public function updateCardFromStripe()
    {
        $customer = $this->asStripeCustomer();
        $defaultCard = null;
        foreach ($customer->sources->data as $card) {
            if ($card->id === $customer->default_source) {
                $defaultCard = $card;
                break;
            }
        }
        if ($defaultCard) {
            $this->fillCardDetails($defaultCard)->save();
        } else {
            $this->card_brand = null;
            $this->card_last_four = null;
            $this->update(false);
        }

        return $this;
    }
254991
public function isFactSourced($eventslist){
	    if(empty($eventslist)) return 0;
		$isSourced=0;
		$facts = $this->gedcomrecord->getFacts($eventslist);
		foreach($facts as $fact){
			if($isSourced < Fact::MAX_IS_SOURCED_LEVEL){
				$dfact = new Fact($fact);
				$tmpIsSourced = $dfact->isSourced();
				if($tmpIsSourced != 0) {
					if($isSourced==0) {
						$isSourced =  $tmpIsSourced;
					}
					else{
						$isSourced = max($isSourced, $tmpIsSourced);
					}
				}
			}
		}
		return $isSourced;
	}
1071594
public function retrieveCustomer(StripeLocalCustomer $localCustomer)
    {
        // If no ID is set, return false
        if (null === $localCustomer->getId()) {
            return false;
        }

        $arguments = [
            'id'      => $localCustomer->getId(),
            'options' => [],
        ];

        // Return the stripe object that can be "false" or "Customer"
        return $this->callStripeApi(Customer::class, 'retrieve', $arguments);
    }
998104
private function mustLoadStoredRoutine(): bool
  {
    // If this is the first time we see the source file it must be loaded.
    if (!isset($this->phpStratumOldMetadata)) return true;

    // If the source file has changed the source file must be loaded.
    if ($this->phpStratumOldMetadata['timestamp']!=$this->filemtime) return true;

    // If the value of a placeholder has changed the source file must be loaded.
    foreach ($this->phpStratumOldMetadata['replace'] as $place_holder => $old_value)
    {
      if (!isset($this->replacePairs[strtoupper($place_holder)]) ||
        $this->replacePairs[strtoupper($place_holder)]!==$old_value)
      {
        return true;
      }
    }

    // If stored routine not exists in database the source file must be loaded.
    if (!isset($this->rdbmsOldRoutineMetadata)) return true;

    // If current sql-mode is different the source file must reload.
    if ($this->rdbmsOldRoutineMetadata['sql_mode']!=$this->sqlMode) return true;

    // If current character set is different the source file must reload.
    if ($this->rdbmsOldRoutineMetadata['character_set_client']!=$this->characterSet) return true;

    // If current collation is different the source file must reload.
    if ($this->rdbmsOldRoutineMetadata['collation_connection']!=$this->collate) return true;

    return false;
  }
1120697
public function setSource($source)
    {
        $sourceAttribute = $this->sourceAttribute;
        return (is_string($sourceAttribute) && !empty($sourceAttribute)) ? $this->$sourceAttribute = $source : null;
    }
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)]
988682
public boolean isConsistentWith(final BaseBankCardTrackData other)
  {
    if (this == other)
    {
      return true;
    }
    if (other == null)
    {
      return false;
    }
    boolean equals = true;

    if (hasAccountNumber() && other.hasAccountNumber())
    {
      if (!getAccountNumber().equals(other.getAccountNumber()))
      {
        equals = false;
      }
    }

    if (hasExpirationDate() && other.hasExpirationDate())
    {
      if (!getExpirationDate().equals(other.getExpirationDate()))
      {
        equals = false;
      }
    }

    if (hasServiceCode() && other.hasServiceCode())
    {
      if (!getServiceCode().equals(other.getServiceCode()))
      {
        equals = false;
      }
    }

    return equals;
  }
248889
public function freeCardSummary(string $from, string $to, int $condSource = 0, string $cardId = '')
    {
        $ext = [
            'cond_source' => intval($condSource),
            'card_id' => $cardId,
        ];

        return $this->query('datacube/getcardcardinfo', $from, $to, $ext);
    }
183955
public function isLocalBranchEqualTo($targetBranch) : bool
    {
        if (!$this->gitInputValidator->isCommitishValid($targetBranch)) {
            return false;
        }
        if ($this->localHeadHash === null) {
            $this->localHeadHash = $this->commitishToHash('HEAD');
        }

        $targetCommitHash = $this->commitishToHash($targetBranch);

        return $targetCommitHash === $this->localHeadHash;
    }
1014089
public function setCreditCard($params = null)
    {

        if ($params instanceof PagSeguroCreditCardCheckout) {
            $this->creditCard = $params;
        } elseif (isset($params) && is_array($params)) {
            $this->creditCard = new PagSeguroCreditCardCheckout();
            if (isset($params['token'])) {
                $this->creditCard->setToken($params['token']);
            }
            if (isset($params['installment']) && $params['installment'] instanceof PagSeguroInstallment) {
                $this->creditCard->setInstallment($params['installment']);
            }
            if (isset($params['holder']) && $params['holder'] instanceof PagSeguroCreditCardHolder) {
                $this->creditCard->setHolder($params['holder']);
            }
            if (isset($params['billing']) && $params['billing'] instanceof PagSeguroBilling) {
                $this->creditCard->setBilling($params['billing']);
            }
        }
    }
1240900
public function updatePlan(StripeLocalPlan $localPlan, $syncSources)
    {
        // Get the stripe object
        $stripePlan = $this->retrievePlan($localPlan);

        // The retrieving failed: return false
        if (false === $stripePlan) {
            return false;
        }

        // Update the stripe object with info set in the local object
        $this->planSyncer->syncStripeFromLocal($stripePlan, $localPlan);

        // Save the plan object
        $stripePlan = $this->callStripeObject($stripePlan, 'save');

        // If the update failed, return false
        if (false === $stripePlan) {
            return false;
        }

        // Set the data returned by Stripe in the LocalPlan object
        $this->planSyncer->syncLocalFromStripe($localPlan, $stripePlan);

        if (true === $syncSources) {
            $this->planSyncer->syncLocalSources($localPlan, $stripePlan);
        }

        return true;
    }
1020741
public function delCard($card_id) {
        $data = array(
            'card_id' => $card_id,
        );
        if (!$this->access_token && !$this->checkAuth()) return false;
        $result = $this->http_post(self::API_BASE_URL_PREFIX . self::CARD_DELETE . 'access_token=' . $this->access_token, self::json_encode($data));
        if ($result) {
            $json = json_decode($result, true);
            if (!$json || !empty($json['errcode'])) {
                $this->errCode = $json['errcode'];
                $this->errMsg  = $json['errmsg'];
                return false;
            }
            return true;
        }
        return false;
    }
877042
public function updateCard(string $token): void
    {
        $customer = $this->asStripeCustomer();
        $token = Token::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
        // the user's account each time we go through this particular method call.
        if ($token->card->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 user so we can update the last
        // four digits and the card brand on this user record in the database, which
        // is convenient when displaying on the front-end when updating the cards.
        $source = $customer->default_source
            ? $customer->sources->retrieve($customer->default_source)
            : null;

        $this->fillCardDetails($source);

        $this->save();
    }
996940
protected function fillCardDetails($card)
    {
        if ($card instanceof StripeCard) {
            $this->card_brand = $card->brand;
            $this->card_last_four = $card->last4;
        } elseif ($card instanceof StripeBankAccount) {
            $this->card_brand = 'Bank Account';
            $this->card_last_four = $card->last4;
        }

        return $this;
    }