Exemple #1
0
 public function startTransaction(Sofortueberweisung $Sofortueberweisung)
 {
     $Sofortueberweisung->sendRequest();
     // SOFORT Api didn't accept the data
     if ($Sofortueberweisung->getError()) {
         return false;
     } else {
         return $Sofortueberweisung;
     }
 }
 /**
  *
  * @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;
 }
Exemple #3
0
 /**
  * @param array $fields
  *
  * @return array
  */
 public function createTransaction(array $fields)
 {
     $fields = array_replace(['success_url' => null, 'success_link_redirect' => true, 'abort_url' => null, 'notification_url' => null, 'notify_on' => implode(',', [self::STATUS_PENDING, self::STATUS_LOSS, self::STATUS_RECEIVED, self::STATUS_REFUNDED, self::STATUS_UNTRACEABLE]), 'reason' => '', 'reason_2' => '', 'product_code' => null], $fields);
     $sofort = new Sofortueberweisung($this->options['config_key']);
     $sofort->setAmount($fields['amount']);
     $sofort->setCurrencyCode($fields['currency_code']);
     $sofort->setReason($fields['reason'], $fields['reason_2'], $fields['product_code']);
     $sofort->setSuccessUrl($fields['success_url'], $fields['success_link_redirect']);
     $sofort->setAbortUrl($fields['abort_url']);
     $sofort->setNotificationUrl($fields['notification_url'], $fields['notify_on']);
     $sofort->sendRequest();
     return array_filter(['error' => $sofort->getError(), 'transaction_id' => $sofort->getTransactionId(), 'payment_url' => $sofort->getPaymentUrl()]);
 }
 /**
  * @param array $fields
  *
  * @return array
  */
 public function createTransaction(array $fields)
 {
     $sofort = new Sofortueberweisung($this->options['config_key']);
     $sofort->setAmount($fields['amount']);
     $sofort->setCurrencyCode($fields['currency_code']);
     $sofort->setReason($fields['reason'], isset($fields['reason_2']) ? $fields['reason_2'] : '');
     $sofort->setSuccessUrl($fields['success_url'], true);
     $sofort->setAbortUrl(isset($fields['abort_url']) ? $fields['abort_url'] : $this->options['abort_url']);
     $sofort->setNotificationUrl($fields['notification_url'], implode(',', array(self::STATUS_PENDING, self::STATUS_LOSS, self::STATUS_RECEIVED, self::STATUS_REFUNDED, self::STATUS_UNTRACEABLE)));
     $sofort->sendRequest();
     if ($sofort->isError()) {
         $fields['error'] = $sofort->getError();
     } else {
         $fields['transaction_id'] = $sofort->getTransactionId();
         $fields['payment_url'] = $sofort->getPaymentUrl();
     }
     return $fields;
 }