本文整理汇总了PHP中Varien_Event_Observer::getPayment方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Event_Observer::getPayment方法的具体用法?PHP Varien_Event_Observer::getPayment怎么用?PHP Varien_Event_Observer::getPayment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Event_Observer
的用法示例。
在下文中一共展示了Varien_Event_Observer::getPayment方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: resetPaymentCancelOrder
/**
* Called when cancelling an order.
*
* @param Varien_Event_Observer $observer
*/
public function resetPaymentCancelOrder(Varien_Event_Observer $observer)
{
/* @var $order Mage_Sales_Model_Order */
$order = $observer->getPayment()->getOrder();
/* @var $contactQueue Bronto_Order_Model_Queue */
Mage::getModel('bronto_order/queue')->getOrderRow($order->getId(), $order->getQuoteId(), $order->getStoreId())->setBrontoImported(null)->save();
}
示例2: checkPoints
public function checkPoints(Varien_Event_Observer $observer)
{
$payment = $observer->getPayment();
$paymentMethod = $observer->getPayment()->getMethod();
$customer = Mage::getSingleton('customer/session')->getCustomer();
$customerPoints = $customer->getPoints();
$orderSum = $payment->getOrder()->getGrandTotal();
if ($paymentMethod == "using_points") {
$currentSumPoints = $customerPoints - $orderSum;
$customer->setPoints($currentSumPoints);
$customer->save();
} else {
$currentSumPoints = $customerPoints + $orderSum;
$customer->setPoints($currentSumPoints);
$customer->save();
}
}
示例3: cancelPayment
/**
*
* @param Varien_Event_Observer $observer (has data 'payment' with a payment info instance (Mage_Sales_Model_Order_Payment))
*/
public function cancelPayment(Varien_Event_Observer $observer)
{
/** @var $payment Mage_Sales_Model_Order_Payment */
$payment = $observer->getPayment();
$methodInstance = $payment->getMethodInstance();
if ($methodInstance instanceof Payone_Core_Model_Payment_Method_Abstract) {
$methodInstance->cancel($payment);
}
}
示例4: sales_order_payment_refund
public function sales_order_payment_refund(Varien_Event_Observer $observer)
{
$payment = $observer->getPayment();
$creditmemo = $observer->getCreditmemo();
if (!$creditmemo->getTransactionKey()) {
$creditmemo->setTransactionKey($payment->getTransactionKey())->save();
$payment->setTransactionKey(null)->save();
//the transaction key needs to be reset after every refund
}
$order = $creditmemo->getOrder();
$this->_updateRefundedOrderStatus($creditmemo, $order, true);
return $this;
}
示例5: sales_order_payment_place_end
/**
* Adds Payment Fee to order
* @param Varien_Event_Observer $observer
*/
public function sales_order_payment_place_end(Varien_Event_Observer $observer)
{
$payment = $observer->getPayment();
if ($payment->getMethodInstance()->getCode() !== 'payexinvoice') {
return;
}
$order = $payment->getOrder();
$base_fee = $order->getQuote()->getBasePayexinvoicePaymentFee();
$fee = $order->getQuote()->getPayexinvoicePaymentFee();
$order->setBasePayexinvoicePaymentFee($base_fee);
$order->setPayexinvoicePaymentFee($fee);
$order->save();
}
示例6: getPaymentInfo
public function getPaymentInfo(Varien_Event_Observer $observer)
{
$transport = $observer->getTransport();
$payment = $observer->getPayment();
if ($payment->getAdditionalInformation('payment_currency')) {
$transport['Payment Currency'] = $payment->getAdditionalInformation('payment_currency');
}
if ($payment->getAdditionalInformation('due_amount')) {
$transport['Amount Due'] = $payment->getAdditionalInformation('due_amount');
}
if ($payment->getAdditionalInformation('exchange_rate')) {
$transport['Exchange Rate'] = $payment->getAdditionalInformation('exchange_rate');
}
return;
}
示例7: salesOrderPaymentPlaceEnd
public function salesOrderPaymentPlaceEnd(Varien_Event_Observer $observer)
{
$payment = $observer->getPayment();
if ($payment->getMethodInstance()->getCode() != 'billmateinvoice') {
return;
}
$info = $payment->getMethodInstance()->getInfoInstance();
$quote = Mage::getSingleton('checkout/session')->getQuote();
if (!$quote->getId()) {
$quote = Mage::getSingleton('adminhtml/session_quote')->getQuote();
}
//Set the invoice fee included tax value
$info->setAdditionalInformation('billmateinvoice_fee', $quote->getFeeAmount());
$info->setAdditionalInformation('billmateinvoice_fee_tax', $quote->getFeeTaxAmount());
$info->save();
}
示例8: sales_order_payment_place_end
/**
* Adds codFee to order
*
* @param Varien_Event_Observer $observer
*/
public function sales_order_payment_place_end(Varien_Event_Observer $observer)
{
$payment = $observer->getPayment();
if ($payment->getMethodInstance()->getCode() != 'cashondelivery') {
return;
}
$order = $payment->getOrder();
$quote = Mage::getSingleton('checkout/session')->getQuote();
if (!$quote->getId()) {
$quote = Mage::getSingleton('adminhtml/session_quote')->getQuote();
}
$order->setCodFee($quote->getCodFee());
$order->setBaseCodFee($quote->getBaseCodFee());
$order->setCodTaxAmount($quote->getCodTaxAmount());
$order->setBaseCodTaxAmount($quote->getBaseCodTaxAmount());
$order->save();
}
示例9: salesOrderPaymentPlaceEnd
public function salesOrderPaymentPlaceEnd(Varien_Event_Observer $observer)
{
$payment = $observer->getPayment();
if (substr($payment->getMethodInstance()->getCode(), 0, 5) != 'sisow') {
return;
}
$info = $payment->getMethodInstance()->getInfoInstance();
$quote = Mage::getSingleton('checkout/session')->getQuote();
if (!$quote->getId()) {
$quote = Mage::getSingleton('adminhtml/session_quote')->getQuote();
}
//Set the payment fee included tax value
$info->setAdditionalInformation('invoice_fee', $quote->getInvoiceFee());
$info->setAdditionalInformation('base_invoice_fee', $quote->getBaseInvoiceFee());
$info->setAdditionalInformation('invoice_fee_exluding_vat', $quote->getInvoiceFeeExcludedVat());
$info->setAdditionalInformation('base_invoice_fee_exluding_vat', $quote->getBaseInvoiceFeeExcludedVat());
//Set the payment fee tax amount
$info->setAdditionalInformation('invoice_tax_amount', $quote->getInvoiceTaxAmount());
$info->setAdditionalInformation('base_invoice_tax_amount', $quote->getBaseInvoiceTaxAmount());
//Set the payment fee rate used
$info->setAdditionalInformation('invoice_fee_rate', $quote->getInvoiceFeeRate());
$info->save();
}
示例10: salesOrderPaymentPlaceEnd
/**
* Process the seamless Payment after Order is complete
*
* @param Varien_Event_Observer $observer
*
* @throws Exception
* @return Wirecard_CheckoutSeamless_Model_Observer
*/
public function salesOrderPaymentPlaceEnd(Varien_Event_Observer $observer)
{
/** @var Mage_Checkout_Model_Session $session */
$session = Mage::getSingleton('checkout/session');
/** @var Wirecard_CheckoutSeamless_Helper_Data $helper */
$helper = Mage::helper('wirecard_checkoutseamless');
$payment = $observer->getPayment();
$this->_order = $payment->getOrder();
/** @var Wirecard_CheckoutSeamless_Model_Abstract $paymentInstance */
$paymentInstance = $payment->getMethodInstance();
if (!$paymentInstance instanceof Wirecard_CheckoutSeamless_Model_Abstract) {
return $this;
}
$init = $paymentInstance->initPayment($session->getWirecardCheckoutSeamlessStorageId(), $session->getQuoteId());
if ($init->getStatus() == WirecardCEE_QMore_Response_Initiation::STATE_SUCCESS) {
$helper->log(__METHOD__ . ':setting redirect url:' . $init->getRedirectUrl());
Mage::getSingleton('core/session')->unsWirecardCheckoutSeamlessPaymentInfo();
$session->setWirecardCheckoutSeamlessRedirectUrl($init->getRedirectUrl());
} else {
Mage::getSingleton('core/session')->unsWirecardCheckoutSeamlessPaymentInfo();
}
return $this;
}
示例11: salesOrderPaymentRefund
/**
* Method to send a partial (refund) or total (cancel) refund to aplazame when a creditmemo is created
*
* @param Varien_Event_Observer $observer
* @return $this
*/
public function salesOrderPaymentRefund($observer)
{
/** @var Mage_Sales_Model_Order_Payment $payment */
$payment = $observer->getPayment();
/** @var Mage_Sales_Model_Order_Creditmemo $creditmemo */
$creditmemo = $observer->getCreditmemo();
/** @var Mage_Sales_Model_Order $order */
$order = $payment->getOrder();
if (!$this->is_aplazame_payment($order)) {
return $this;
}
$remainingAmountAfterRefund = $order->getBaseGrandTotal() - $order->getBaseTotalRefunded();
$refundedTotal = $creditmemo->getBaseGrandTotal();
/** @var Aplazame_Aplazame_Model_Api_Client $client */
$client = Mage::getModel('aplazame/api_client');
if ($remainingAmountAfterRefund == 0) {
//total is refunded so we cancel order at aplazame side
$client->cancelOrder($order);
} else {
//partial refund so we refund at aplazame side
$client->refundAmount($order, $refundedTotal);
}
return $this;
}
示例12: paymentInfoBlockPrepareSpecificInformation
/**
* Add custom data to the payment info block
*
* @param Varien_Event_Observer $observer
* @return void
*/
public function paymentInfoBlockPrepareSpecificInformation(Varien_Event_Observer $observer)
{
/** @var $payment Mage_Sales_Model_Quote_Payment */
$payment = $observer->getPayment();
/** @var $transport Varien_Object */
$transport = $observer->getTransport();
$paymentMethod = $payment->getMethod();
// Display custom data for supported payment methods only
/** @var $helper CLS_Paypal_Helper_Data */
$helper = Mage::helper('cls_paypal');
if ($helper->isSupportedPaymentMethod($paymentMethod)) {
if ($payment->hasAdditionalInformation('cc_save_future')) {
$transport->setData($helper->__('Save this card for future use'), $helper->__('Yes'));
}
}
}
示例13: savePayment
public function savePayment(Varien_Event_Observer $observer)
{
$payment = $observer->getPayment();
$order = $payment->getOrder();
$pmName = $payment->getMethodInstance()->getCode();
$param = Mage::app()->getFrontController()->getRequest()->getParam('payment');
$paymentMethod = isset($param[$pmName . '_paymentmethod']) ? $param[$pmName . '_paymentmethod'] : $param['method'];
$issuer = isset($param[$pmName . '_issuer']) ? $param[$pmName . '_issuer'] : '0';
$country = isset($param[$pmName . '_country']) ? $param[$pmName . '_country'] : $order->getBillingAddress()->getCountryId();
if ($country == "00") {
$country = $order->getBillingAddress()->getCountryId();
}
$ice_payment = array('ic_merchantid' => Mage::helper('icecore')->getMerchantIDForStore($order->getStore()->getId()), 'ic_currency' => $order->getOrderCurrencyCode(), 'ic_amount' => Mage::helper('icecore')->formatTotal($order->getGrandTotal()), 'ic_description' => Mage::helper('icecore')->getTransactionDescription($order->getRealOrderId()), 'ic_country' => $country, 'ic_language' => Mage::helper("icecore")->getLangISO2(), 'ic_reference' => $order->getRealOrderId(), 'ic_paymentmethod' => $paymentMethod, 'ic_issuer' => $issuer, 'ic_orderid' => $order->getRealOrderId(), 'ic_moduleid' => $this->getAuthID(), 'ic_authkey' => $this->getAuthKey($order->getStore()->getId()));
$data = array('order_id' => $order->getRealOrderId(), 'model' => $pmName, 'transaction_data' => urlencode(serialize($ice_payment)), 'store_id' => $order->getStore()->getId(), 'status' => Icepay_IceCore_Model_Config::STATUS_NEW, 'update_time' => now(), 'creation_time' => now());
$this->_getWriteAdapter()->insert($this->getTable('icepay_transactions'), $data);
}
示例14: setOrderStateForDirectDebitsNl
/**
* resets the order status back to pending payment in case of direct debits nl with order id as merchant ref
* @event sales_order_payment_place_end
* @param Varien_Event_Observer $event
*/
public function setOrderStateForDirectDebitsNl(Varien_Event_Observer $event)
{
$payment = $event->getPayment();
if ($payment->getMethodInstance() instanceof Netresearch_OPS_Model_Payment_DirectDebit && Mage::helper('ops/payment')->isInlinePaymentWithOrderId($payment) && $payment->getAdditionalInformation('PM') == 'Direct Debits NL' && $payment->getAdditionalInformation('STATUS') == Netresearch_OPS_Model_Payment_Abstract::OPS_AUTHORIZED_WAITING) {
$payment->getOrder()->setStatus(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT);
$payment->getOrder()->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT);
}
}
示例15: sales_order_payment_place_end
public function sales_order_payment_place_end(Varien_Event_Observer $observer)
{
$payment = $observer->getPayment();
$paymentMethodCode = $payment->getMethodInstance()->getCode();
if (strpos($paymentMethodCode, 'icepayadv_') === false) {
return;
}
if ($this->coreSQL()->isActive("iceadvanced")) {
$this->coreSQL()->savePayment($observer);
}
return;
}