Beispiel #1
0
 public function directAction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
 {
     if ($request->getActionName() == 'thanks') {
         if ($this->getConfig('debugLog')) {
             Am_Di::getInstance()->errorLogTable->log('NetBilling Form [response-thanks]:' . json_encode($request->getParams()));
         }
         $this->invoice = $this->getDi()->invoiceTable->findFirstByPublicId($request->getFiltered('Ecom_ConsumerOrderID'));
         $url = $request->get('Ecom_Ezic_Response_StatusCode') == 0 || $request->get('Ecom_Ezic_Response_StatusCode') == 'F' ? $this->getCancelUrl() : $this->getReturnUrl();
         $response->setRedirect($url);
     } else {
         parent::directAction($request, $response, $invokeArgs);
     }
 }
Beispiel #2
0
 public function directAction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
 {
     list($action, $status, $id) = explode("-", $request->getActionName());
     if ($action != 'status') {
         if ($action != 'ipn' && $action != 'thanks' || $request->get('transaction_status') == 'SETTLED') {
             parent::directAction($request, $response, $invokeArgs);
         }
         return;
     }
     if (!in_array($status, array('return', 'ok', 'fail'))) {
         throw new Am_Exception_InternalError("Bad status-request {$status}");
     }
     if (!$id) {
         throw new Am_Exception_InternalError("Invoice ID is absent");
     }
     if (!($this->invoice = $this->getDi()->invoiceTable->findFirstByPublicId($id))) {
         throw new Am_Exception_InternalError("Invoice not found by id [{$id}]");
     }
     switch ($status) {
         case 'return':
             $url = $request->get('transactionStatus') == 'REJECTED' ? $this->getCancelUrl() : $this->getReturnUrl();
             break;
         case 'ok':
             $url = $this->getReturnUrl();
             break;
         case 'fail':
             $url = $this->getCancelUrl();
             break;
     }
     $response->setRedirect($url);
 }
Beispiel #3
0
 public function createTransaction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
 {
     if ($request->get('ACK')) {
         return new Am_Paysystem_WsoPro_Transaction_PRO($this, $request, $response, $invokeArgs);
     } else {
         return new Am_Paysystem_WsoPro_Transaction($this, $request, $response, $invokeArgs);
     }
 }
Beispiel #4
0
 public function directAction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
 {
     if ('reject' == $request->getActionName()) {
         $invoice = $this->getDi()->invoiceTable->findFirstByPublicId($request->get("orderDescription"));
         $url = $this->getRootUrl() . "/cancel?id=" . $invoice->getSecureId('CANCEL');
         return Am_Controller::redirectLocation($url);
     } else {
         return parent::directAction($request, $response, $invokeArgs);
     }
 }
Beispiel #5
0
 public function __construct(Am_Paysystem_Abstract $plugin, Am_Request $request, Zend_Controller_Response_Http $response, $invokeArgs)
 {
     $DR = preg_replace("/\\s/", "+", $request->get('DR', $_GET['DR']));
     $rc4 = new Crypt_RC4($plugin->getConfig('secret', 'ebskey'));
     $QueryString = base64_decode($DR);
     $rc4->decrypt($QueryString);
     $QueryString = split('&', $QueryString);
     foreach ($QueryString as $param) {
         $param = split('=', $param);
         $request->setParam($param[0], $param[1]);
     }
     parent::__construct($plugin, $request, $request, $invokeArgs);
 }
