function before_process() { global $order; $_SESSION['paymill_identifier'] = time(); $this->paymentProcessor->setToken((string) $_POST['paymill_token']); $this->paymentProcessor->setAmount((int) $this->format_raw($order->info['total'])); $this->paymentProcessor->setApiUrl((string) $this->apiUrl); $this->paymentProcessor->setCurrency((string) strtoupper($order->info['currency'])); $this->paymentProcessor->setDescription(utf8_encode(substr((string) STORE_NAME, 0, 128))); $this->paymentProcessor->setEmail((string) $order->customer['email_address']); $this->paymentProcessor->setName((string) $order->customer['lastname'] . ', ' . $order->customer['firstname']); $this->paymentProcessor->setPrivateKey((string) $this->privateKey); $this->paymentProcessor->setLogger($this); $this->paymentProcessor->setSource($this->version . '_OSCOM_' . tep_get_version()); $this->fastCheckout->setFastCheckoutFlag($this->fastCheckoutFlag); if ($_POST['paymill_token'] == 'dummyToken') { $this->fastCheckout(); } $data = $this->fastCheckout->loadFastCheckoutData($_SESSION['customer_id']); if (array_key_exists('clientID', $data) && $data['clientID'] != '' && $data['clientID'] != null) { $this->existingClient($data); } if (!$this->preauth) { $result = $this->paymentProcessor->processPayment(); $_SESSION['paymill']['transaction_id'] = $this->paymentProcessor->getTransactionId(); } else { $result = $this->paymentProcessor->processPayment(!$this->preauth); $_SESSION['paymill']['preauth_id'] = $this->paymentProcessor->getPreauthId(); } if (!$result) { unset($_SESSION['paymill_identifier']); $errorCode = $this->paymentProcessor->getErrorCode(); tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL', true, false) . '?step=step2&payment_error=' . $this->code . '&error=' . $errorCode); } if ($this->fastCheckoutFlag) { $this->savePayment(); } else { $this->saveClient(); } unset($_SESSION['paymill_identifier']); }
function before_process() { global $order; $_SESSION['paymill_identifier'] = time(); $this->paymentProcessor->setAmount((int) $_SESSION['paymill']['amount']); $this->paymentProcessor->setApiUrl((string) $this->apiUrl); $this->paymentProcessor->setCurrency((string) strtoupper($order->info['currency'])); $this->paymentProcessor->setDescription(utf8_encode(substr((string) STORE_NAME . ' ' . $order->customer['lastname'] . ', ' . $order->customer['firstname'], 0, 128))); $this->paymentProcessor->setEmail((string) $order->customer['email_address']); $this->paymentProcessor->setName($order->customer['lastname'] . ', ' . $order->customer['firstname']); $this->paymentProcessor->setPrivateKey((string) $this->privateKey); $this->paymentProcessor->setToken((string) $_POST['paymill_token']); $this->paymentProcessor->setLogger($this); $this->paymentProcessor->setSource($this->version . '_' . str_replace(' ', '_', PROJECT_VERSION)); $this->fastCheckout->setFastCheckoutFlag($this->fastCheckoutFlag); if ($_POST['paymill_token'] === 'dummyToken') { $this->fastCheckout(); } $data = $this->fastCheckout->loadFastCheckoutData($_SESSION['customer_id']); if (!empty($data['clientID'])) { $this->existingClient($data); } $result = $this->paymentProcessor->processPayment(); $_SESSION['paymill']['transaction_id'] = $this->paymentProcessor->getTransactionId(); if (!$result) { unset($_SESSION['paymill_identifier']); $errorCode = $this->paymentProcessor->getErrorCode(); xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'step=step2&payment_error=' . $this->code . '&error=' . $errorCode, 'SSL', true, false)); } if ($this->fastCheckoutFlag) { $this->savePayment(); } else { $this->saveClient(); } unset($_SESSION['paymill_identifier']); }