Class Mage_Sales_Model_Order_Payment

Description

Order payment information

Located in /Sales/Model/Order/Payment.php (line 30)

Varien_Object
   |
   --Mage_Core_Model_Abstract
      |
      --Mage_Payment_Model_Info
         |
         --Mage_Sales_Model_Order_Payment
Class Constant Summary
Variable Summary
Method Summary
null|Mage_Sales_Model_Order_Payment_Transaction addTransaction (string $type, [Mage_Sales_Model_Abstract $salesDocument = null], [bool $failsafe = false], [string $message = false])
void authorize (bool $isOnline, float $amount)
bool canCapture ()
void canRefund ()
bool canVoid ( $document)
Mage_Sales_Model_Order_Payment registerPaymentReviewAction (string $action, bool $isOnline)
Mage_Sales_Model_Payment registerVoidNotification ([float $amount = null])
void setTransactionAdditionalInfo (sting $key, string $value)
null|Mage_Sales_Model_Order_Payment_Transaction _addTransaction (string $type, [Mage_Sales_Model_Abstract $salesDocument = null], [bool $failsafe = false])
string _appendTransactionToMessage (Mage_Sales_Model_Order_Payment_Transaction|null $transaction, string $message)
Mage_Sales_Model_Order_Payment _authorize (bool $isOnline, float $amount)
void _avoidDoubleTransactionProcessing ([string $txnId = null])
void _construct ()
string|float _formatAmount (string|float $amount, [bool $asFloat = false])
string _formatPrice (float $amount)
void _generateTransactionId (string $type, [Mage_Sales_Model_Order_Payment_Transaction $transactionBasedOn = false])
bool _isCaptureFinal (float $amountToCapture)
boolean _isTransactionExists ([string $txnId = null])
Mage_Sales_Model_Order_Payment_Transaction|false _lookupTransaction (string $txnId, [string $txnType = false])
void _updateTotals (array $data)
Mage_Sales_Model_Order_Payment _void (bool $isOnline, [float $amount = null], [string $gatewayCallback = 'void'])
Variables
Mage_Sales_Model_Billing_Agreement $_billingAgreement = null (line 53)

Billing agreement instance that may be created during payment processing

  • access: protected
string $_canVoidLookup = null (line 59)

Whether can void

  • access: protected
mixed $_eventObject = 'payment' (line 69)
  • access: protected

Redefinition of:
Mage_Core_Model_Abstract::$_eventObject
Parameter name in event
mixed $_eventPrefix = 'sales_order_payment' (line 68)
  • access: protected

Redefinition of:
Mage_Core_Model_Abstract::$_eventPrefix
Prefix of model events names
Mage_Sales_Model_Order $_order (line 46)

Order model object

  • access: protected
array $_transactionAdditionalInfo = array() (line 76)

Transaction addditional information container

  • access: protected
array $_transactionsLookup = array() (line 66)

Transactions registry to spare resource calls

array(txn_id => sales/order_payment_transaction)

  • access: protected

Inherited Variables

Inherited from Mage_Payment_Model_Info

Mage_Payment_Model_Info::$_additionalInformation

Inherited from Mage_Core_Model_Abstract

Mage_Core_Model_Abstract::$_cacheTag
Mage_Core_Model_Abstract::$_dataSaveAllowed
Mage_Core_Model_Abstract::$_isObjectNew
Mage_Core_Model_Abstract::$_resource
Mage_Core_Model_Abstract::$_resourceCollectionName
Mage_Core_Model_Abstract::$_resourceName
Methods
accept (line 692)

Accept online a payment that is in review state

  • access: public
addTransaction (line 1051)

Public acces to _addTransaction method

  • access: public
null|Mage_Sales_Model_Order_Payment_Transaction addTransaction (string $type, [Mage_Sales_Model_Abstract $salesDocument = null], [bool $failsafe = false], [string $message = false])
authorize (line 897)

Public access to _authorize method

  • access: public
void authorize (bool $isOnline, float $amount)
  • bool $isOnline
  • float $amount
canCapture (line 113)

Check order payment capture action availability

  • access: public
bool canCapture ()
canCapturePartial (line 136)
  • access: public