Beispiel #6
0
 public function createTransaction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
 {
     switch ($request->get("transactionType")) {
         case Am_Paysystem_Transaction_Plimus::CHARGE:
         case Am_Paysystem_Transaction_Plimus::RECURRING:
         case Am_Paysystem_Transaction_Plimus::AUTH_ONLY:
             return new Am_Paysystem_Transaction_Plimus_Charge($this, $request, $response, $invokeArgs);
         case Am_Paysystem_Transaction_Plimus::CANCELLATION:
             return new Am_Paysystem_Transaction_Plimus_Cancellation($this, $request, $response, $invokeArgs);
         case Am_Paysystem_Transaction_Plimus::REFUND:
             return new Am_Paysystem_Transaction_Plimus_Refund($this, $request, $response, $invokeArgs);
         case Am_Paysystem_Transaction_Plimus::CANCELLATION_REFUND:
             return new Am_Paysystem_Transaction_Plimus_Cancellation_Refund($this, $request, $response, $invokeArgs);
         case Am_Paysystem_Transaction_Plimus::CONTRACT_CHANGE:
             return new Am_Paysystem_Transaction_Plimus_Contract_Change($this, $request, $response, $invokeArgs);
         default:
             return null;
     }
 }
Beispiel #7
0
 /**
  * Find out user info from transaction details
  * @see $_autoCreateMap
  * @return array
  */
 function fetchUserInfo()
 {
     if (!$this->_autoCreateMap) {
         throw new Am_Exception_NotImplemented("Not implemented");
     }
     $ret = array();
     foreach ($this->_autoCreateMap as $field => $valKey) {
         switch ($field) {
             case 'user_external_id':
             case 'invoice_external_id':
                 break;
             case 'name':
                 @(list($ret['name_f'], $ret['name_l']) = preg_split('/\\s+/', $this->request->get($valKey), 2));
                 break;
             default:
                 $ret[$field] = $this->request->get($valKey);
         }
     }
     return $ret;
 }
Beispiel #8
0
 public function directAction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
 {
     if ($request->getActionName() == 'confirm') {
         $invoice = $this->getDi()->invoiceTable->findFirstBy(array('public_id' => $request->get('invoice')));
         if (!$invoice) {
             throw new Am_Exception_InputError('An error occurred while payment request');
         }
         if ($user = $this->getDi()->auth->getUser()) {
             if ($user->user_id != $invoice->user_id) {
                 throw new Am_Exception_InputError('An error occurred while payment request');
             }
         }
         $product = $this->getDi()->productTable->load($invoice->getItem(0)->item_id);
         $billers = json_decode($product->data()->getBlob('sliiing_billers'), true);
         if (!@$billers['options'][$request->get('biller')]) {
             throw new Am_Exception_InputError('An error occurred while payment request');
         }
         //redirect
         $aff = '0';
         $lin = '0';
         $refe_url = '0';
         $ip = '0';
         $keyword = '0';
         if (isset($_COOKIE['MID'])) {
             $mid = base64_decode($_COOKIE['MID']);
             list($aff, $lin, $refe_url, $ip, $keyword) = explode('|', $mid);
         }
         $datas = base64_encode("{$aff}|{$lin}|{$refe_url}|{$ip}|{$keyword}");
         $url = $billers['options'][$request->get('biller')];
         $url = str_replace('$datas', $datas, $url) . '&x_invoice_id=' . $invoice->public_id . '&username='******'&email=' . urlencode($invoice->getUser()->email);
         header('Location: ' . $url);
         exit;
     } else {
         parent::directAction($request, $response, $invokeArgs);
     }
 }
Beispiel #9
0
 public function setFromRequest(Am_Request $request)
 {
     if (is_string($search = $request->get('search'))) {
         $this->query->unserialize($search);
     } else {
         if ($id = $request->getInt('_u_search_load')) {
             $this->query->load($id);
         } else {
             $this->query->setFromRequest($request);
         }
     }
 }
Beispiel #10
0
 public function __construct(Am_Paysystem_Abstract $plugin, Am_Request $request, Zend_Controller_Response_Http $response, $invokeArgs)
 {
     $this->vercode = split(":", $request->get('vercode'));
     parent::__construct($plugin, $request, $response, $invokeArgs);
 }
