Ejemplo n.º 1
0
 protected function preparePostVars($orderInfo)
 {
     $prepare = array();
     $pConfig = oseMscConfig::getConfig('payment', 'obj');
     $prepare['paypal_email'] = $pConfig->paypal_email;
     $prepare['test_mode'] = $pConfig->paypal_testmode;
     if ($prepare['test_mode']) {
         $url = "https://www.sandbox.paypal.com/cgi-bin/webscr";
     } else {
         $url = "https://www.paypal.com/cgi-bin/webscr";
     }
     $prepare['url'] = $url;
     $member = oseRegistry::call('member');
     $member->instance($orderInfo->user_id);
     $billinginfo = $member->getBillingInfo('obj');
     $amount = $orderInfo->payment_price;
     $currency = $orderInfo->payment_currency;
     $order_id = $orderInfo->order_id;
     $order_number = $orderInfo->order_number;
     //$billinginfo = OSEPAYMENTS::get_billinginfo($user_id);
     $user =& JFactory::getUser($orderInfo->user_id);
     $desc = parent::generateDesc($order_id);
     $msc_name = $desc;
     return $prepare;
 }
Ejemplo n.º 2
0
 function OneOffPay($TransactionType = 'AUTH_CAPTURE', $trialPayment = false)
 {
     ini_set('max_execution_time', '180');
     $orderInfo = $this->orderInfo;
     $credit_info = $this->get('ccInfo');
     if (empty($orderInfo->payment_price)) {
         return self::getErrorMessage('cc', '0002', null);
     }
     oseRegistry::call('remote')->getClientBridge('fsock');
     $result = array();
     $db = oseDB::instance();
     $user_id = $orderInfo->user_id;
     $msc_id = $orderInfo->entry_id;
     $order_id = $orderInfo->order_id;
     $order_number = $orderInfo->order_number;
     $orderInfoParams = oseJson::decode($orderInfo->params);
     $desc = parent::generateDesc($order_id);
     $billingInfo = parent::getBillingInfo($orderInfo->user_id);
     $taxRate = isset($orderInfoParams->tax_rate) ? $orderInfoParams->tax_rate : 0;
     $currency = $orderInfo->payment_currency;
     $user =& JFactory::getUser($orderInfo->user_id);
     $app =& JFactory::getApplication();
     //$currentSession= JSession :: getInstance('none', array());
     //$stores= $currentSession->getStores();
     $Itemid = parent::getItemid();
     $amount = $orderInfo->payment_price;
     $postVar = array();
     /* $totalAmount in cents, as required by eWay:
     		The total amount in cents for the transaction, eg $1.00 = 100
     		*/
     $postVar['ewayTotalAmount'] = intval(($taxRate / 100 * $amount + $amount) * 100);
     $postVar['ewayCustomerFirstName'] = substr($billingInfo->firstname, 0, 50);
     $postVar['ewayCustomerLastName'] = substr($billingInfo->lastname, 0, 50);
     $postVar['ewayCustomerEmail'] = $billingInfo->email;
     $postVar['ewayCustomerAddress'] = substr($billingInfo->addr1, 0, 60);
     $postVar['ewayCustomerPostcode'] = substr(str_replace(" ", "", $billingInfo->postcode), 0, 6);
     $postVar['ewayCustomerInvoiceDescription'] = $desc;
     $postVar['ewayCustomerInvoiceRef'] = $order_number;
     $postVar = array_merge($postVar, $this->ccInfo);
     $postVar['ewayTrxnNumber'] = '';
     $postVar['ewayOption1'] = '';
     $postVar['ewayOption2'] = '';
     $postVar['ewayOption3'] = '';
     $resArray = $this->eWayAPIConnect($postVar, false);
     if ($resArray['ewayTrxnStatus'] == true) {
         if ($TransactionType == 'AUTH_CAPTURE') {
             if ($trialPayment == false) {
                 $params['payment_serial_number'] = $resArray['ewayTrxnNumber'];
                 $return = parent::confirmOrder($order_id, $params, 0, $user->id, 'eway');
             } else {
                 $return = $resArray;
             }
         } elseif ($TransactionType == 'AUTH_ONLY') {
             $return = $resArray;
         }
         return $return;
     } else {
         return self::getErrorMessage('cc', '0000', $resArray['ewayTrxnError']);
     }
 }