本文整理汇总了PHP中Mage_Sales_Model_Order_Payment::setTransactionId方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order_Payment::setTransactionId方法的具体用法?PHP Mage_Sales_Model_Order_Payment::setTransactionId怎么用?PHP Mage_Sales_Model_Order_Payment::setTransactionId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Order_Payment
的用法示例。
在下文中一共展示了Mage_Sales_Model_Order_Payment::setTransactionId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addNewTransaction
/**
* Magento $payment->addTransaction(...) needs the transaction_id = id from the transaction entry or string!
*
* @param Mage_Sales_Model_Order_Payment $payment
* @param string $type
* @param Mage_Sales_Model_Abstract $salesDocument
* @param bool $failsafe
* @param string $message
* @return null|Mage_Sales_Model_Order_Payment_Transaction
*/
public function addNewTransaction(Mage_Sales_Model_Order_Payment $payment, $type, $salesDocument = null, $failsafe = false, $message = false)
{
$transaction = null;
try {
$addInformation = $payment->getAdditionalInformation();
$payment->setTransactionId($addInformation['transactionId'] . '-' . $type);
$transaction = $payment->addTransaction($type, $salesDocument, $failsafe, $message);
$transaction->save();
} catch (Exception $e) {
Mage::logException($e);
}
return $transaction;
}
示例2: _addTransaction
/**
* Add payment transaction
*
* @param Mage_Sales_Model_Order_Payment $payment
* @param string $transactionId
* @param string $transactionType
* @param array $transactionDetails
* @param array $transactionAdditionalInfo
* @return null|Mage_Sales_Model_Order_Payment_Transaction
*/
protected function _addTransaction(Mage_Sales_Model_Order_Payment $payment, $transactionId, $transactionType, array $transactionDetails = array(), array $transactionAdditionalInfo = array(), $message = false)
{
$payment->setTransactionId($transactionId);
$payment->resetTransactionAdditionalInfo();
foreach ($transactionDetails as $key => $value) {
$payment->setData($key, $value);
}
foreach ($transactionAdditionalInfo as $key => $value) {
$payment->setTransactionAdditionalInfo($key, $value);
}
$transaction = $payment->addTransaction($transactionType, null, false, $message);
foreach ($transactionDetails as $key => $value) {
$payment->unsetData($key);
}
$payment->unsLastTransId();
/**
* It for self using
*/
$transaction->setMessage($message);
return $transaction;
}
示例3: doCancel
/**
* Call Cancel API, the transaction must be Authorized beforehand
*
* @param Mage_Sales_Model_Order_Payment $payment
* @return Eway_Rapid31_Model_Request_Direct
*/
public function doCancel(Mage_Sales_Model_Order_Payment $payment)
{
// Empty Varien_Object's data
$this->unsetData();
$transactionId = $payment->getLastTransId();
$this->setTransactionId($transactionId);
$response = $this->_doRapidAPI('CancelAuthorisation');
if ($response->isSuccess()) {
$payment->setTransactionId($response->getTransactionID());
$payment->setIsTransactionClosed(1);
return $this;
} else {
Mage::throwException(Mage::helper('ewayrapid')->__('An error occurred while doing the cancel. Please try again. (Error message: %s)', $response->getMessage()));
}
}
示例4: _importRefundResultToPayment
/**
* Import refund results to payment
*
* @param Mage_Paypal_Model_Api_Nvp $api
* @param Mage_Sales_Model_Order_Payment $payment
* @param bool $canRefundMore
*/
protected function _importRefundResultToPayment($api, $payment, $canRefundMore)
{
$payment->setTransactionId($api->getTransactionId())->setIsTransactionClosed(1)->setShouldCloseParentTransaction(!$canRefundMore)->setTransactionAdditionalInfo(self::TRANSPORT_PAYFLOW_TXN_ID, $api->getPayflowTrxid());
$payment->setPreparedMessage(Mage::helper('enterprise_pbridge')->__('Payflow PNREF: #%s.', $api->getData(self::TRANSPORT_PAYFLOW_TXN_ID)));
Mage::getModel('paypal/info')->importToPayment($api, $payment);
}
示例5: _importResultToPayment
/**
* Transfer API results to payment.
* Api response must be compatible with payment response expectation
*
* @param Mage_Sales_Model_Order_Payment $payment
* @param array $apiResponse
*/
protected function _importResultToPayment(Mage_Sales_Model_Order_Payment $payment, $apiResponse)
{
if (!empty($apiResponse['gateway_transaction_id'])) {
$payment->setPreparedMessage(Mage::helper('enterprise_pbridge')->__('Original gateway transaction id: #%s.', $apiResponse['gateway_transaction_id']));
}
if (isset($apiResponse['transaction_id'])) {
$payment->setTransactionId($apiResponse['transaction_id']);
unset($apiResponse['transaction_id']);
}
}
示例6: setTransaction
/**
* @param Mage_Sales_Model_Order_Payment $payment
* @return bool
*/
public function setTransaction(Mage_Sales_Model_Order_Payment $payment)
{
$payment->setTransactionId(Mage::getSingleton('core/session')->getTransactionId());
$payment->setIsTransactionClosed(0);
return $payment;
}
示例7: _placeOrder
/**
* Place an order with authorization or capture action
*
* @param Mage_Sales_Model_Order_Payment $payment
* @param float $amount
* @return Mage_Paypal_Model_Direct
*/
protected function _placeOrder(Mage_Sales_Model_Order_Payment $payment, $amount)
{
$order = $payment->getOrder();
$api = $this->_pro->getApi()->setPaymentAction($this->_pro->getConfig()->paymentAction)->setIpAddress(Mage::app()->getRequest()->getClientIp(false))->setAmount($amount)->setCurrencyCode($order->getBaseCurrencyCode())->setInvNum($order->getIncrementId())->setEmail($order->getCustomerEmail())->setNotifyUrl(Mage::getUrl('paypal/ipn/direct'))->setCreditCardType($payment->getCcType())->setCreditCardNumber($payment->getCcNumber())->setCreditCardExpirationDate(sprintf('%02d%02d', $payment->getCcExpMonth(), $payment->getCcExpYear()))->setCreditCardCvv2($payment->getCcCid());
// add shipping address
if ($order->getIsVirtual()) {
$api->setAddress($order->getBillingAddress())->setSuppressShipping(true);
} else {
$api->setAddress($order->getShippingAddress());
}
// add line items
if ($this->_pro->getConfig()->lineItemsEnabled) {
list($items, $totals) = Mage::helper('paypal')->prepareLineItems($order);
$api->setLineItems($items)->setLineItemTotals($totals);
}
// call api and import transaction and other payment information
$api->callDoDirectPayment();
$payment->setTransactionId($api->getTransactionId())->setIsTransactionClosed(0)->setIsPaid($api->isPaid($api->getPaymentStatus()));
Mage::getModel('paypal/info')->importToPayment($api, $payment);
return $this;
}
示例8: _importResultToPayment
/**
* Import direct payment results to payment
*
* @param Varien_Object $api
* @param Mage_Sales_Model_Order_Payment $payment
*/
protected function _importResultToPayment($api, $payment)
{
$payment->setTransactionId($api->getTransactionId())->setIsTransactionClosed(0)->setIsTransactionPending($api->getIsPaymentPending());
$payflowTrxid = $api->getData(Enterprise_Pbridge_Model_Payment_Method_Paypaluk_Pro::TRANSPORT_PAYFLOW_TXN_ID);
$payment->setPreparedMessage(Mage::helper('enterprise_pbridge')->__('Payflow PNREF: #%s.', $payflowTrxid));
$this->_pro->importPaymentInfo($api, $payment);
}
示例9: _updatePaymentStatusCompleted
/**
* Update payment status to complete
*
* @param Mage_Sales_Model_Order_Payment $payment
*/
protected function _updatePaymentStatusCompleted(Mage_Sales_Model_Order_Payment $payment)
{
$comment = $this->_helper()->__('The transaction completed successfully.');
$payment->setTransactionId($this->_transactionId)->setPreparedMessage($comment)->setCurrencyCode($payment->getOrder()->getBaseCurrencyCode())->setIsTransactionApproved(true)->setIsTransactionClosed(true)->registerCaptureNotification($this->getOrder()->getTotalDue())->save();
$this->getOrder()->save();
// notify customer
if ($invoice = $payment->getCreatedInvoice()) {
$comment = $this->_helper()->__('Notified customer about invoice #%s.', $invoice->getIncrementId());
if (!$this->getOrder()->getEmailSent()) {
$this->getOrder()->queueNewOrderEmail()->setIsCustomerNotified(true)->addStatusHistoryComment($comment)->save();
} else {
$this->getOrder()->sendOrderUpdateEmail(true, $comment)->addStatusHistoryComment($comment)->save();
}
}
}
示例10: _placeOfflineTransaction
/**
*
* Requests coming from admin are offline transactions. These don't need to be sent via the PinPayments gateway
* as they've already been processed. Simply record the transaction ID supplied by the admin.
*
* @param Mage_Sales_Model_Order_Payment $payment
* @param $amount
* @param $transactionId
*/
protected function _placeOfflineTransaction($payment, $amount)
{
$payment->setAmount($amount);
$payment->getOrder()->setCustomerNote("Creating offline PinPayments transaction");
$transactionId = $payment->getAdditionalInformation('offline_transaction_id');
$payment->setCcTransId($transactionId);
$payment->setTransactionId($transactionId);
}
示例11: setPaymentTransactionInformation
/**
* Set Payment Transaction Information
*
* @param Mage_Sales_Model_Order_Payment $payment Sales Payment Model
* @param array $params Request params
* @param string $action Action (accept|cancel|decline|wait|exception)
*/
protected function setPaymentTransactionInformation(Mage_Sales_Model_Order_Payment $payment, $params, $action)
{
$payment->setTransactionId($params['PAYID']);
$code = $payment->getMethodInstance()->getCode();
$isInline = false;
/* In authorize mode we still have no authorization transaction for CC and DirectDebit payments,
* so capture or cancel won't work. So we need to create a new authorization transaction for them
* when a payment was accepted by Barclaycard
*
* In exception-case we create the authorization-transaction too because some exception-cases can turn into accepted
*/
if (('accept' === $action || 'exception' === $action) && in_array($code, array('ops_cc', 'ops_directDebit'))) {
$payment->setIsTransactionClosed(false);
$isInline = $this->isInlinePayment($payment);
/* create authorization transaction for non-inline pms */
if (false === $isInline || (array_key_exists('HTML_ANSWER', $params) || 0 < strlen($payment->getAdditionalInformation('HTML_ANSWER')))) {
$payment->addTransaction("authorization", null, true, $this->__("Process outgoing transaction"));
}
$payment->setLastTransId($params['PAYID']);
}
/* Barclaycard sends parameter HTML_ANSWER to trigger 3D secure redirection */
if (isset($params['HTML_ANSWER']) && 'ops_cc' == $code) {
$payment->setAdditionalInformation('HTML_ANSWER', $params['HTML_ANSWER']);
$payment->setIsTransactionPending(true);
}
$payment->setAdditionalInformation('paymentId', $params['PAYID']);
$payment->setAdditionalInformation('status', $params['STATUS']);
if (array_key_exists('ACCEPTANCE', $params) && 0 < strlen(trim($params['ACCEPTANCE']))) {
$payment->setAdditionalInformation('acceptance', $params['ACCEPTANCE']);
}
if (array_key_exists('BRAND', $params) && 'ops_cc' == $code && 0 < strlen(trim($params['BRAND']))) {
$payment->setAdditionalInformation('CC_BRAND', $params['BRAND']);
}
if (false === $isInline || array_key_exists('HTML_ANSWER', $params)) {
$payment->setIsTransactionClosed(true);
}
$payment->setDataChanges(true);
$payment->save();
}
示例12: addTransaction
/**
* Add payment transaction
*
* @param Mage_Sales_Model_Order_Payment $payment
* @param string $transactionId
* @param string $transactionType
* @param array $transactionDetails
* @param array $transactionAdditionalInfo
* @return null|Mage_Sales_Model_Order_Payment_Transaction
*/
public function addTransaction(Mage_Sales_Model_Order_Payment $payment, $transactionId, $transactionType, array $transactionDetails = array(), array $transactionAdditionalInfo = array(), $message = false)
{
$payment->setTransactionId($transactionId);
if (method_exists($payment, "resetTransactionAdditionalInfo")) {
$payment->resetTransactionAdditionalInfo();
}
foreach ($transactionDetails as $key => $value) {
$payment->setData($key, $value);
}
foreach ($transactionAdditionalInfo as $key => $value) {
$payment->setTransactionAdditionalInfo($key, $value);
}
if (!class_exists("Mage_Sales_Model_Order_Payment_Transaction")) {
return null;
}
if (method_exists($payment, "addTransaction")) {
$transaction = $payment->addTransaction($transactionType, null, false, $message);
} else {
$transaction = $this->_addTransaction($payment, $transactionType, null, false);
}
/**
* It for self using
*/
$transaction->setMessage($message);
return $transaction;
}
示例13: setPaymentTransactionInformation
/**
* Set Payment Transaction Information
*
* @param Mage_Sales_Model_Order_Payment $payment Sales Payment Model
* @param array $params Request params
*/
protected function setPaymentTransactionInformation($payment, $params)
{
$payment->setTransactionId($params['PAYID']);
$code = $payment->getMethodInstance()->getCode();
if (in_array($code, array('postfinance_cc', 'postfinance_directDebit'))) {
$payment->setIsTransactionClosed(false);
$payment->addTransaction("authorization", null, true, $this->__("Process outgoing transaction"));
$payment->setLastTransId($params['PAYID']);
if (isset($params['HTML_ANSWER'])) {
$payment->setAdditionalInformation('HTML_ANSWER', $params['HTML_ANSWER']);
}
}
$payment->setAdditionalInformation('paymentId', $params['PAYID']);
$payment->setAdditionalInformation('status', $params['STATUS']);
$payment->setIsTransactionClosed(true);
$payment->setDataChanges(true);
$payment->save();
}
示例14: _capture
/**
* Capture a successful auth transaction
*
* @param Varien_Object|Mage_Sales_Model_Order_Payment $payment
* @param float $amount
*
* @return EMerchantPay_Genesis_Model_Direct
*
* @throws Mage_Core_Exception
*/
private function _capture($payment, $amount)
{
Mage::log('Capture transaction for order #' . $payment->getOrder()->getIncrementId());
try {
$this->getHelper()->initClient($this->getCode());
$authorize = $payment->lookupTransaction(null, Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH);
$reference_id = $authorize->getTxnId();
$genesis = new \Genesis\Genesis('Financial\\Capture');
$genesis->request()->setTransactionId($this->getHelper()->genTransactionId($payment->getOrder()->getIncrementId()))->setRemoteIp($this->getHelper('core/http')->getRemoteAddr(false))->setReferenceId($reference_id)->setCurrency($payment->getOrder()->getBaseCurrencyCode())->setAmount($amount);
$genesis->execute();
$payment->setTransactionId($genesis->response()->getResponseObject()->unique_id)->setParentTransactionId($reference_id)->setIsTransactionClosed(false)->setShouldCloseParentTransaction(true)->resetTransactionAdditionalInfo()->setTransactionAdditionalInfo(array(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS => $this->getHelper()->getArrayFromGatewayResponse($genesis->response()->getResponseObject())), null);
$payment->save();
} catch (Exception $exception) {
Mage::logException($exception);
Mage::throwException($this->getHelper()->__($exception->getMessage()));
}
return $this;
}
示例15: _placeOrder
/**
* Place an order with authorization or capture action
*
* @param Mage_Sales_Model_Order_Payment $payment
* @param float $amount
* @return Mage_Paypal_Model_Express
*/
protected function _placeOrder(Mage_Sales_Model_Order_Payment $payment, $amount)
{
// prepare api call
$order = $payment->getOrder();
$token = $payment->getAdditionalInformation(Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_TRANSPORT_TOKEN);
$api = $this->_pro->getApi()->setToken($token)->setPayerId($payment->getAdditionalInformation(Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_TRANSPORT_PAYER_ID))->setAmount($amount)->setPaymentAction($this->_pro->getConfig()->paymentAction)->setNotifyUrl(Mage::getUrl('paypal/ipn/express'))->setInvNum($order->getIncrementId())->setCurrencyCode($order->getBaseCurrencyCode());
// add line items
if ($this->_pro->getConfig()->lineItemsEnabled) {
list($items, $totals) = Mage::helper('paypal')->prepareLineItems($order);
$api->setLineItems($items)->setLineItemTotals($totals);
}
// call api and get details from it
$api->callDoExpressCheckoutPayment();
$payment->setTransactionId($api->getTransactionId())->setIsTransactionClosed(0)->setIsPaid($api->isPaid($api->getPaymentStatus()));
Mage::getModel('paypal/info')->importToPayment($api, $payment);
return $this;
}