Пример #1
0
 public function build()
 {
     Tebru\assertNotNull($this->getSource(), 'Source must be set');
     $card = new Card();
     $card->setMetadata($this->getMetadata());
     $card->setDefaultForCurrency($this->getDefaultForCurrency());
     $cardRequest = new CardRequest();
     $source = $this->getSource();
     if (is_string($source)) {
         $cardRequest->setSourceId($source);
     } elseif ($source instanceof Card) {
         $cardRequest->setCardSource($source);
     } elseif (null === $source) {
     } else {
         throw new LogicException('Source must be a string or Card object');
     }
     $card->setRequest($cardRequest);
     return $card;
 }
Пример #2
0
 public function build()
 {
     $card = new Card();
     $card->setAddressCity($this->getAddressCity());
     $card->setAddressCountry($this->getAddressCountry());
     $card->setAddressLine1($this->getAddressLine1());
     $card->setAddressState($this->getAddressState());
     $card->setAddressZip($this->getAddressZip());
     $card->setDefaultForCurrency($this->getDefaultForCurrency());
     $card->setExpMonth($this->getExpMonth());
     $card->setExpYear($this->getExpYear());
     $card->setMetadata($this->getMetadata());
     $card->setName($this->getName());
     return $card;
 }
Пример #3
0
 public function build()
 {
     Tebru\assertNotNull($this->getNumber(), 'Card number must not be null');
     Tebru\assertNotNull($this->getExpMonth(), 'Expiration month must not be null');
     Tebru\assertNotNull($this->getExpYear(), 'Expiration year must not be null');
     if (null === $this->getObject()) {
         $this->setObject('card');
     }
     if (null === $this->getCurrency()) {
         $this->setCurrency('usd');
     }
     $card = new Card();
     $card->setObject($this->getObject());
     $card->setExpMonth($this->getExpMonth());
     $card->setExpYear($this->getExpYear());
     $card->setCurrency($this->getCurrency());
     $card->setName($this->getName());
     $card->setAddressLine1($this->getAddressLine1());
     $card->setAddressLine2($this->getAddressLine2());
     $card->setAddressCity($this->getAddressCity());
     $card->setAddressState($this->getAddressState());
     $card->setAddressZip($this->getAddressZip());
     $card->setAddressCountry($this->getAddressCountry());
     $cardRequest = new CardRequest();
     $cardRequest->setNumber($this->getNumber());
     $cardRequest->setCvc($this->getCvc());
     $card->setRequest($cardRequest);
     return $card;
 }