void canCapturePartial ()
cancel (line 650)

Order cancellation hook for payment method instance

Adds void transaction if needed

  • access: public
cancelCreditmemo (line 631)

Cancel a creditmemo: substract its totals from the payment

  • access: public
cancelInvoice (line 415)

Cancel specified invoice: update self totals from it

  • access: public
canFetchTransactionInfo (line 682)
  • access: public
void canFetchTransactionInfo ()
canRefund (line 126)
  • access: public
void canRefund ()
canRefundPartialPerInvoice (line 131)
  • access: public
void canRefundPartialPerInvoice ()
canReviewPayment (line 677)

Check order payment review availability

  • access: public
bool canReviewPayment ()
canVoid (line 451)

Check order payment void availability

  • access: public
bool canVoid ( $document)
  • Varien_Object $document
capture (line 244)

Capture the payment online

Requires an invoice. If there is no invoice specified, will automatically prepare an invoice for order Updates transactions hierarchy, if required Updates payment totals, updates order status and adds proper comments

TODO: eliminate logic duplication with registerCaptureNotification()

  • throws: Mage_Core_Exception
  • access: public
Mage_Sales_Model_Order_Payment capture ( $invoice)
  • $invoice
deny (line 703)

Accept order with payment method instance

  • access: public
getAuthorizationTransaction (line 1240)

Lookup an authorization transaction using parent transaction id, if set

  • access: public
Mage_Sales_Model_Order_Payment_Transaction|false getAuthorizationTransaction ()
getBillingAgreement (line 1086)

Get the billing agreement, if any

  • access: public
Mage_Sales_Model_Billing_Agreement|null getBillingAgreement ()
getOrder (line 103)

Retrieve order model object

  • access: public
getTransaction (line 1259)

Lookup the transaction by id

  • access: public
Mage_Sales_Model_Order_Payment_Transaction|false getTransaction (string $transactionId)
  • string $transactionId
importTransactionInfo (line 1070)

Import details data of specified transaction

  • access: public
pay (line 397)

Register payment fact: update self totals from the invoice

  • access: public
place (line 147)

Authorize or authorize and capture payment on gateway, if applicable This method is supposed to be called only when order is placed

  • access: public
refund (line 500)

Refund payment online or offline, depending on whether there is invoice set in the creditmemo instance Updates transactions hierarchy, if required Updates payment totals, updates order status and adds proper comments

  • access: public
registerAuthorizationNotification (line 386)

Process authorization notification

  • see: self::_authorize()
  • access: public
Mage_Sales_Model_Order_Payment registerAuthorizationNotification (float $amount)
  • float $amount
registerCaptureNotification (line 326)

Process a capture notification from a payment gateway for specified amount

Creates an invoice automatically if the amount covers the order base grand total completely Updates transactions hierarchy, if required Prevents transaction double processing Updates payment totals, updates order status and adds proper comments

TODO: eliminate logic duplication with capture()

  • access: public
Mage_Sales_Model_Order_Payment registerCaptureNotification (float $amount)
  • float $amount
registerPaymentReviewAction (line 718)

Perform the payment review action: either initiated by merchant or by a notification

Sets order to processing state and optionally approves invoice or cancels the order

  • access: public
Mage_Sales_Model_Order_Payment registerPaymentReviewAction (string $action, bool $isOnline)
  • string $action
  • bool $isOnline
registerRefundNotification (line 573)

Process payment refund notification

Updates transactions hierarchy, if required Prevents transaction double processing Updates payment totals, updates order status and adds proper comments TODO: potentially a full capture can be refunded. In this case if there was only one invoice for that transaction then we should create a creditmemo from invoice and also refund it offline TODO: implement logic of chargebacks reimbursements (via negative amount)

  • access: public
Mage_Sales_Model_Order_Payment registerRefundNotification (float $amount)
  • float $amount
registerVoidNotification (line 484)

Process void notification

  • see: self::_void()
  • access: public
Mage_Sales_Model_Payment registerVoidNotification ([float $amount = null])
  • float $amount
resetTransactionAdditionalInfo (line 1352)

Reset transaction additional info property

  • access: public
