Synchronises the customer's card from Stripe back into the database.

@return $this
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;
    }
51250
public function refresh() : self {
      $newCode = $this->collection->assemble();
      $tokens = Helper::getTokensFromString($newCode);

      $this->collection->setItems($tokens);
      return $this;
    }
53011
public function rollback()
    {
        $this->models = $this->original;
        $this->added = [];
        $this->removed = [];
        return $this;
    }
1243902
private function init()
    {
        $this->setPrefix($this->getConfig('prefix', 'twitter:'));
        $this->setType($this->getConfig('card', static::TYPE_SUMMARY));
        $this->setSite($this->getConfig('site', ''));
        $this->setTitle($this->getConfig('title', ''));
        $this->addMetas($this->getConfig('metas', []));

        return $this;
    }
79669
function rollback() {
		$this->savepoint--;

		if ($this->savepoint == 0) {
			$this->dbh->rollBack();
		}
		else { // not finished with transaction
			$this->dbh->exec('ROLLBACK TO SAVEPOINT save'.$this->savepoint);
		}

		return $this;
	}
901689
public function reload()
	{
		$this->_relationships = array();
		$pk = array_values($this->getValuesFor($this->getPrimaryKey()));

		$this->setAttributesViaMassAssignment($this->find($pk)->attributes, false);
		$this->resetDirty();

		return $this;
	}
518434
function refresh() {
		$this->data = $this->table->find($this->criteria(), null, 1, 0)->current()->data;
		$this->cell = array();
		return $this;
	}
982136
public function retrieveAllPaymentmethods()
    {
        if (isset($this->_paymentMethodsArray))
            return $this;

        $obj = new stdClass();
        // Must be in specific order for checksum ---------
        $obj->MerchantID = $this->_merchantID;
        $obj->SecretCode = $this->_secretCode;
        $obj->Timestamp = $this->getTimeStamp();
        // ------------------------------------------------
        $obj->Checksum = $this->generateChecksum($obj);
        $obj->SecretCode = null;

        $this->_paymentMethods = $this->client->GetMyPaymentMethods(array('request' => $obj));

        if (isset($this->_paymentMethods->GetMyPaymentMethodsResult->PaymentMethods->PaymentMethod)) {
            $this->_paymentMethodsArray = $this->clean($this->_paymentMethods);
        }

        return $this;
    }
583999
public function get()
    {
        // Pre-populating 'carddata' is optional. If we don't yet have it
        // already, we fetch it from the backend.
        if (!isset($this->cardData['carddata'])) {
            $this->cardData = $this->carddavBackend->getCard($this->addressBookInfo['id'], $this->cardData['uri']);
        }

        return $this->cardData['carddata'];
    }
1272022
public function createBody()
    {
        $this->childNodes->push(new Card\Body());

        return $this->body = $this->childNodes->last();
    }
377653
public function reindexAll()
    {
        $this->tableStrategy
			->setUseIdxTable(false);
		
        $this->beginTransaction();
        try {
            $this->reindex();
            $this->commit();
        } catch (\Exception $e) {
            $this->rollBack();
            throw $e;
        }
        return $this;
    }
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;
    }
1186475
public function commit()
    {
        $this->_connect();
        $q = $this->_profiler->queryStart('commit', Zend_Db_Profiler::TRANSACTION);
        $this->_commit();
        $this->_profiler->queryEnd($q);
        return $this;
    }
1003440
final public function begin() {
      $this->apply_config_db();
      if ( @!$_ENV["daniia_connection"] ) {
         try {
            $_ENV["daniia_connection"] = new \PDO($this->dsn, $this->user, $this->pass);
         } catch (\PDOException $e) {
            die("Error: " . $e->getMessage() . "<br/>");
         }
         $_ENV["daniia_connection"]->beginTransaction();
      }
      return $this;
   }
1014293
public function start()
    {
        if (!$this->nested || !$this->depth) {
            $this->db->connect()->getConnection()->beginTransaction();
        }

        $this->depth++;

        return $this;
    }
600530
public function sync_original() {
		$this->original = $this->attributes;

		if ( $this->attributes[ self::OBJECT_KEY ] ) {
			$this->original[ self::OBJECT_KEY ] = clone $this->attributes[ self::OBJECT_KEY ];
		}

		foreach ( $this->original[ self::TABLE_KEY ] as $key => $item ) {
			if ( is_object( $item ) ) {
				$this->original[ $key ] = clone $item;
			}
		}

		return $this;
	}
60016
public function flush() {
        $this->_attributes = [];
        $this->_original = [];
        $this->_changed = false;
        $this->_exists = false;
        $this->_errors = [];
        $this->_validator = null;

        return $this;
    }