Beispiel #11
0
 public function directAction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
 {
     $actionName = $request->getActionName();
     if ($actionName == 'ipn') {
         if (!in_array($request->getClientIp(), $this->ips)) {
             throw new Am_Exception_InputError("Request not handled - ip is not allowed");
         }
         if ($request->get('art') == 'request') {
             $shopid = $request->get('shopid');
             if (!$shopid) {
                 throw new Am_Exception_InputError("Parameter shopid wasn't received");
             }
             $invoice = Am_Di::getInstance()->invoiceTable->findFirstByPublicId($shopid);
             if (!$invoice) {
                 throw new Am_Exception_InputError("No invoice found");
             }
             $params = array();
             $params['nachname'] = $invoice->getLastName();
             $params['vorname'] = $invoice->getFirstName();
             $params['strasse'] = $invoice->getStreet();
             $params['plz'] = $invoice->getZip();
             $params['ort'] = $invoice->getCity();
             $params['land'] = $invoice->getUser()->country;
             $params['email'] = $invoice->getEmail();
             $params['betrag'] = $invoice->first_total * 100;
             $params['compain_id'] = '';
             $params['ipadresse'] = $invoice->getUser()->remote_addr;
             if ($invoice->second_period) {
                 $aboanlage = 1;
                 $abopreis = $invoice->second_total * 100;
                 preg_match("/[\\d]+/", $invoice->second_period, $days);
                 if ($days[0] <= 365 && $days[0] >= 30) {
                     $abozeit = $days[0];
                 }
                 preg_match("/[\\d]+/", $invoice->first_period, $days);
                 if ($days[0] <= 365 && $days[0] >= 3) {
                     $abonext = $days[0];
                 }
                 $params['aboanlage'] = $aboanlage;
                 $params['abopreis'] = $abopreis;
                 $params['abozeit'] = $abozeit;
                 $params['abonext'] = $abonext;
             }
             $params['cur'] = strtolower($invoice->currency);
             $message = '';
             foreach ($params as $p) {
                 $message .= $p . ";";
             }
             echo utf8_decode($message);
             return;
         }
         //Getting invoice for providing a redirect-URL with the result confirmation
         $shopid = $request->get('shopid');
         $this->invoice = Am_Di::getInstance()->invoiceTable->findFirstByPublicId($shopid);
         $invoiceLog = $this->_logDirectAction($request, $response, $invokeArgs);
         $transaction = $this->createTransaction($request, $response, $invokeArgs);
         if (!$this->invoice) {
             throw new Am_Exception_InputError("Request not handled - Request's parameter shopid is incorrect");
         }
         if (!$transaction) {
             throw new Am_Exception_InputError("Request not handled - createTransaction() returned null");
         }
         $transaction->setInvoiceLog($invoiceLog);
         try {
             $transaction->process();
         } catch (Exception $e) {
             echo "OK;" . $this->getCancelUrl() . "?shopid=" . $this->invoice->public_id;
             if ($invoiceLog) {
                 $invoiceLog->add($e);
             }
             throw $e;
         }
         echo "OK;" . $this->getReturnUrl() . "?shopid=" . $this->invoice->public_id;
         if ($invoiceLog) {
             $invoiceLog->setProcessed();
         }
     } else {
         return parent::directAction($request, $response, $invokeArgs);
     }
 }
Beispiel #12
0
 protected function createParams()
 {
     $params = parent::createParams();
     unset($params->fee_payer);
     unset($params->account_id);
     $params->checkout_id = $this->getrequest->get('checkout_id');
     return $params;
 }
Beispiel #13
0
 public function createTransaction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
 {
     if ($request->get('checkout_id')) {
         return new Am_Paysystem_Transaction_Wepay_Checkout($this, $request, $response, $invokeArgs);
     } else {
         return new Am_Paysystem_Transaction_Wepay_Preapproval($this, $request, $response, $invokeArgs);
     }
 }
