public function build()
 {
     $charge = new Charge();
     $charge->setDescription($this->getDescription());
     $charge->setMetadata($this->getMetadata());
     $charge->setReceiptEmail($this->getReceiptEmail());
     $charge->setFraudDetails($this->getFraudDetails());
     $charge->setShipping($this->getShipping());
     return $charge;
 }
 public function build()
 {
     $charge = new Charge();
     $charge->setAmount($this->getAmount());
     $charge->setApplicationFee($this->getApplicationFee());
     $charge->setReceiptEmail($this->getReceiptEmail());
     $charge->setStatementDescriptor($this->getStatementDescriptor());
     return $charge;
 }
 public function build()
 {
     Tebru\assertNotNull($this->getAmount(), 'Amount must not be null');
     Tebru\assertThat(null !== $this->getSource() || null !== $this->getCustomerId(), 'Source or Customer must not be null');
     if (null === $this->getCurrency()) {
         $this->setCurrency('usd');
     }
     $charge = new Charge();
     $charge->setAmount($this->getAmount());
     $charge->setCurrency($this->getCurrency());
     $charge->setCustomerId($this->getCustomerId());
     $charge->setDescription($this->getDescription());
     $charge->setMetadata($this->getMetadata());
     $charge->setStatementDescriptor($this->getStatementDescriptor());
     $charge->setReceiptEmail($this->getReceiptEmail());
     $charge->setDestination($this->getDestination());
     $charge->setApplicationFee($this->getApplicationFee());
     $charge->setShipping($this->getShipping());
     $chargeRequest = new ChargeRequest();
     $chargeRequest->setCapture($this->isCapture());
     $source = $this->getSource();
     if (is_string($source)) {
         $chargeRequest->setSourceId($source);
     } elseif ($source instanceof Card) {
         $chargeRequest->setCardSource($source);
     } elseif (null === $source) {
     } else {
         throw new LogicException('Source must be a string or Card object');
     }
     $charge->setRequest($chargeRequest);
     return $charge;
 }