本文整理汇总了PHP中TiendaHelperBase::number方法的典型用法代码示例。如果您正苦于以下问题:PHP TiendaHelperBase::number方法的具体用法?PHP TiendaHelperBase::number怎么用?PHP TiendaHelperBase::number使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TiendaHelperBase
的用法示例。
在下文中一共展示了TiendaHelperBase::number方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _prePayment
/**
* Prepares the payment form
* and returns HTML Form to be displayed to the user
* generally will have a message saying, 'confirm entries, then click complete order'
*
* Submit button target for onsite payments & return URL for offsite payments should be:
* index.php?option=com_tienda&view=checkout&task=confirmPayment&orderpayment_type=xxxxxx
* where xxxxxxx = $_element = the plugin's filename
*
* @param $data array form post data
* @return string HTML to display
*/
function _prePayment($data)
{
// prepare the payment form
$vars = new JObject();
$vars->order_id = $data['order_id'];
$vars->orderpayment_id = $data['orderpayment_id'];
$vars->orderpayment_amount = $data['orderpayment_amount'];
$vars->orderpayment_type = $this->_element;
// set payment plugin variables
$vars->post_url = $this->_getPostUrl();
// TODO: Currency choice not Accepted Yet, but when it is use Tienda::getInstance()->get('currency');
// TODO: Recalculate to SEK with something like:
// $vars->Cost = TiendaCurrency::convert( $data['orderpayment_amount'], Tienda::getInstance()->get('currency'), "SEK" );
$vars->currency_code = "SEK";
// set variables for user info
$vars->SellerEmail = $this->_getParam('payson_seller_email');
$vars->BuyerFirstName = $data['orderinfo']->shipping_first_name;
$vars->BuyerLastName = $data['orderinfo']->shipping_last_name;
$vars->BuyerEmail = $data['orderinfo']->user_email;
$vars->Cost = str_replace(".", ",", TiendaHelperBase::number($data['orderpayment_amount'], array('thousands' => '', 'currency_decimal' => ',', 'num_decimals' => 2)));
$vars->ExtraCost = '0';
// TODO: Implement later, might be configured from plugin parameters to let the shop owner take an extra cost?
$vars->RefNr = $data['orderpayment_id'];
$vars->PaymentMethod = $this->_getParam('PaymentMethod');
$vars->OkUrl = JURI::root() . "index.php?option=com_tienda&view=checkout&task=confirmPayment&orderpayment_type=" . $this->_element . "&paction=display_message";
$vars->CancelUrl = JURI::root() . "index.php?option=com_tienda&view=checkout&task=confirmPayment&orderpayment_type=" . $this->_element . "&paction=cancel";
$vars->AgentId = $this->_getParam('payson_agent_id', '');
$vars->GuaranteeOffered = $this->_getParam('payson_guarantee', '');
$vars->payson_image = $this->_getParam('payson_image', '');
// Create the MD5 to validate the request at Payson
$Key = $this->_getParam('payson_md5');
$MD5string = $vars->SellerEmail . ":" . $vars->Cost . ":" . $vars->ExtraCost . ":" . $vars->OkUrl . ":" . $vars->GuaranteeOffered . $Key;
$vars->MD5 = md5($MD5string);
$html = $this->_getLayout('prepayment', $vars);
return $html;
}
示例2: _process
function _process($data)
{
$post = JRequest::get('post');
$orderpayment_id = @$data['ssl_invoice_number'];
$errors = array();
$send_email = false;
// load the orderpayment record and set some values
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tienda/tables');
$orderpayment = JTable::getInstance('OrderPayments', 'TiendaTable');
$orderpayment->load($orderpayment_id);
if (empty($orderpayment_id) || empty($orderpayment->orderpayment_id)) {
$errors[] = JText::_('VIRTUALMERCHANT MESSAGE INVALID ORDERPAYMENTID');
return count($errors) ? implode("\n", $errors) : '';
}
$orderpayment->transaction_details = $data['ssl_result_message'];
$orderpayment->transaction_id = $data['ssl_txn_id'];
$orderpayment->transaction_status = $data['ssl_result'];
// check the stored amount against the payment amount
Tienda::load('TiendaHelperBase', 'helpers._base');
$stored_amount = TiendaHelperBase::number($orderpayment->get('orderpayment_amount'), array('thousands' => ''));
$respond_amount = TiendaHelperBase::number($data['ssl_amount'], array('thousands' => ''));
if ($stored_amount != $respond_amount) {
$errors[] = JText::_('VIRTUALMERCHANT MESSAGE AMOUNT INVALID');
$errors[] = $stored_amount . " != " . $respond_amount;
}
// set the order's new status and update quantities if necessary
Tienda::load('TiendaHelperOrder', 'helpers.order');
Tienda::load('TiendaHelperCarts', 'helpers.carts');
$order = JTable::getInstance('Orders', 'TiendaTable');
$order->load($orderpayment->order_id);
if (count($errors)) {
// if an error occurred
$order->order_state_id = $this->params->get('failed_order_state', '10');
// FAILED
} else {
$order->order_state_id = $this->params->get('payment_received_order_state', '17');
// PAYMENT RECEIVED
// do post payment actions
$setOrderPaymentReceived = true;
// send email
$send_email = true;
}
// save the order
if (!$order->save()) {
$errors[] = $order->getError();
}
// save the orderpayment
if (!$orderpayment->save()) {
$errors[] = $orderpayment->getError();
}
if (!empty($setOrderPaymentReceived)) {
$this->setOrderPaymentReceived($orderpayment->order_id);
}
if ($send_email) {
// send notice of new order
Tienda::load("TiendaHelperBase", 'helpers._base');
$helper = TiendaHelperBase::getInstance('Email');
$model = Tienda::getClass("TiendaModelOrders", "models.orders");
$model->setId($orderpayment->order_id);
$order = $model->getItem();
$helper->sendEmailNotices($order, 'new_order');
}
return count($errors) ? implode("\n", $errors) : '';
return true;
}
示例3: _process
/**
*
* @return HTML
*/
function _process()
{
$send_email = false;
$data = JRequest::getVar('DATA', '', 'post');
// Invalidate data if it is in the wrong format
if (!preg_match(':^[a-zA-Z0-9]+$:', $data)) {
$data = '';
}
$this->os_info = $this->_getOperatingSystemInfo();
// set sips checkout type
// Next line is there to help me to debug
// should not be removed
//$data = '2020333732603028502c2360532d5328532d2360522d4360502c4360502c3334502c3330512d2324562d5334592c3324512c33242a2c2360532c2360502d2324502c23602a2c2360552c2360502d433c552e3328572c4048512c2334502c23605435444533303048502c2338502c2324542c4360512c2360582c4344502e3334582d233c2a2c3360532c2360502d4324512d3344502c5048512c2330502c2360582c4360512c2360582c43442a2c3360512c2360502c4360505c224324502c4360502c3360512c4340532c233c552e3330535c224324502c2360502c2338502d5334592d232c2a2c2328582c2360502c4639525c224360522e3360502c2329463c4048502c2340502c2360532e333c585c224324502d4360502c233c512c3324512b4360505c224324512d2360502c2338522c2324522c23242a2c2360592c2360502c4639525c224360532c2360502c4321413b26255438364c512c232160383651413d26254b2b4659453d6048502c3338502c23605334552d2c5c224360502d5360502c2328502c4048502c5340502c2360522e33382a2c2330502c2360512d2425353524412f34455d2330352134353529255c224360532e3360502c2324505c224324502e3360502c23292e335048512c3360502c236051334048512c3324502c2360522c23602a2c2328562c2360502d5344572d3344522d53282adc970880f8cf2717';
//
// Récupération de la variable cryptée DATA
$message = "message=" . $data;
$pathfile .= " pathfile=" . $this->_getPathfileFileName($this->params->get('pathfile'));
$bin_response = $this->_getBinPath("response");
$parm = $message . " " . $pathfile;
$result = exec("{$bin_response} {$parm}");
$sips_response_array = explode("!", $result);
list(, $code, $error, $merchant_id, $merchant_country, $amount, $transaction_id, $payment_means, $transmission_date, $payment_time, $payment_date, $response_code, $payment_certificate, $authorisation_id, $currency_code, $card_number, $cvv_flag, $cvv_response_code, $bank_response_code, $complementary_code, $complementary_info, $return_context, $caddie, $receipt_complement, $merchant_language, $language, $customer_id, $orderpayment_id, $customer_email, $customer_ip_address, $capture_day, $capture_mode, $data) = $sips_response_array;
if ($code != 0) {
$errors[] = JText::_('TIENDA_SIPS_RETURN_CODE_INVALID') . " " . $code;
} elseif ($error != 0) {
$errors[] = JText::_('TIENDA_SIPS_RETURN_ERROR') . " " . $sips_error;
} elseif ($merchant_id != $this->params->get('merchant_id')) {
$errors[] = JText::_('TIENDA_SIPS_MERCHANT_ID_RECEIVED_INVALID');
} else {
// load the orderpayment record and set some values
JTable::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_tienda' . DS . 'tables');
$orderpayment = JTable::getInstance('OrderPayments', 'TiendaTable');
$orderpayment->load($orderpayment_id);
if (empty($orderpayment_id) || empty($orderpayment->orderpayment_id)) {
$errors[] = JText::_('TIENDA_SIPS_INVALID ORDERPAYMENTID');
}
}
if (count($errors)) {
echo $errors;
print_r($errors);
$this->_sendErrorEmail($errors, $sips_response_array);
return false;
}
// check the stored amount against the payment amount
Tienda::load('TiendaHelperBase', 'helpers._base');
$stored_amount = TiendaHelperBase::number($orderpayment->get('orderpayment_amount'), array('thousands' => ''));
$respond_amount = TiendaHelperBase::number($amount, array('thousands' => ''));
if ($stored_amount != $respond_amount) {
$errors[] = JText::_('TIENDA_SIPS_AMOUNT_INVALID');
$errors[] = $stored_amount . " != " . $respond_amount;
}
// set the order's new status and update quantities if necessary
Tienda::load('TiendaHelperOrder', 'helpers.order');
Tienda::load('TiendaHelperCarts', 'helpers.carts');
$order = JTable::getInstance('Orders', 'TiendaTable');
$order->load($orderpayment->order_id);
if (count($errors) or $response_code != '00') {
if ($response_code != '00') {
$orderpayment->transaction_details = JText::_('TIENDA_SIPS_RESPONSE_CODE') . $response_code . "\n" . JText::_('TIENDA_SIPS_RESPONSE_CODE_SIPS_ERROR') . constant('TIENDA_SIPS_RESPONSE_' . $response['response_code']) . "\n" . JText::_('TIENDA_SIPS_READ_SIPS_DOCUMENTATION');
} else {
$orderpayment->transaction_details = implode(" ", $errors);
}
$order->order_state_id = $this->params->get('failed_order_state', '10');
// FAILED
// save the order
if (!$order->save()) {
$errors[] = $order->getError();
}
$send_email = false;
} else {
define($credit_card_type, $payment_means);
$credit_card = split('\\.', $card_number);
$credit_card_number = $credit_card[0] . ' #### #### ##' . $credit_card[1];
// TO DO: DECODE TIME AND DATE
$orderpayment->transaction_details = JText::_('TIENDA_SIPS_TRANSMISSION_DATE') . $transmission_date . "\n" . JText::_('TIENDA_SIPS_RESPONSE_PAYMENT_TIME') . " : " . $payment_time . "\n" . JText::_('TIENDA_SIPS_RESPONSE_PAYMENT_DATE') . " : " . $payment_date . "\n" . JText::_('TIENDA_SIPS_RESPONSE_PAYMENT_CERTIFICATE') . " : " . $payment_certificate . "\n" . JText::_('TIENDA_SIPS_RESPONSE_AUTHORIZATION_ID') . $authorisation_id . "\n" . JText::_('TIENDA_SIPS_RESPONSE_CREDIT_CARD_TYPE') . " : " . constant($credit_card_type) . "\n" . JText::_('TIENDA_SIPS_RESPONSE_CREDIT_CARD_NUMBER') . " : " . $credit_card_number;
$orderpayment->transaction_id = $transaction_id;
$orderpayment->transaction_status = $response_code;
// ???
$order->order_state_id = $this->params->get('payment_received_order_state', '17');
// save the order
if (!$order->save()) {
$errors[] = $order->getError();
}
// PAYMENT RECEIVED
$this->setOrderPaymentReceived($orderpayment->order_id);
// send email
$send_email = true;
}
// save the orderpayment
if (!$orderpayment->save()) {
$errors[] = $orderpayment->getError();
}
if ($send_email) {
// send notice of new order
Tienda::load("TiendaHelperBase", 'helpers._base');
$helper = TiendaHelperBase::getInstance('Email');
//.........这里部分代码省略.........
示例4: _process
/**
* Processing the payment
*
* @param $data array form post data
* @return string HTML to display
*/
function _process($data)
{
$errors = array();
// load the orderpayment record and set some values
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tienda/tables');
$orderpayment_id = $data['orderpayment_id'];
$orderpayment = JTable::getInstance('OrderPayments', 'TiendaTable');
$orderpayment->load($orderpayment_id);
$orderpayment->transaction_details = $data['orderpayment_type'];
$orderpayment->transaction_id = $data['orderpayment_id'];
$orderpayment->transaction_status = "Payment Incomplete";
// check the stored amount against the payment amount
Tienda::load('TiendaHelperBase', 'helpers._base');
$stored_amount = TiendaHelperBase::number($orderpayment->get('orderpayment_amount'), array('thousands' => ''));
$respond_amount = TiendaHelperBase::number($data['orderpayment_amount'], array('thousands' => ''));
if ($stored_amount != $respond_amount) {
$errors[] = JText::_('TIENDA ALPHAUSERPOINTS PAYMENT MESSAGE AMOUNT INVALID');
$errors[] = $stored_amount . " != " . $respond_amount;
}
// check if user has enough points
$userpoints = $this->getUserpoints();
if ($data['amount_points'] > $userpoints) {
$errors[] = JText::_('TIENDA ALPHAUSERPOINTS PAYMENT MESSAGE NOT ENOUGH POINTS');
}
// set the order's new status and update quantities if necessary
Tienda::load('TiendaHelperOrder', 'helpers.order');
Tienda::load('TiendaHelperCarts', 'helpers.carts');
$order = JTable::getInstance('Orders', 'TiendaTable');
$order->load($orderpayment->order_id);
if (count($errors)) {
// if an error occurred
$order->order_state_id = $this->params->get('failed_order_state', '10');
// FAILED
$setOrderPaymentReceived = false;
$send_email = false;
} else {
$order->order_state_id = $this->params->get('payment_received_order_state', '17');
// PAYMENT RECEIVED
$orderpayment->transaction_status = "Payment Received";
//reduce number of alphauserpoints
$errors[] = $this->reduceUserpoints($data['amount_points']);
// do post payment actions
$setOrderPaymentReceived = true;
// send email
$send_email = true;
}
// save the order
if (!$order->save()) {
$errors[] = $order->getError();
}
// save the orderpayment
if (!$orderpayment->save()) {
$errors[] = $orderpayment->getError();
}
if (!empty($setOrderPaymentReceived)) {
$this->setOrderPaymentReceived($orderpayment->order_id);
}
if ($send_email) {
// send notice of new order
Tienda::load("TiendaHelperBase", 'helpers._base');
$helper = TiendaHelperBase::getInstance('Email');
$model = Tienda::getClass("TiendaModelOrders", "models.orders");
$model->setId($orderpayment->order_id);
$order = $model->getItem();
$helper->sendEmailNotices($order, 'new_order');
}
return count($errors) ? implode("\n", $errors) : '';
}
示例5: _process
function _process($data)
{
$errors = array();
$user = JFactory::getUser();
// load the orderpayment record and set some values
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tienda/tables');
$orderpayment_id = $data['orderpayment_id'];
$orderpayment = JTable::getInstance('OrderPayments', 'TiendaTable');
$orderpayment->load($orderpayment_id);
$orderpayment->transaction_details = $data['orderpayment_type'];
$orderpayment->transaction_id = $data['orderpayment_id'];
$orderpayment->transaction_status = "Incomplete";
// check the stored amount against the payment amount thousand
Tienda::load('TiendaHelperBase', 'helpers._base');
$stored_amount = TiendaHelperBase::number($orderpayment->get('orderpayment_amount'), array('thousands' => ''));
$respond_amount = TiendaHelperBase::number($data['orderpayment_amount'], array('thousands' => ''));
if ($stored_amount != $respond_amount) {
$errors[] = JText::_('TIENDA AMBRAPOINTS PAYMENT MESSAGE AMOUNT INVALID');
$errors[] = $stored_amount . " != " . $respond_amount;
}
// set the order's new status and update quantities if necessary
Tienda::load('TiendaHelperOrder', 'helpers.order');
Tienda::load('TiendaHelperCarts', 'helpers.carts');
$order = JTable::getInstance('Orders', 'TiendaTable');
$order->load($orderpayment->order_id);
// check if user has enough points
JLoader::import('com_ambra.helpers.user', JPATH_ADMINISTRATOR . '/components');
$current_points = AmbraHelperUser::getPoints($order->user_id);
if ($data['amount_points'] > $current_points) {
$errors[] = JText::_('TIENDA AMBRAPOINTS PAYMENT MESSAGE NOT ENOUGH POINTS');
}
if (count($errors)) {
// if an error occurred
$order->order_state_id = $this->params->get('failed_order_state', '10');
// FAILED
$send_email = false;
} else {
$order->order_state_id = $this->params->get('payment_received_order_state', '17');
// PAYMENT RECEIVED
$orderpayment->transaction_status = "Payment Received";
// do post payment actions
$setOrderPaymentReceived = true;
// send email
$send_email = true;
}
// save the order
if (!$order->save()) {
$errors[] = $order->getError();
}
// save the orderpayment
if (!$orderpayment->save()) {
$errors[] = $orderpayment->getError();
}
if (!empty($setOrderPaymentReceived)) {
$this->setOrderPaymentReceived($orderpayment->order_id);
}
if ($send_email) {
// send notice of new order
Tienda::load("TiendaHelperBase", 'helpers._base');
$helper = TiendaHelperBase::getInstance('Email');
$model = Tienda::getClass("TiendaModelOrders", "models.orders");
$model->setId($orderpayment->order_id);
$order = $model->getItem();
$helper->sendEmailNotices($order, 'new_order');
}
// substract spent points from user's ambra total points
// successful payment
// if here, all OK
// create a pointhistory table object
$pointhistory = JTable::getInstance('PointHistory', 'AmbraTable');
// set properties
$pointhistory->user_id = $user->id;
$pointhistory->points = "-" . $data['amount_points'];
$pointhistory->points_updated = 0;
$pointhistory->pointhistory_enabled = 1;
$pointhistory->pointhistory_name = JText::_('For making purchase in Tienda');
$pointhistory->pointhistory_description = JText::_('COM_TIENDA_PAYMENT_ID') . ": " . $orderpayment_id . "\n" . JText::_('COM_TIENDA_TRANSACTION_ID') . ": " . $orderpayment->transaction_id;
// save it and move on
if (!$pointhistory->save()) {
$errors[] = $pointhistory->getError();
// if saving the record failed, disable sub?
}
return count($errors) ? implode("\n", $errors) : '';
}
示例6: foreach
?>
'>
<?php
$i = 1;
foreach ($vars->orderitems as $item) {
//TODO
/* TiendaHelperBase::number( @$item->orderitem_final_price / @$item->orderitem_quantity, array( 'thousands' =>'', 'decimal'=> '.' ) );
* TiendaHelperBase::number( @$item->orderitem_price + @$item->orderitem_attributes_price, array( 'thousands' =>'', 'decimal'=> '.' ) );
* THis doesn't work because it doesn't take into account pricing discounts from coupons
* */
?>
<input type='hidden' name='amount_<?php
echo $i;
?>
' value='<?php
echo TiendaHelperBase::number(@$item->orderitem_final_price / @$item->orderitem_quantity, array('thousands' => '', 'decimal' => '.'));
?>
'>
<input type='hidden' name='item_name_<?php
echo $i;
?>
' value='<?php
echo $item->_description;
?>
'>
<input type='hidden' name='item_number_<?php
echo $i;
?>
' value='<?php
echo $item->product_id;
?>
示例7: _getProcessVars
/**
* Prepares parameters for the payment processing
*
* @param object $data Post variables
* @return array
* @access protected
*/
function _getProcessVars($data)
{
$vendor_name = $this->vendor_name;
// for now, we impomenet only standard payment method
$paymenttype = 'PAYMENT';
// joomla info
$user = JFactory::getUser();
$submitted_email = !empty($data['email']) ? $data['email'] : '';
$sagepay_userid = $user->id;
$sagepay_useremail = empty($user->id) ? $submitted_email : $user->email;
// order info
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tienda/tables');
$order = JTable::getInstance('Orders', 'TiendaTable');
$order->load($data['order_id']);
$orderpayment = JTable::getInstance('OrderPayments', 'TiendaTable');
$orderpayment->load($data['orderpayment_id']);
$orderinfo = JTable::getInstance('OrderInfo', 'TiendaTable');
$orderinfo->load(array('order_id' => $data['order_id']));
$billingzone = JTable::getInstance('Zones', 'TiendaTable');
$billingzone->load($orderinfo->billing_zone_id);
$currency = JTable::getInstance('Currencies', 'TiendaTable');
$currency->load(array('currency_id' => $order->currency_id));
$country = JTable::getInstance('Countries', 'TiendaTable');
$country->load(array('country_id' => $orderinfo->billing_country_id));
Tienda::load('TiendaHelperBase', 'helpers._base');
$sagepay_description = JText::_('COM_TIENDA_ORDER_NUMBER') . ": " . $order->order_id;
$sagepay_amount = TiendaHelperBase::number($orderpayment->orderpayment_amount, array('thousands' => ''));
$sagepay_invoice_num = $data['orderpayment_id'];
// customer information
$sagepay_fname = $orderinfo->billing_first_name;
$sagepay_lname = $orderinfo->billing_last_name;
$sagepay_address1 = substr($orderinfo->billing_address_1, 0, 100);
$sagepay_address2 = substr($orderinfo->billing_address_2, 0, 100);
$sagepay_city = $orderinfo->billing_city;
$sagepay_zip = $orderinfo->billing_postal_code;
$sagepay_country = $country->country_isocode_2;
if ($sagepay_country == 'US') {
$sagepay_state = $billingzone->code;
} else {
$sagepay_state = '';
}
$sagepay_card_num = str_replace(" ", "", str_replace("-", "", $data['cardnum']));
$sagepay_phone = $orderinfo->billing_phone_1;
$sagepay_exp_date = $this->_getFormattedCardDate('my', $data['cardexp']);
$sagepay_start_date = $this->_getFormattedCardDate('my', $data['cardst']);
$vendorTxCode = $data['order_id'];
// put all values into an array (does not support Gift Aid Payment)
$sagepay_values = array("VPSProtocol" => $this->sagepay_protocol, "TxType" => $paymenttype, "Vendor" => $vendor_name, "VendorTxCode" => $vendorTxCode, "Amount" => $sagepay_amount, "Currency" => $currency->currency_code, "Description" => $sagepay_description, "CardHolder" => $data['cardholder'], "CardNumber" => $sagepay_card_num, "StartDate" => $sagepay_start_date, "ExpiryDate" => $sagepay_exp_date, "IssueNumber" => $data['cardissuenum'], "CV2" => $data['cardcv2'], "CardType" => $data['cardtype'], "BillingSurname" => $sagepay_lname, "BillingFirstnames" => $sagepay_fname, "BillingAddress1" => $sagepay_address1, "BillingAddress2" => $sagepay_address2, "BillingCity" => $sagepay_city, "BillingPostCode" => $sagepay_zip, "BillingCountry" => $sagepay_country, "BillingState" => $sagepay_state, "BillingPhone" => $sagepay_phone, "DeliverySurname" => $sagepay_lname, "DeliveryFirstnames" => $sagepay_fname, "DeliveryAddress1" => $sagepay_address1, "DeliveryAddress2" => $sagepay_address2, "DeliveryCity" => $sagepay_city, "DeliveryPostCode" => $sagepay_zip, "DeliveryCountry" => $sagepay_country, "DeliveryState" => $sagepay_state, "DeliveryPhone" => $sagepay_phone, "CustomerEMail" => $sagepay_useremail, "ClientIPAddress" => $_SERVER['REMOTE_ADDR'], "AccountType" => 'E');
return $sagepay_values;
}
示例8:
?>
</td>
</tr>
<tr>
<th><a href="<?php
echo $stats->link;
?>
"><?php
echo JText::_('COM_TIENDA_LIFETIME_SALES');
?>
</a></th>
<td style="text-align: right;"><?php
echo TiendaHelperBase::number($stats->lifetime->num, $options_int);
?>
</td>
<td style="text-align: right;"><?php
echo TiendaHelperBase::number($stats->lifetime->average_daily, $options_decimal);
?>
</td>
<td style="text-align: right;"><?php
echo TiendaHelperBase::currency($stats->lifetime->average, '', $options_decimal);
?>
</td>
<td style="text-align: right;"><?php
echo TiendaHelperBase::currency($stats->lifetime->amount, '', $options_decimal);
?>
</td>
</tr>
</tbody>
</table>
示例9: array
<?php
} else {
?>
<td style="text-align: center; width: 33%;"><h3><?php
echo TiendaSelect::range(@$state->stats_interval, 'stats_interval', $attribs, null, true);
?>
</h3></td>
<?php
}
?>
<td style="text-align: center; width: 33%;"><h3><?php
echo TiendaHelperBase::currency(@$this->sum);
?>
</h3></td>
<td style="text-align: center; width: 33%;"><h3><?php
echo TiendaHelperBase::number(@$this->total, array('num_decimals' => '0'));
?>
</h3></td>
</tr>
</tbody>
</table>
<div class="section">
<?php
$chart = new HighRoller();
$chart->chart->renderTo = 'chart';
$chart->chart->type = 'mixed';
$chart->plotOptions = new stdClass();
$chart->plotOptions->column = new stdClass();
$chart->plotOptions->column->pointStart = strtotime(@$this->revenue[0][0]) * 1000;
$chart->plotOptions->column->pointInterval = @$this->interval->pointinterval;
示例10: _processSale
/**
* Processes the form data
*/
function _processSale($data, $vars)
{
$errors = array();
// load the orderpayment record and set some values
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tienda/tables');
$orderpayment_id = JRequest::getVar('orderpayment_id');
$orderpayment = JTable::getInstance('OrderPayments', 'TiendaTable');
$orderpayment->load($orderpayment_id);
$orderpayment->transaction_details = $data['key'];
$orderpayment->transaction_id = $data['order_number'];
$orderpayment->transaction_status = $data['credit_card_processed'];
// check the stored amount against the payment amount
Tienda::load('TiendaHelperBase', 'helpers._base');
$stored_amount = TiendaHelperBase::number($orderpayment->get('orderpayment_amount'), array('thousands' => ''));
$respond_amount = TiendaHelperBase::number($data['total'], array('thousands' => ''));
if ($stored_amount != $respond_amount) {
$errors[] = JText::_('COM_TIENDA_2CO_MESSAGE_AMOUNT_INVALID');
$errors[] = $stored_amount . " != " . $respond_amount;
}
// set the order's new status and update quantities if necessary
Tienda::load('TiendaHelperOrder', 'helpers.order');
Tienda::load('TiendaHelperCarts', 'helpers.carts');
$order = JTable::getInstance('Orders', 'TiendaTable');
$order->load($orderpayment->order_id);
$send_email = false;
if (!$vars->approved) {
//incorrect hash
$order->order_state_id = '14';
// Unspecified Error
} else {
if (count($errors)) {
// if an error occurred
$order->order_state_id = $this->params->get('failed_order_state', '10');
// FAILED
} else {
$order->order_state_id = $this->params->get('payment_received_order_state', '17');
// PAYMENT RECEIVED
// do post payment actions
$setOrderPaymentReceived = true;
// send email
$send_email = true;
}
}
// save the order
if (!$order->save()) {
$errors[] = $order->getError();
}
// save the orderpayment
if (!$orderpayment->save()) {
$errors[] = $orderpayment->getError();
}
if (!empty($setOrderPaymentReceived)) {
$this->setOrderPaymentReceived($orderpayment->order_id);
}
if ($send_email) {
// send notice of new order
Tienda::load("TiendaHelperBase", 'helpers._base');
$helper = TiendaHelperBase::getInstance('Email');
$model = Tienda::getClass("TiendaModelOrders", "models.orders");
$model->setId($orderpayment->order_id);
$order = $model->getItem();
$helper->sendEmailNotices($order, 'new_order');
}
return count($errors) ? implode("\n", $errors) : '';
}
示例11: _getProcessVars
/**
* Prepares parameters for the payment processing
*
* @param object $data Post variables
* @return array
* @access protected
*/
function _getProcessVars($data)
{
$merchant_id = $this->merchant_id;
$merchant_key = $this->merchant_key;
// for now, we impomenet only standard payment method
$paymenttype = '01';
// joomla info
$user = JFactory::getUser();
$sagepayments_userid = $user->id;
// order info
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tienda/tables');
$order = JTable::getInstance('Orders', 'TiendaTable');
$order->load($data['order_id']);
$orderpayment = JTable::getInstance('OrderPayments', 'TiendaTable');
$orderpayment->load($data['orderpayment_id']);
$orderinfo = JTable::getInstance('OrderInfo', 'TiendaTable');
$orderinfo->load(array('order_id' => $data['order_id']));
$billingzone = JTable::getInstance('Zones', 'TiendaTable');
$billingzone->load($orderinfo->billing_zone_id);
$currency = JTable::getInstance('Currencies', 'TiendaTable');
$currency->load(array('currency_id' => $order->currency_id));
$country = JTable::getInstance('Countries', 'TiendaTable');
$country->load(array('country_id' => $orderinfo->billing_country_id));
Tienda::load('TiendaHelperBase', 'helpers._base');
$sagepayments_description = JText::_('COM_TIENDA_ORDER_NUMBER') . ": " . $order->order_id;
$sagepayments_amount = TiendaHelperBase::number($orderpayment->orderpayment_amount, array('thousands' => ''));
$sagepayments_invoice_num = $data['orderpayment_id'];
// customer information
$sagepayments_fname = $orderinfo->billing_first_name;
$sagepayments_lname = $orderinfo->billing_last_name;
$sagepayments_address1 = substr($orderinfo->billing_address_1, 0, 100);
$sagepayments_address2 = substr($orderinfo->billing_address_2, 0, 100);
$sagepayments_address = $sagepayments_address1;
if (!empty($sagepayments_address2)) {
$sagepayments_address .= $sagepayments_address2;
}
$sagepayments_city = $orderinfo->billing_city;
$sagepayments_zip = $orderinfo->billing_postal_code;
$sagepayments_country = $country->country_isocode_2;
$sagepayments_state = $billingzone->code;
$sagepayments_card_num = str_replace(" ", "", str_replace("-", "", $data['cardnum']));
$sagepayments_phone = $orderinfo->billing_phone_1;
$sagepayments_exp_date = $this->_getFormattedCardDate('my', $data['cardexp']);
$sagepayments_useremail = empty($orderinfo->user_email) ? $user->email : $orderinfo->user_email;
// put all values into an array (does not support Gift Aid Payment)
$sagepayments_values = array("T_code" => $paymenttype, "M_id" => $merchant_id, "M_key" => $merchant_key, "T_amt" => $sagepayments_amount, "T_ordernum" => $order->order_id, "C_name" => $data['cardholder'], "C_cardnumber" => $sagepayments_card_num, "C_exp" => $sagepayments_exp_date, "C_cvv" => $data['cardcv2'], "C_address" => $sagepayments_address, "C_city" => $sagepayments_city, "C_state" => $sagepayments_state, "C_zip" => $sagepayments_zip, "C_email" => $sagepayments_useremail);
return $sagepayments_values;
}
示例12: _processSubscription
/**
* Processes the recurring payment
*
* @param array $data Payment data
* @param object $user
* @param string $payment_details Formatted payment details to store
* @param array $errors
* @return array
* @access protected
*/
function _processSubscription($data, $errors)
{
$keyarray = $data;
$keyarray['status'] = $this->_getMBStatus($data['status']);
$payment_details = $this->_getFormattedPaymentDetails($keyarray);
// check that payment amount is correct for order_id
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tienda/tables');
$orderpayment = JTable::getInstance('OrderPayments', 'TiendaTable');
$orderpayment->load($data['orderpayment_id']);
if (empty($orderpayment->order_id)) {
$errors[] = JText::_('TIENDA MONEYBOOKERS MESSAGE INVALID ORDER');
$this->_sendErrorEmails($error, 'A18 -' . $data['orderpayment_id']);
}
$orderpayment->transaction_details = $payment_details;
$orderpayment->transaction_id = $data['rec_payment_id'];
$orderpayment->transaction_status = $this->_getMBStatus($data['status']);
Tienda::load('TiendaHelperBase', 'helpers._base');
$stored_amount = TiendaHelperBase::number($orderpayment->get('orderpayment_amount'), array('thousands' => ''));
$respond_amount = TiendaHelperBase::number($data['amount'], array('thousands' => ''));
if ($stored_amount != $respond_amount) {
$errors[] = JText::_('TIENDA MONEYBOOKERS MESSAGE PAYMENT AMOUNT INVALID');
$errors[] = $stored_amount . " != " . $respond_amount;
$this->_sendErrorEmails($error, 'A19 -' . $stored_amount . " != " . $respond_amount);
}
// set the order's new status and update quantities if necessary
Tienda::load('TiendaHelperOrder', 'helpers.order');
Tienda::load('TiendaHelperCarts', 'helpers.carts');
$order = JTable::getInstance('Orders', 'TiendaTable');
$order->load($orderpayment->order_id);
if (count($errors)) {
// if an error occurred
$order->order_state_id = $this->_getParam('failed_order_state', '10');
// FAILED
} else {
$order->order_state_id = $this->_getParam('payment_received_order_state', '17');
// PAYMENT RECEIVED
// do post payment actions
$setOrderPaymentReceived = true;
// send email
$send_email = false;
// make subscription
$subscription = true;
}
// save the order
if (!$order->save()) {
$errors[] = $order->getError();
}
// save the orderpayment
if (!$orderpayment->save()) {
$errors[] = $orderpayment->getError();
}
if (!empty($setOrderPaymentReceived)) {
$this->setOrderPaymentReceived($orderpayment->order_id);
}
if ($send_email) {
// send notice of new order
Tienda::load("TiendaHelperBase", 'helpers._base');
$helper = TiendaHelperBase::getInstance('Email');
$model = Tienda::getClass("TiendaModelOrders", "models.orders");
$model->setId($orderpayment->order_id);
$order_email = $model->getItem();
$helper->sendEmailNotices($order_email, 'new_order');
}
if ($subscription) {
// is the recipient correct?
if (empty($data['pay_to_email']) || $data['pay_to_email'] != $this->_getParam('receiver_email')) {
$errors[] = JText::_('TIENDA MONEYBOOKERS MESSAGE RECEIVER INVALID');
}
// if no subscription exists for this subscr_id,
// create new subscription for the user
$subscription = JTable::getInstance('Subscriptions', 'TiendaTable');
$subscription->load(array('transaction_id' => $data['rec_payment_id']));
if (empty($subscription->subscription_id)) {
$date = JFactory::getDate();
// create new subscription
// if recurring trial, set it
// for the order's recurring_trial_period_interval
// using its recurring_trial_period_unit
// otherwise, do the normal recurring_period_interval
// and the recurring_period_unit
$recurring_period_unit = $order->recurring_period_unit;
$recurring_period_interval = $order->recurring_period_interval;
if (!empty($order->recurring_trial)) {
$recurring_period_unit = $order->recurring_trial_period_unit;
$recurring_period_interval = $order->recurring_trial_period_interval;
}
error_reporting(E_ALL);
//$items = $order->getItems();
// $item = $items[0];
$items = $order->getItems();
//.........这里部分代码省略.........
示例13: _evaluateSimplePaymentResponse
//.........这里部分代码省略.........
case 58:
case 59:
case 60:
case 61:
case 62:
case 63:
case 64:
case 65:
case 66:
case 67:
case 68:
// Reserved by auth.net
break;
default:
// if here, then $key is not one of the reserved 68 fields
// we're now processing custom fields sent through auth.net and back to us
// such as itemTypeid, paymentType, and cardtype
switch ($key) {
case "tienda_orderpayment_id":
$orderpayment_id = $value;
break;
default:
// orphan key
break;
}
break;
}
}
// orderpayment_id is always in this part of the response
$orderpayment_id = $exploded[69];
// =======================
// verify & create payment
// =======================
// check that payment amount is correct for order_id
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tienda/tables');
$orderpayment = JTable::getInstance('OrderPayments', 'TiendaTable');
$orderpayment->load($orderpayment_id);
if (empty($orderpayment->order_id)) {
// TODO fail
}
$orderpayment->transaction_details = $resp;
$orderpayment->transaction_id = $transactionidResponse;
$orderpayment->transaction_status = $paymentResponse;
Tienda::load('TiendaHelperBase', 'helpers._base');
$stored_amount = TiendaHelperBase::number($orderpayment->get('orderpayment_amount'), array('thousands' => ''));
$respond_amount = TiendaHelperBase::number($amountResponse, array('thousands' => ''));
if ($stored_amount != $respond_amount) {
$errors[] = JText::_('COM_TIENDA_TIENDA_AUTHORIZEDOTNET_MESSAGE_PAYMENT_AMOUNT_INVALID');
$errors[] = $stored_amount . " != " . $respond_amount;
}
// set the order's new status and update quantities if necessary
Tienda::load('TiendaHelperOrder', 'helpers.order');
Tienda::load('TiendaHelperCarts', 'helpers.carts');
$order = JTable::getInstance('Orders', 'TiendaTable');
$order->load($orderpayment->order_id);
if (count($errors)) {
// if an error occurred
$order->order_state_id = $this->params->get('failed_order_state', '10');
// FAILED
} else {
$order->order_state_id = $this->params->get('payment_received_order_state', '17');
// PAYMENT RECEIVED
// do post payment actions
$setOrderPaymentReceived = true;
// send email
$send_email = true;
}
// save the order
if (!$order->save()) {
$errors[] = $order->getError();
}
// save the orderpayment
if (!$orderpayment->save()) {
$errors[] = $orderpayment->getError();
}
if (!empty($setOrderPaymentReceived)) {
$this->setOrderPaymentReceived($orderpayment->order_id);
}
if ($send_email) {
// send notice of new order
Tienda::load("TiendaHelperBase", 'helpers._base');
$helper = TiendaHelperBase::getInstance('Email');
$model = Tienda::getClass("TiendaModelOrders", "models.orders");
$model->setId($orderpayment->order_id);
$order = $model->getItem();
$helper->sendEmailNotices($order, 'new_order');
}
if (empty($errors)) {
$return = JText::_('COM_TIENDA_TIENDA_AUTHORIZEDOTNET_MESSAGE_PAYMENT_SUCCESS');
return $return;
}
if (!empty($errors)) {
$string = implode("\n", $errors);
$return = "<div class='note_pink'>" . $string . "</div>";
return $return;
}
// ===================
// end custom code
// ===================
}
示例14: getUpdateXML
/**
* Generates the xml for the update request
* @param unknown_type $product
* @param string $etag - etag of the product
*/
protected function getUpdateXML($product, $etag)
{
// perform the insertion
Tienda::load('TiendaArrayToXML', 'library.xml');
// Populate the xml request
$xml = array();
$xml['app:control']['sc:required_destination']['attributes']['dest'] = 'ProductSearch';
// Title, id and description
$xml['title'] = $product->product_name;
$xml['content']['attributes']['type'] = 'text/html';
$xml['content'] = $product->product_description;
$xml['sc:id'] = $product->product_id;
// Link to the product
Tienda::load('TiendaHelperRoute', 'helpers.route');
$xml['link']['attributes']['rel'] = 'alternate';
$xml['link']['attributes']['type'] = 'text/html';
$baseurl = str_replace("/administrator/", "/", JURI::base());
$xml['link']['attributes']['href'] = $baseurl . TiendaHelperRoute::product($product->product_id);
//$xml['link']['attributes']['href'] = 'http://www.weble.it/products/'.$product->product_id;
// Condition
$xml['scp:condition'] = 'new';
// Price
$currency_id = Tienda::getInstance()->get('default_currencyid', '1');
Tienda::load('TiendaTableCurrencies', 'tables.currencies');
$currency = JTable::getInstance('Currencies', 'TiendaTable');
$currency->load((int) $currency_id);
$xml['scp:price']['attributes']['unit'] = trim(strtoupper($currency->currency_code));
$xml['scp:price']['@value'] = TiendaHelperBase::number(TiendaHelperProduct::getPrice($product->product_id)->product_price, array('num_decimals', '0'));
// Manufacturer
Tienda::load('TiendaTableManufacturers', 'tables.manufacturers');
$manufacturer = JTable::getInstance('Manufacturers', 'TiendaTable');
if ($manufacturer->load($product->manufacturer_id)) {
$xml['scp:brand'] = $manufacturer->manufacturer_name;
}
$xml['entry']['attributes']['gd:etag'] = $etag;
// Create the request
$null = null;
$helper = new TiendaArrayToXML();
$ns = array(array('name' => 'app', 'url' => "http://www.w3.org/2007/app"), array('name' => 'gd', 'url' => "http://schemas.google.com/g/2005"), array('name' => 'sc', 'url' => "http://schemas.google.com/structuredcontent/2009"), array('name' => 'scp', 'url' => "http://schemas.google.com/structuredcontent/2009/products"));
$xml = $helper->toXml($xml, 'entry', $null, $ns, "http://www.w3.org/2005/Atom");
return $xml;
}
示例15: _processSale
/**
* Processes the sale payment
*
* @param array $data IPN data
* @return boolean Did the IPN Validate?
* @access protected
*/
public function _processSale($data)
{
/*
* validate the payment data
*/
$errors = array();
$payment_id = JFactory::getSession()->get('paypal_pro.orderpayment.id', 0);
// load the orderpayment record and set some values
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tienda/tables');
$orderpayment = JTable::getInstance('OrderPayments', 'TiendaTable');
$orderpayment->load($payment_id);
ob_start();
print_r($data);
$orderpayment->transaction_details = ob_get_contents();
ob_end_clean();
$orderpayment->transaction_id = $data['PNREF'];
$orderpayment->transaction_status = $data['RESPMSG'];
// check the stored amount against the payment amount
Tienda::load('TiendaHelperBase', 'helpers._base');
$stored_amount = TiendaHelperBase::number($orderpayment->get('orderpayment_amount'), array('thousands' => ''));
$respond_amount = TiendaHelperBase::number($data['AMT'], array('thousands' => ''));
if ($stored_amount != $respond_amount) {
$errors[] = JText::_('PLG_TIENDA_PAYMENT_PAYPALPRO_MESSAGE_AMOUNT_INVALID');
$errors[] = $stored_amount . " != " . $respond_amount;
}
// supported error codes
$supported_errors = array(0, 1, 2, 12, 30);
// check the payment status
if (empty($data['RESULT']) || (int) $data['RESULT'] > 0) {
// dad, we've got a problem
$data['RESULT'] = (int) $data['RESULT'];
if (in_array($data['RESULT'], $supported_errors) === false) {
// unknown error => just play innocent and blame it on Paypal :)
$errors[] = JText::sprintf('PLG_TIENDA_PAYMENT_PAYPALPRO_MESSAGE_STATUS_INVALID', @$data['RESULT']);
} else {
// OK, so this is a common error, so display a cool message
switch ($data['RESULT']) {
case 1:
$errors[] = JText::_('PLG_TIENDA_PAYMENT_PAYPALPRO_MESSAGE_USER_AUTH_FAILED');
break;
case 2:
$errors[] = JText::_('PLG_TIENDA_PAYMENT_PAYPALPRO_MESSAGE_TENDER_INVALID');
break;
case 12:
$errors[] = JText::_('PLG_TIENDA_PAYMENY_PAYPALPRO_MESSAGE_OPERATION_DECLINED');
break;
case 30:
$errors[] = JText::_('PLG_TIENDA_PAYMENT_PAYPALPRO_MESSAGE_DUPLICATE_TRANSACTION');
break;
}
}
}
// set the order's new status and update quantities if necessary
Tienda::load('TiendaHelperOrder', 'helpers.order');
Tienda::load('TiendaHelperCarts', 'helpers.carts');
$tbl_order = JTable::getInstance('Orders', 'TiendaTable');
$tbl_order->load($orderpayment->order_id);
if (count($errors)) {
// if an error occurred
$tbl_order->order_state_id = $this->params->get('failed_order_state', '10');
// FAILED
} else {
// we received the payment
$tbl_order->order_state_id = $this->params->get('payment_received_order_state', '17');
// PAYMENT RECEIVED
// do post payment actions
$this->setOrderPaymentReceived($orderpayment->order_id);
// send notice of new order
Tienda::load("TiendaHelperBase", 'helpers._base');
$helper = TiendaHelperBase::getInstance('Email');
$model = Tienda::getClass("TiendaModelOrders", "models.orders");
$model->setId($orderpayment->order_id);
$order = $model->getItem();
$helper->sendEmailNotices($order, 'new_order');
}
// save the order
if (!$tbl_order->save()) {
$errors[] = $tbl_order->getError();
}
// save the orderpayment
if (!$orderpayment->save()) {
$errors[] = $orderpayment->getError();
}
return count($errors) ? implode("\n", $errors) : '';
}