Example #1
0
 /**
  *
  * @param array $fields
  * @return SofortUeberweisung
  */
 public function doSofortUberweisung(array $fields, &$timeout)
 {
     $this->sofortLib->setAmount($fields['amount']);
     $this->sofortLib->setCurrencyCode($fields['currency']);
     // setting bank account in this step is optional
     if (isset($fields['bic']) && isset($fields['iban']) && isset($fields['holder'])) {
         $this->sofortLib->setSenderSepaAccount($fields['bic'], $fields['iban'], $fields['holder']);
     }
     $this->sofortLib->setReason(static::prepareString($fields['reason1'], $fields), isset($fields['reason2']) ? static::prepareString($fields['reason2'], $fields) : '');
     // check if success_url is set either in options or in fields
     if (isset($this->options['success_url']) || isset($fields['success_url'])) {
         $this->sofortLib->setSuccessUrl(isset($fields['success_url']) ? $fields['success_url'] : $this->options['success_url']);
     }
     // check if abort_url is set either in options or in fields
     if (isset($this->options['abort_url']) || isset($fields['abort_url'])) {
         $this->sofortLib->setAbortUrl(isset($fields['abort_url']) ? $fields['abort_url'] : $this->options['abort_url']);
     }
     // check if abort_url is set either in options or in fields
     if (isset($this->options['notification_url']) || isset($fields['notification_url'])) {
         $this->sofortLib->setNotificationUrl(isset($fields['notification_url']) ? $fields['notification_url'] : $this->options['notification_url']);
     }
     $timeout = isset($fields['timeout']) ? $fields['timeout'] : $this->options['timeout'];
     $this->sofortLib->setTimeout($timeout);
     /**
      * @todo what's this?
      */
     if (isset($this->options['customer_protection'])) {
         $this->sofortLib->setCustomerProtection(true);
     }
     $this->sofortLib->sendRequest();
     return $this->sofortLib;
 }