本文整理汇总了PHP中Mage_Sales_Model_Order::getPayment方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order::getPayment方法的具体用法?PHP Mage_Sales_Model_Order::getPayment怎么用?PHP Mage_Sales_Model_Order::getPayment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Order
的用法示例。
在下文中一共展示了Mage_Sales_Model_Order::getPayment方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isPPP
/**
* Check if last order is PayPalPlus
* @return bool
*/
public function isPPP()
{
if ($this->_order->getPayment()->getMethodInstance()->getCode() == self::IWAYS_PAYPALPLUS_PAYMENT) {
return true;
}
return false;
}
示例2: canMakePayment
/**
* Check if can make payment for order
*
* @param Mage_Sales_Model_Order $order
* @return bool
*/
public function canMakePayment($order)
{
if ($order->getPayment() && $order->getPayment()->getMethod() == 'purchaseorder' && $order->canShip()) {
return false;
}
if ($order->getStatus() != 'purchaseorder_pending_payment') {
return false;
}
if (!$order->canInvoice()) {
return false;
}
return true;
}
示例3: _addCreditManagement
/**
* Add credit management required fields to the request
*
* @param $vars
* @param string $serviceName
* @return mixed
*/
protected function _addCreditManagement(&$vars, $serviceName = 'creditmanagement')
{
$method = $this->_order->getPayment()->getMethod();
$dueDaysInvoice = Mage::getStoreConfig('buckaroo/' . $method . '/due_date_invoice', $this->getStoreId());
$dueDays = Mage::getStoreConfig('buckaroo/' . $method . '/due_date', $this->getStoreId());
$invoiceDate = date('Y-m-d', mktime(0, 0, 0, date("m"), date("d") + $dueDaysInvoice, date("Y")));
$dueDate = date('Y-m-d', mktime(0, 0, 0, date("m"), date("d") + $dueDaysInvoice + $dueDays, date("Y")));
if (array_key_exists('customVars', $vars) && array_key_exists($serviceName, $vars['customVars']) && is_array($vars['customVars'][$serviceName])) {
$vars['customVars'][$serviceName] = array_merge($vars['customVars'][$serviceName], array('DateDue' => $dueDate, 'InvoiceDate' => $invoiceDate));
} else {
$vars['customVars'][$serviceName] = array('DateDue' => $dueDate, 'InvoiceDate' => $invoiceDate);
}
return $vars;
}
示例4: updatePaymentStatus
/**
* Update payment status
*
* @param $paymentStatus
* @param $payUOrderStatus
*/
protected function updatePaymentStatus($paymentStatus, $payUOrderStatus)
{
$payment = $this->_order->getPayment();
$currentState = $payment->getAdditionalInformation('payu_payment_status');
if ($currentState == self::ORDER_V2_COMPLETED && $paymentStatus == self::ORDER_V2_PENDING || $currentState == self::ORDER_V2_COMPLETED && $paymentStatus == self::ORDER_V2_COMPLETED) {
return;
}
if ($currentState != $paymentStatus) {
try {
switch ($paymentStatus) {
case self::ORDER_V2_NEW:
$this->updatePaymentStatusNew($payment);
break;
case self::ORDER_V2_PENDING:
$this->updatePaymentStatusPending($payment);
break;
case self::ORDER_V2_CANCELED:
$this->updatePaymentStatusCanceled($payment);
break;
case self::ORDER_V2_REJECTED:
$this->updatePaymentStatusDenied($payment);
break;
case self::ORDER_V2_COMPLETED:
$this->updatePaymentStatusCompleted($payment);
break;
}
// set current PayU status information and save
$payment->setAdditionalInformation('payu_payment_status', $paymentStatus)->save();
} catch (Exception $e) {
Mage::logException($e);
}
}
}
示例5: updateByTransactionStatus
/**
* @param Mage_Sales_Model_Order $order
* @param Payone_Core_Model_Domain_Protocol_TransactionStatus $transactionStatus
* @return void
*/
public function updateByTransactionStatus(Mage_Sales_Model_Order $order, Payone_Core_Model_Domain_Protocol_TransactionStatus $transactionStatus)
{
// Update Status of Transaction
$order->setPayoneTransactionStatus($transactionStatus->getTxaction());
// Update dunning status
if ($transactionStatus->getReminderlevel()) {
$order->setPayoneDunningStatus($transactionStatus->getReminderlevel());
}
// Status mapping of Order by Transaction Status
$statusMapping = $this->getConfigStore()->getGeneral()->getStatusMapping();
$txAction = $transactionStatus->getTxaction();
/**
* @var $paymentMethod Payone_Core_Model_Payment_Method_Abstract
*/
$paymentMethod = $order->getPayment()->getMethodInstance();
$type = $paymentMethod->getMethodType();
// Mapping
$mapping = $statusMapping->getByType($type);
if (!is_array($mapping) or !array_key_exists($txAction, $mapping)) {
return;
}
// Check for valid Mapping
$mappingOrderState = $mapping[$txAction];
if (!is_array($mappingOrderState) or !array_key_exists('status', $mappingOrderState) or !array_key_exists('state', $mappingOrderState)) {
return;
}
// Get State / Status and set to Order
$newOrderState = $mappingOrderState['state'];
$newOrderStatus = $mappingOrderState['status'];
if ($newOrderState != '') {
$order->setState($newOrderState, $newOrderStatus);
} else {
$order->setStatus($newOrderStatus);
}
}
示例6: _getButtonsHtml
protected function _getButtonsHtml(SM_Vendors_Model_Order $vendorOrder, Mage_Sales_Model_Order $order, $vendorId)
{
$buttonGroups = array();
$urlParams = array('order_id' => $order->getId(), 'do_as_vendor' => $vendorId);
if ($vendorOrder->canCancel()) {
$message = Mage::helper('sales')->__('Are you sure you want to cancel this order?');
$button = $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array('id' => 'order_cancel_' . $vendorId, 'label' => Mage::helper('sales')->__('Cancel'), 'onclick' => 'deleteConfirm(\'' . $message . '\', \'' . $this->getUrl('*/vendors_order/cancel', $urlParams) . '\')'));
$buttonGroups[] = $button->toHtml();
}
if ($vendorOrder->canInvoice()) {
$_label = $order->getForcedDoShipmentWithInvoice() ? Mage::helper('sales')->__('Invoice and Ship') : Mage::helper('sales')->__('Invoice');
$button = $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array('id' => 'order_invoice_' . $vendorId, 'label' => $_label, 'onclick' => 'setLocation(\'' . $this->getUrl('*/vendors_order_invoice/start', $urlParams) . '\')', 'class' => 'go'));
$buttonGroups[] = $button->toHtml();
}
if ($vendorOrder->canShip() && !$order->getForcedDoShipmentWithInvoice()) {
$button = $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array('id' => 'order_ship_' . $vendorId, 'label' => Mage::helper('sales')->__('Ship'), 'onclick' => 'setLocation(\'' . $this->getUrl('*/vendors_order_shipment/new', $urlParams) . '\')', 'class' => 'go'));
$buttonGroups[] = $button->toHtml();
}
if ($vendorOrder->canCreditmemo()) {
$message = Mage::helper('sales')->__('This will create an offline refund. To create an online refund, open an invoice and create credit memo for it. Do you wish to proceed?');
$urlParams['_current'] = true;
$creditMemoUrl = $this->getUrl('*/vendors_order_creditmemo/new', $urlParams);
$onClick = "setLocation('{$creditMemoUrl}')";
if ($order->getPayment()->getMethodInstance()->isGateway()) {
$onClick = "confirmSetLocation('{$message}', '{$creditMemoUrl}')";
}
$button = $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array('id' => 'order_creditmemo_' . $vendorId, 'label' => Mage::helper('sales')->__('Credit Memo'), 'onclick' => $onClick, 'class' => 'go'));
$buttonGroups[] = $button->toHtml();
}
if (!empty($buttonGroups)) {
return '<p class="form-buttons">' . implode("\n", $buttonGroups) . '</p>';
} else {
return '';
}
}
开发者ID:shashankkanungo,项目名称:magento,代码行数:35,代码来源:SM_Vendors_Block_Adminhtml_Sales_Order_View_Items.php
示例7: getOrder
/**
*
* @return Mage_Sales_Model_Order
*/
protected function getOrder()
{
if (is_null($this->_order)) {
if ($profileIds = $this->getCheckout()->getLastRecurringProfileIds()) {
if (is_array($profileIds)) {
foreach ($profileIds as $profileId) {
/* @var $profile Mage_Sales_Model_Recurring_Profile */
$profile = Mage::getModel('sales/recurring_profile')->load($profileId);
/* @var $_helperRecurring Allopass_Hipayrecurring_Helper_Data */
$_helperRecurring = Mage::helper('hipayrecurring');
if ($_helperRecurring->isInitialProfileOrder($profile)) {
$this->_order = $_helperRecurring->createOrderFromProfile($profile);
} else {
$orderId = current($profile->getChildOrderIds());
$this->_order = Mage::getModel('sales/order')->load($orderId);
$additionalInfo = $profile->getAdditionalInfo();
$this->_order->getPayment()->setCcType(isset($additionalInfo['ccType']) ? $additionalInfo['ccType'] : "");
$this->_order->getPayment()->setCcExpMonth(isset($additionalInfo['ccExpMonth']) ? $additionalInfo['ccExpMonth'] : "");
$this->_order->getPayment()->setCcExpYear(isset($additionalInfo['ccExpYear']) ? $additionalInfo['ccExpYear'] : "");
$this->_order->getPayment()->setAdditionalInformation('token', isset($additionalInfo['token']) ? $additionalInfo['token'] : "");
$this->_order->getPayment()->setAdditionalInformation('create_oneclick', isset($additionalInfo['create_oneclick']) ? $additionalInfo['create_oneclick'] : 1);
$this->_order->getPayment()->setAdditionalInformation('use_oneclick', isset($additionalInfo['use_oneclick']) ? $additionalInfo['use_oneclick'] : 0);
$this->_order->getPayment()->setAdditionalInformation('selected_oneclick_card', isset($additionalInfo['selected_oneclick_card']) ? $additionalInfo['selected_oneclick_card'] : 0);
}
return $this->_order;
//because only one nominal item in cart is authorized and Hipay not manage many profiles
}
}
Mage::throwException("An error occured. Profile Ids not present!");
} else {
$this->_order = Mage::getModel('sales/order')->load($this->getCheckout()->getLastOrderId());
}
}
return $this->_order;
}
示例8: prepareValues
public function prepareValues(Mage_Sales_Model_Order $order)
{
$billing_address = $order->getBillingAddress();
$additional_data = unserialize($order->getPayment()->getAdditionalData());
$code_banco = $additional_data['code_banco'];
$data_vencimento = $additional_data['data_vencimento'];
$numero_boleto = str_replace('-', '', $order->getIncrementId());
$strtotime = strtotime($order->getCreatedAt());
$data = array('logoempresa' => $this->getConfig('logoempresa'), 'nosso_numero' => $numero_boleto, 'numero_documento' => $numero_boleto, 'data_vencimento' => $data_vencimento, 'data_documento' => date('d/m/Y', $strtotime), 'data_processamento' => date('d/m/Y', $strtotime), 'valor_boleto' => number_format($order->getGrandTotal() + $this->getLayoutConfig($code_banco, 'valor_adicional'), 2, ',', ''), 'valor_unitario' => number_format($order->getGrandTotal() + $this->getLayoutConfig($code_banco, 'valor_adicional'), 2, ',', ''), 'sacado' => $billing_address->getFirstname() . ' ' . $billing_address->getLastname(), 'sacadocpf' => $order->getCustomerTaxvat(), 'endereco1' => implode(' ', $billing_address->getStreet()), 'endereco2' => $billing_address->getCity() . ' - ' . $billing_address->getRegion() . ' - CEP: ' . $billing_address->getPostcode(), 'identificacao' => $this->getLayoutConfig($code_banco, 'identificacao'), 'cpf_cnpj' => $this->getLayoutConfig($code_banco, 'cpf_cnpj'), 'endereco' => $this->getLayoutConfig($code_banco, 'endereco'), 'cidade_uf' => $this->getLayoutConfig($code_banco, 'cidade_uf'), 'cedente' => $this->getLayoutConfig($code_banco, 'cedente'), 'agencia' => $this->getLayoutConfig($code_banco, 'agencia'), 'agencia_dv' => $this->getLayoutConfig($code_banco, 'agencia_dv'), 'conta' => $this->getLayoutConfig($code_banco, 'conta'), 'conta_dv' => $this->getLayoutConfig($code_banco, 'conta_dv'), 'carteira' => $this->getLayoutConfig($code_banco, 'carteira'), 'especie' => $this->getLayoutConfig($code_banco, 'especie'), 'especie_doc' => $this->getLayoutConfig($code_banco, 'especie_doc'), 'aceite' => $this->getLayoutConfig($code_banco, 'aceite'), 'quantidade' => $this->getLayoutConfig($code_banco, 'quantidade'));
if ($code_banco == 'santander_banespa') {
$data['ponto_venda'] = $this->getLayoutConfig($code_banco, 'ponto_venda');
$data['carteira_descricao'] = $this->getLayoutConfig($code_banco, 'carteira_descricao');
$data['codigo_cliente'] = $this->getLayoutConfig($code_banco, 'codigo_cliente');
}
if ($code_banco == 'bradesco') {
$data['conta_cedente'] = $this->getLayoutConfig($code_banco, 'conta_cedente');
$data['conta_cedente_dv'] = $this->getLayoutConfig($code_banco, 'conta_cedente_dv');
}
if ($code_banco == 'cef' || $code_banco == 'cef_sinco' || $code_banco == 'cef_sigcb') {
$data['conta_cedente_caixa'] = $this->getLayoutConfig($code_banco, 'conta_cedente_caixa');
$data['conta_cedente_dv_caixa'] = $this->getLayoutConfig($code_banco, 'conta_cedente_dv_caixa');
$data['inicio_nosso_numero'] = $this->getLayoutConfig($code_banco, 'inicio_nosso_numero');
}
if ($code_banco == 'bb') {
$data['convenio'] = $this->getLayoutConfig($code_banco, 'convenio');
$data['contrato'] = $this->getLayoutConfig($code_banco, 'contrato');
$data['variacao_carteira'] = $this->getLayoutConfig($code_banco, 'variacao_carteira');
$data['formatacao_convenio'] = $this->getLayoutConfig($code_banco, 'formatacao_convenio');
$data['formatacao_nosso_numero'] = $this->getLayoutConfig($code_banco, 'formatacao_nosso_numero');
}
if ($code_banco == 'hsbc') {
$data['codigo_cedente'] = $this->getLayoutConfig($code_banco, 'codigo_cedente');
}
if ($code_banco == 'cef_sinco') {
$data['campo_fixo_obrigatorio'] = $this->getLayoutConfig($code_banco, 'campo_fixo_obrigatorio');
}
if ($code_banco == 'cef_sigcb') {
$data['nosso_numero1'] = $this->getLayoutConfig($code_banco, 'nosso_numero1');
$data['nosso_numero_const1'] = $this->getLayoutConfig($code_banco, 'nosso_numero_const1');
$data['nosso_numero2'] = $this->getLayoutConfig($code_banco, 'nosso_numero2');
$data['nosso_numero_const2'] = $this->getLayoutConfig($code_banco, 'nosso_numero_const2');
$data['nosso_numero3'] = $numero_boleto;
}
if ($code_banco == 'sicoob') {
$data['convenio'] = $this->getLayoutConfig($code_banco, 'codigo_cedente');
$data["numero_parcela"] = '001';
}
$instrucoes = explode("\n", $this->getLayoutConfig($code_banco, 'instrucoes_boleto'));
for ($i = 0; $i < 4; $i++) {
$instrucao = isset($instrucoes[$i]) ? $instrucoes[$i] : '';
$data['instrucoes' . ($i + 1)] = $instrucao;
}
$info = sprintf($this->getLayoutConfig($code_banco, 'informacoes'), $order->getIncrementId());
$informacoes = explode("\n", $info);
for ($i = 0; $i < 3; $i++) {
$informacao = isset($informacoes[$i]) ? $informacoes[$i] : '';
$data['demonstrativo' . ($i + 1)] = $informacao;
}
return $data;
}
示例9: cancelaPedido
public function cancelaPedido(Mage_Sales_Model_Order $order)
{
$paymentMethod = $order->getPayment()->getMethodInstance()->getCode();
$listPaymentMethodsIdeasa = Mage::helper('base')->listPaymentMethods();
$this->logger->info('Processando cancelamento do pedido ' . $order->getRealOrderId() . ', do modulo: ' . $paymentMethod);
try {
if ($order->getState() != Mage_Sales_Model_Order::STATE_CANCELED) {
$order->cancel();
//força o cancelamento
if ($order->getStatus() != Mage_Sales_Model_Order::STATE_CANCELED) {
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, true, Mage::helper('base')->__('Pedido cancelado'), $notified = false);
} else {
$order->addStatusToHistory($order->getStatus(), Mage::helper('base')->__('Pedido cancelado.'));
}
if ($order->hasInvoices() != '') {
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, true, Mage::helper('base')->__('O pagamento e o pedido foram cancelados, mas não foi possível retornar os produtos ao estoque pois já havia uma fatura gerada para este pedido.'), $notified = false);
}
$order->save();
}
if (Mage::helper('base')->isIdeasaPaymentMethod($paymentMethod) && Mage::helper('base/module')->isPagSeguroDiretoExists() && $paymentMethod == $listPaymentMethodsIdeasa[0]) {
Mage::getModel('pagsegurodireto/notification')->sendEmail($order);
}
} catch (Exception $e) {
$this->logger->error("Erro ao cancelar pedido {$orderId} \n {$e->__toString}()");
}
$this->logger->info('Cancelamento do pedido foi concluido ' . $order->getRealOrderId() . ', do modulo: ' . $paymentMethod);
return;
}
示例10: _canVoid
/**
* Check if we can void the PayPal payment method in this order.
*
* @param Mage_Sales_Model_Order $order
* @return bool
*/
protected function _canVoid(Mage_Sales_Model_Order $order)
{
$payment = $order->getPayment();
if (!$payment instanceof Mage_Sales_Model_Order_Payment) {
return false;
}
$methodInstance = $payment->getMethodInstance();
return $methodInstance instanceof EbayEnterprise_Paypal_Model_Method_Express && $methodInstance->canVoid($payment);
}
示例11: _processTransactionExpired
/**
* Cancels an order after the period for payment elapsed.
*/
protected function _processTransactionExpired()
{
$payment = $this->_order->getPayment();
if ($transaction = $payment->getTransaction($this->_receivedData['transaction_id'])) {
$transaction->close();
}
$this->_order->registerCancellation($this->_createIpnComment(), false)->save();
$this->_order->sendOrderUpdateEmail(true, $this->_createIpnComment());
}
示例12: updateOrderContext
/**
* Add PayPal context information to the payload
* @param Mage_Sales_Model_Order $order
* @param IOrderContext $context
* @return self
*/
public function updateOrderContext(Mage_Sales_Model_Order $order, IOrderContext $context)
{
$payment = $order->getPayment();
if ($payment->getMethod() === Mage::getModel('ebayenterprise_paypal/method_express')->getCode()) {
$additionalInfo = new Varien_Object($payment->getAdditionalInformation());
$context->setPayPalPayerId($additionalInfo->getPaypalExpressCheckoutPayerId())->setPayPalPayerStatus($additionalInfo->getPaypalExpressCheckoutPayerStatus())->setPayPalAddressStatus($additionalInfo->getPaypalExpressCheckoutAddressStatus());
}
return $this;
}
示例13: writePoNumber
/**
* Write purchase order info to order
* @param Mage_Sales_Model_Order $order
* @param XMLWriter $xml
*/
public function writePoNumber($order, $xml)
{
$payment = $order->getPayment();
$xml->startElement('PO');
if ($payment) {
$xml->writeCdata($payment->getPoNumber());
}
$xml->endElement();
}
示例14: _validateEventData
/**
* Checking returned parameters
* Thorws Mage_Core_Exception if error
* @param bool $fullCheck Whether to make additional validations such as payment status, transaction signature etc.
*
* @return array $params request params
*/
protected function _validateEventData($fullCheck = true)
{
// get request variables
$params = $this->_eventData;
if (empty($params)) {
Mage::throwException('Request does not contain any elements.');
}
// check order ID
if (empty($params['transaction_id']) || $fullCheck == false && $this->_getCheckout()->getMoneybookersRealOrderId() != $params['transaction_id']) {
Mage::throwException('Missing or invalid order ID.');
}
// load order for further validation
$this->_order = Mage::getModel('sales/order')->loadByIncrementId($params['transaction_id']);
if (!$this->_order->getId()) {
Mage::throwException('Order not found.');
}
if (0 !== strpos($this->_order->getPayment()->getMethodInstance()->getCode(), 'moneybookers_')) {
Mage::throwException('Unknown payment method.');
}
// make additional validation
if ($fullCheck) {
// check payment status
if (empty($params['status'])) {
Mage::throwException('Unknown payment status.');
}
// check transaction signature
if (empty($params['md5sig'])) {
Mage::throwException('Invalid transaction signature.');
}
$checkParams = array('merchant_id', 'transaction_id', 'secret', 'mb_amount', 'mb_currency', 'status');
$md5String = '';
foreach ($checkParams as $key) {
if ($key == 'merchant_id') {
$md5String .= Mage::getStoreConfig(Phoenix_Moneybookers_Helper_Data::XML_PATH_CUSTOMER_ID, $this->_order->getStoreId());
} elseif ($key == 'secret') {
$secretKey = Mage::getStoreConfig(Phoenix_Moneybookers_Helper_Data::XML_PATH_SECRET_KEY, $this->_order->getStoreId());
if (empty($secretKey)) {
Mage::throwException('Secret key is empty.');
}
$md5String .= strtoupper(md5($secretKey));
} elseif (isset($params[$key])) {
$md5String .= $params[$key];
}
}
$md5String = strtoupper(md5($md5String));
if ($md5String != $params['md5sig']) {
Mage::throwException('Hash is not valid.');
}
// check transaction amount if currency matches
if ($this->_order->getOrderCurrencyCode() == $params['mb_currency']) {
if (round($this->_order->getGrandTotal(), 2) != $params['mb_amount']) {
Mage::throwException('Transaction amount does not match.');
}
}
}
return $params;
}
示例15: testLoadByTxnId
public function testLoadByTxnId()
{
$order = new Mage_Sales_Model_Order();
$order->loadByIncrementId('100000001');
$model = new Mage_Sales_Model_Order_Payment_Transaction();
$model->setOrderPaymentObject($order->getPayment())->loadByTxnId('invalid_transaction_id');
$this->assertNull($model->getId());
$model->loadByTxnId('trx1');
$this->assertNotNull($model->getId());
}