Mage_Sales_Model_Order_Payment resetTransactionAdditionalInfo ()
setOrder (line 92)

Declare order model object

  • access: public
setTransactionAdditionalInfo (line 1342)

Additionnal transaction info setter

  • access: public
void setTransactionAdditionalInfo (sting $key, string $value)
  • sting $key
  • string $value
void (line 470)

Void payment online

  • see: self::_void()
  • access: public
Mage_Sales_Model_Order_Payment void ( $document)
  • Varien_Object $document
_addTransaction (line 982)

Create transaction, prepare its insertion into hierarchy and add its information to payment and comments

To add transactions and related information, the following information should be set to payment before processing:

  • transaction_id
  • is_transaction_closed (optional) - whether transaction should be closed or open (closed by default)
  • parent_transaction_id (optional)
  • should_close_parent_transaction (optional) - whether to close parent transaction (closed by default)
If the sales document is specified, it will be linked to the transaction as related for future usage. Currently transaction ID is set into the sales object This method writes the added transaction ID into last_trans_id field of the payment object

To make sure transaction object won't cause trouble before saving, use $failsafe = true

  • access: protected
null|Mage_Sales_Model_Order_Payment_Transaction _addTransaction (string $type, [Mage_Sales_Model_Abstract $salesDocument = null], [bool $failsafe = false])
_appendTransactionToMessage (line 1145)

Append transaction ID (if any) message to the specified message

  • access: protected
string _appendTransactionToMessage (Mage_Sales_Model_Order_Payment_Transaction|null $transaction, string $message)
_authorize (line 851)

Authorize payment either online or offline (process auth notification)

Updates transactions hierarchy, if required Prevents transaction double processing Updates payment totals, updates order status and adds proper comments

  • access: protected
Mage_Sales_Model_Order_Payment _authorize (bool $isOnline, float $amount)
  • bool $isOnline
  • float $amount
_avoidDoubleTransactionProcessing (line 1115)

Prevent double processing of the same transaction by a payment notification Uses either specified txn_id or the transaction id that was set before

  • deprecated: after 1.4.0.1
  • throws: Mage_Core_Exception
  • access: protected
void _avoidDoubleTransactionProcessing ([string $txnId = null])
  • string $txnId
_beforeSave (line 1304)

Before object save manipulations

  • access: protected

Redefinition of:
Mage_Core_Model_Abstract::_beforeSave()
Processing object before save data
_construct (line 81)

Initialize resource model

  • access: protected
void _construct ()
_createBillingAgreement (line 1319)

Generate billing agreement object if there is billing agreement data

Adds it to order as related object

  • access: protected
void _createBillingAgreement ()
_formatAmount (line 1184)

Round up and cast specified amount to float or string

  • access: protected
string|float _formatAmount (string|float $amount, [bool $asFloat = false])
  • string|float $amount
  • bool $asFloat
_formatPrice (line 1195)

Format price with currency sign

  • access: protected
string _formatPrice (float $amount)
  • float $amount
_generateTransactionId (line 1271)

Update transaction ids for further processing If no transactions were set before invoking, may generate an "offline" transaction id

  • access: protected
void _generateTransactionId (string $type, [Mage_Sales_Model_Order_Payment_Transaction $transactionBasedOn = false])
_getInvoiceForTransactionId (line 1364)

Return invoice model for transaction

  • access: protected
Mage_Sales_Model_Order_Invoice _getInvoiceForTransactionId (string $transactionId)
  • string $transactionId
_invoice (line 433)

Create new invoice with maximum qty for invoice for each item register this invoice and capture

  • access: protected
_isCaptureFinal (line 1287)

Decide whether authorization transaction may close (if the amount to capture will cover entire order)

  • access: protected
bool _isCaptureFinal (float $amountToCapture)
  • float $amountToCapture
_isTransactionExists (line 1130)

Check transaction existence by specified transaction id

  • access: protected
boolean _isTransactionExists ([string $txnId = null])
  • string $txnId
_lookupTransaction (line 1206)

Find one transaction by ID or type

  • access: protected
Mage_Sales_Model_Order_Payment_Transaction|false _lookupTransaction (string $txnId, [string $txnType = false])
  • string $txnId
  • string $txnType