Beispiel #14
0
 function getIncomingSignature(Am_Request $r)
 {
     $sig = md5(sprintf('%s%s%s%s%s%s%s', $r->get('MNT_ID'), $r->get('MNT_TRANSACTION_ID'), $r->get('MNT_OPERATION_ID'), $r->get('MNT_AMOUNT'), $r->get('MNT_CURRENCY_CODE'), $r->get('MNT_TEST_MODE'), $this->getConfig('secret_code')));
     return $sig;
 }
Beispiel #15
0
 public function __construct(Am_Paysystem_Abstract $plugin, Am_Request $request, Zend_Controller_Response_Http $response, $invokeArgs)
 {
     $this->tracking_params = $request->get("tracking_params");
     $this->billing_address = $request->get("billing_address");
     $this->subscription = $request->get("subscription");
     parent::__construct($plugin, $request, $response, $invokeArgs);
 }
Beispiel #16
0
 public function __construct(Am_Paysystem_Abstract $plugin, Am_Request $request, Zend_Controller_Response_Http $response, $invokeArgs)
 {
     $this->msp = $plugin->createMSP();
     $this->msp->transaction['id'] = $request->get('transactionid');
     parent::__construct($plugin, $request, $response, $invokeArgs);
 }
Beispiel #17
0
 function render($path, Am_View $view)
 {
     $urlPath = $this->request->get('path', 'upload::');
     $list = array();
     foreach ($this->plugins as $pl) {
         $o = new stdclass();
         $o->title = $pl->getTitle();
         $o->link = $this->getUrl($pl->getPath(null));
         $list[$pl->getId()] = $o;
     }
     $view->plugins = $list;
     $view->description = $this->storage->getDescription();
     $view->active_plugin = $this->storage->getId();
     $view->path = $path;
     $view->currentUrl = $this->getUrl($path);
     $items = $actions = array();
     foreach ($this->storage->getItems($path, $actions) as $item) {
         switch (true) {
             case $item instanceof Am_Storage_File:
                 $item->_data_info = $item->info($this->secure);
                 $item->_link = $this->getUrl($this->storage->getPath($item->getPath()));
                 $items[] = $item;
                 break;
             case $item instanceof Am_Storage_Folder:
                 $item->_link = $this->getUrl($this->storage->getPath($item->getPath()));
                 $items[] = $item;
                 break;
         }
     }
     foreach ($actions as $item) {
         switch (true) {
             case $item instanceof Am_Storage_Action_Upload:
                 $item->_link = $this->getUrl($urlPath . '?action=upload');
                 $view->upload = $item;
                 break;
             case $item instanceof Am_Storage_Action_CreateFolder:
                 $item->_link = $this->getUrl($urlPath . '?action=create-folder');
                 $view->createfolder = $item;
                 break;
             case $item instanceof Am_Storage_Action_Refresh:
                 $item->_link = $this->getUrl($urlPath . '?action=refresh');
                 $view->refresh = $item;
                 break;
             case $item instanceof Am_Storage_Action_DeleteFile:
                 $item->_link = $this->getUrl($urlPath . '?action=delete-file&path=__PATH__');
                 $view->deletefile = $item;
                 break;
             default:
                 $actions[] = $item;
         }
     }
     $view->actions = $actions;
     $view->items = $items;
     $output = $view->render('admin/_storage-grid.phtml');
     $this->response->appendBody($output);
 }
Beispiel #18
0
 public function createTransaction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
 {
     if ($request->get('Error') || $request->get('result') != 'APPROVED') {
         $invoice = $this->getDi()->invoiceTable->findFirstByData('bankart_payment_id', $request->get('paymentid'));
         echo "REDIRECT=" . $this->getRootUrl() . "/cancel?id=" . $invoice->getSecureId("CANCEL");
         die;
     }
     return new Am_Paysystem_Transaction_Bankart($this, $request, $response, $invokeArgs);
 }