_order (line 811)

Order payment either online

Updates transactions hierarchy, if required Prevents transaction double processing Updates payment totals, updates order status and adds proper comments

  • access: protected
Mage_Sales_Model_Order_Payment _order (float $amount)
  • float $amount
_prependMessage (line 1161)

Prepend a "prepared_message" that may be set to the payment instance before, to the specified message Prepends value to the specified string or to the comment of specified order status history item instance

  • access: protected
string|Mage_Sales_Model_Order_Status_History _prependMessage (string|Mage_Sales_Model_Order_Status_History $messagePrependTo)
_updateTotals (line 1097)

Totals updater utility method Updates self totals by keys in data array('key' => $delta)

  • access: protected
void _updateTotals (array $data)
  • array $data
_void (line 913)

Void payment either online or offline (process void notification) NOTE: that in some cases authorization can be voided after a capture. In such case it makes sense to use the amount void amount, for informational purposes.

Updates payment totals, updates order status and adds proper comments

  • access: protected
Mage_Sales_Model_Order_Payment _void (bool $isOnline, [float $amount = null], [string $gatewayCallback = 'void'])
  • bool $isOnline
  • float $amount
  • string $gatewayCallback

Inherited Methods

Inherited From Mage_Payment_Model_Info

Mage_Payment_Model_Info::decrypt()
Mage_Payment_Model_Info::encrypt()
Mage_Payment_Model_Info::getAdditionalInformation()
Mage_Payment_Model_Info::getData()
Mage_Payment_Model_Info::getMethodInstance()
Mage_Payment_Model_Info::hasAdditionalInformation()
Mage_Payment_Model_Info::setAdditionalInformation()
Mage_Payment_Model_Info::unsAdditionalInformation()
Mage_Payment_Model_Info::_initAdditionalInformation()

Inherited From Mage_Core_Model_Abstract

Mage_Core_Model_Abstract::afterCommitCallback()
Mage_Core_Model_Abstract::afterLoad()
Mage_Core_Model_Abstract::cleanModelCache()
Mage_Core_Model_Abstract::clearInstance()
Mage_Core_Model_Abstract::delete()
Mage_Core_Model_Abstract::getCacheIdTags()
Mage_Core_Model_Abstract::getCacheTags()
Mage_Core_Model_Abstract::getCollection()
Mage_Core_Model_Abstract::getEntityId()
Mage_Core_Model_Abstract::getId()
Mage_Core_Model_Abstract::getIdFieldName()
Mage_Core_Model_Abstract::getResource()
Mage_Core_Model_Abstract::getResourceCollection()
Mage_Core_Model_Abstract::getResourceName()
Mage_Core_Model_Abstract::isObjectNew()
Mage_Core_Model_Abstract::load()
Mage_Core_Model_Abstract::save()
Mage_Core_Model_Abstract::setId()
Mage_Core_Model_Abstract::_afterDelete()
Mage_Core_Model_Abstract::_afterDeleteCommit()
Mage_Core_Model_Abstract::_afterLoad()
Mage_Core_Model_Abstract::_afterSave()
Mage_Core_Model_Abstract::_afterSaveCommit()
Mage_Core_Model_Abstract::_beforeDelete()
Mage_Core_Model_Abstract::_beforeLoad()
Mage_Core_Model_Abstract::_beforeSave()
Mage_Core_Model_Abstract::_clearData()
Mage_Core_Model_Abstract::_clearReferences()
Mage_Core_Model_Abstract::_getEventData()
Mage_Core_Model_Abstract::_getResource()
Mage_Core_Model_Abstract::_hasModelChanged()
Mage_Core_Model_Abstract::_init()
Mage_Core_Model_Abstract::_protectFromNonAdmin()
Mage_Core_Model_Abstract::_setResourceModel()
Class Constants
REVIEW_ACTION_ACCEPT = 'accept' (line 37)

Actions for payment when it triggered review state

REVIEW_ACTION_DENY = 'deny' (line 38)
REVIEW_ACTION_UPDATE = 'update' (line 39)

Documentation generated on Fri, 11 Feb 2011 17:09:40 +0200 by phpDocumentor 1.4.3