Beispiel #19
0
 static function create(Am_Paysystem_Abstract $plugin, Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
 {
     $class = null;
     switch ($request->get('message_type')) {
         case Am_Paysystem_Transaction_Twocheckout::ORDER_CREATED:
             $class = 'Am_Paysystem_Transaction_Twocheckout_Order';
             break;
         case Am_Paysystem_Transaction_Twocheckout::RECURRING_INSTALLMENT_SUCCESS:
             $class = 'Am_Paysystem_Transaction_Twocheckout_RecurringOrder';
             break;
         case Am_Paysystem_Transaction_Twocheckout::FRAUD_STATUS_CHANGED:
             $class = 'Am_Paysystem_Transaction_Twocheckout_Fraud';
             break;
         case Am_Paysystem_Transaction_Twocheckout::REFUND_ISSUED:
             $class = 'Am_Paysystem_Transaction_Twocheckout_Refund';
             break;
     }
     if ($class) {
         return new $class($plugin, $request, $response, $invokeArgs);
     }
 }
Beispiel #20
0
 public function directAction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
 {
     if ($url = $request->get('url')) {
         $url = urldecode($url);
     }
     if ($request->get('host') && $request->get('ssl')) {
         $url = (!strcasecmp($request->get('ssl'), 'on') ? 'https://' : 'http://') . $request->get('host') . $url;
         $request->set('url', $url);
     }
     // if user is logged in and went here, something is definitely wrong
     if ($this->getDi()->auth->getUserId()) {
         $this->needRefresh($this->getDi()->auth->getUser());
         if (!parse_url($url, PHP_URL_SCHEME)) {
             $url = sprintf('%s://%s%s', $request->isSecure() ? 'https' : 'http', $request->getHttpHost(), $url);
         }
         Am_Controller::redirectLocation($url);
         return;
     }
     //
     require_once APPLICATION_PATH . '/default/controllers/LoginController.php';
     $c = new LoginController($request, $response, $invokeArgs);
     $c->setRedirectUrl(Am_Controller::escape($url));
     $c->run();
 }
Beispiel #21
0
 function getIncomingMd5(Am_Request $r)
 {
     $key = md5($s = $r->get('amount') . $r->get('orderid') . $r->get('tid') . $this->getConfig('key'));
     return $key;
 }
Beispiel #22
0
 static function create(Am_Paysystem_DealGuardian $plugin, Am_Request $request, Zend_Controller_Response_Http $response, $invokeArgs)
 {
     switch ($request->get('transaction_type')) {
         case 'sale':
             return new Am_Paysystem_Transaction_DealGuardian_Sale($plugin, $request, $response, $invokeArgs);
         case 'refund':
             return new Am_Paysystem_Transaction_DealGuardian_Refund($plugin, $request, $response, $invokeArgs);
         case 'subscr_cancel':
             return new Am_Paysystem_Transaction_DealGuardian_Refund($plugin, $request, $response, $invokeArgs);
         default:
             return null;
             // Don;t know how to handle IPN message.
     }
 }
Beispiel #23
0
 function getIncomingMd5(Am_Request $r, Invoice $invoice)
 {
     $currency = $this->getCurrencyCode($invoice);
     $key = md5($s2 = $this->getConfig('key2') . md5($s1 = $this->getConfig('key1') . "transact=" . $r->get('transact') . "&preauth=true&currency=" . $currency));
     return $key;
 }
Beispiel #24
0
 public function getIncomingSecurityKey(Am_Request $r)
 {
     return md5(sprintf('DateTime=%s&TransactionID=%s&OrderId=%s&Amount=%s&Currency=%s&PrivateSecurityKey=%s', $r->get('DateTime'), $r->get('TransactionID'), $r->get('OrderId'), $r->get('Amount'), $r->get('Currency'), $this->getConfig('security_key')));
 }
Beispiel #25
0
 public function __construct(Am_Paysystem_Abstract $plugin, Am_Request $request, Zend_Controller_Response_Http $response, $invokeArgs)
 {
     $this->xml = simplexml_load_string($request->get('xml_response'));
     parent::__construct($plugin, $request, $response, $invokeArgs);
 }