Mage_Payment_Model_Method_Abstract Class Reference

Inheritance diagram for Mage_Payment_Model_Method_Abstract:

Varien_Object Mage_AmazonPayments_Model_Payment Mage_AmazonPayments_Model_Payment_Asp Mage_AmazonPayments_Model_Payment_Asp_Abstract Mage_AmazonPayments_Model_Payment_Cba Mage_GoogleCheckout_Model_Payment Mage_Payment_Model_Method_Cc Mage_Payment_Model_Method_Checkmo Mage_Payment_Model_Method_Free Mage_Payment_Model_Method_Purchaseorder Mage_Paypal_Model_Abstract Mage_Paypal_Model_Express Mage_Paypal_Model_Standard Mage_PaypalUk_Model_Express

List of all members.

Public Member Functions

 __construct ()
 canAuthorize ()
 canCapture ()
 canCapturePartial ()
 canRefund ()
 canRefundPartialPerInvoice ()
 canVoid (Varien_Object $payment)
 canUseInternal ()
 canUseCheckout ()
 canUseForMultishipping ()
 canEdit ()
 isGateway ()
 isInitializeNeeded ()
 canUseForCountry ($country)
 canUseForCurrency ($currencyCode)
 getCode ()
 getFormBlockType ()
 getInfoBlockType ()
 getInfoInstance ()
 validate ()
 authorize (Varien_Object $payment, $amount)
 capture (Varien_Object $payment, $amount)
 processInvoice ($invoice, $payment)
 processBeforeRefund ($invoice, $payment)
 refund (Varien_Object $payment, $amount)
 processCreditmemo ($creditmemo, $payment)
 cancel (Varien_Object $payment)
 processBeforeVoid ($invoice, $payment)
 void (Varien_Object $payment)
 getTitle ()
 getConfigData ($field, $storeId=null)
 assignData ($data)
 prepareSave ()
 isAvailable ($quote=null)
 initialize ($paymentAction, $stateObject)

Public Attributes

const ACTION_AUTHORIZE = 'authorize'
const ACTION_AUTHORIZE_CAPTURE = 'authorize_capture'
const STATUS_UNKNOWN = 'UNKNOWN'
const STATUS_APPROVED = 'APPROVED'
const STATUS_ERROR = 'ERROR'
const STATUS_DECLINED = 'DECLINED'
const STATUS_VOID = 'VOID'
const STATUS_SUCCESS = 'SUCCESS'

Protected Member Functions

 _getHelper ()

Protected Attributes

 $_code
 $_formBlockType = 'payment/form'
 $_infoBlockType = 'payment/info'
 $_isGateway = false
 $_canAuthorize = false
 $_canCapture = false
 $_canCapturePartial = false
 $_canRefund = false
 $_canRefundInvoicePartial = false
 $_canVoid = false
 $_canUseInternal = true
 $_canUseCheckout = true
 $_canUseForMultishipping = true
 $_isInitializeNeeded = false


Detailed Description

Payment method abstract model

Author:
Magento Core Team <core@magentocommerce.com>

Definition at line 32 of file Abstract.php.


Constructor & Destructor Documentation

__construct (  ) 

Constructor

By default is looking for first argument as array and assignes it as object attributes This behaviour may change in child classes

Reimplemented from Varien_Object.

Reimplemented in Mage_AmazonPayments_Model_Payment.

Definition at line 63 of file Abstract.php.

00064     {
00065 
00066     }


Member Function Documentation

_getHelper (  )  [protected]

Retrieve model helper

Returns:
Mage_Payment_Helper_Data

Definition at line 226 of file Abstract.php.

00227     {
00228         return Mage::helper('payment');
00229     }

assignData ( data  ) 

Assign data to info model instance

Parameters:
mixed $data
Returns:
Mage_Payment_Model_Info

Reimplemented in Mage_Payment_Model_Method_Cc, Mage_Payment_Model_Method_Checkmo, Mage_Payment_Model_Method_Purchaseorder, and Mage_PaypalUk_Model_Direct.

Definition at line 428 of file Abstract.php.

00429     {
00430         if (is_array($data)) {
00431             $this->getInfoInstance()->addData($data);
00432         }
00433         elseif ($data instanceof Varien_Object) {
00434             $this->getInfoInstance()->addData($data->getData());
00435         }
00436         return $this;
00437     }

authorize ( Varien_Object payment,
amount 
)

Authorize

Parameters:
Varien_Object $orderPayment
Returns:
Mage_Payment_Model_Abstract

Reimplemented in Mage_AmazonPayments_Model_Payment_Cba, Mage_GoogleCheckout_Model_Payment, Mage_Paygate_Model_Authorizenet, Mage_Paygate_Model_Payflow_Pro, Mage_Paypal_Model_Direct, Mage_Paypal_Model_Express, Mage_PaypalUk_Model_Direct, and Mage_PaypalUk_Model_Express.

Definition at line 307 of file Abstract.php.

00308     {
00309         if (!$this->canAuthorize()) {
00310             Mage::throwException($this->_getHelper()->__('Authorize action is not available'));
00311         }
00312         return $this;
00313     }

canAuthorize (  ) 

Check authorise availability

Returns:
bool

Definition at line 73 of file Abstract.php.

00074     {
00075         return $this->_canAuthorize;
00076     }

canCapture (  ) 

Check capture availability

Returns:
bool

Reimplemented in Mage_Paypal_Model_Standard.

Definition at line 83 of file Abstract.php.

00084     {
00085         return $this->_canCapture;
00086     }

canCapturePartial (  ) 

Check partial capture availability

Returns:
bool

Definition at line 93 of file Abstract.php.

00094     {
00095         return $this->_canCapturePartial;
00096     }

cancel ( Varien_Object payment  ) 

Cancel payment (GoogleCheckout)

Parameters:
Varien_Object $invoicePayment
Returns:
Mage_Payment_Model_Abstract

Reimplemented in Mage_AmazonPayments_Model_Payment_Asp, Mage_AmazonPayments_Model_Payment_Cba, and Mage_GoogleCheckout_Model_Payment.

Definition at line 372 of file Abstract.php.

00373     {
00374         return $this;
00375     }

canEdit (  ) 

Can be edit order (renew order)

Returns:
bool

Reimplemented in Mage_GoogleCheckout_Model_Payment.

Definition at line 165 of file Abstract.php.

00166     {
00167         return true;
00168     }

canRefund (  ) 

Check refund availability

Returns:
bool

Definition at line 103 of file Abstract.php.

00104     {
00105         return $this->_canRefund;
00106     }

canRefundPartialPerInvoice (  ) 

Check partial refund availability for invoice

Returns:
bool

Definition at line 113 of file Abstract.php.

00114     {
00115         return $this->_canRefundInvoicePartial;
00116     }

canUseCheckout (  ) 

Can be used in regular checkout

Returns:
bool

Definition at line 145 of file Abstract.php.

00146     {
00147         return $this->_canUseCheckout;
00148     }

canUseForCountry ( country  ) 

To check billing country is allowed for the payment method

Returns:
bool

Definition at line 195 of file Abstract.php.

00196     {
00197         /*
00198         for specific country, the flag will set up as 1
00199         */
00200         if($this->getConfigData('allowspecific')==1){
00201             $availableCountries = explode(',', $this->getConfigData('specificcountry'));
00202             if(!in_array($country, $availableCountries)){
00203                 return false;
00204             }
00205 
00206         }
00207         return true;
00208     }

canUseForCurrency ( currencyCode  ) 

Check method for processing with base currency

Parameters:
string $currencyCode
Returns:
boolean

Reimplemented in Mage_Paygate_Model_Authorizenet, Mage_Paypal_Model_Direct, Mage_Paypal_Model_Express, Mage_Paypal_Model_Standard, Mage_PaypalUk_Model_Direct, and Mage_PaypalUk_Model_Express.

Definition at line 216 of file Abstract.php.

00217     {
00218         return true;
00219     }

canUseForMultishipping (  ) 

Using for multiple shipping address

Returns:
bool

Reimplemented in Mage_Paypal_Model_Express, and Mage_Paypal_Model_Standard.

Definition at line 155 of file Abstract.php.

00156     {
00157         return $this->_canUseForMultishipping;
00158     }

canUseInternal (  ) 

Using internal pages for input payment data Can be used in admin

Returns:
bool

Reimplemented in Mage_Paypal_Model_Express, and Mage_Paypal_Model_Standard.

Definition at line 135 of file Abstract.php.

00136     {
00137         return $this->_canUseInternal;
00138     }

canVoid ( Varien_Object payment  ) 

Check void availability

Parameters:
Varien_Object $invoicePayment
Returns:
bool

Reimplemented in Mage_Paygate_Model_Payflow_Pro, Mage_PaypalUk_Model_Direct, and Mage_PaypalUk_Model_Express.

Definition at line 124 of file Abstract.php.

00125     {
00126         return $this->_canVoid;
00127     }

capture ( Varien_Object payment,
amount 
)

Capture payment

Parameters:
Varien_Object $orderPayment
Returns:
Mage_Payment_Model_Abstract

Reimplemented in Mage_AmazonPayments_Model_Payment_Asp, Mage_AmazonPayments_Model_Payment_Cba, Mage_GoogleCheckout_Model_Payment, Mage_Paygate_Model_Authorizenet, Mage_Paygate_Model_Payflow_Pro, Mage_Paypal_Model_Direct, Mage_Paypal_Model_Express, Mage_PaypalUk_Model_Direct, and Mage_PaypalUk_Model_Express.

Definition at line 321 of file Abstract.php.

00322     {
00323         if (!$this->canCapture()) {
00324             Mage::throwException($this->_getHelper()->__('Capture action is not available'));
00325         }
00326 
00327         return $this;
00328     }

getCode (  ) 

Retrieve payment method code

Returns:
string

Definition at line 236 of file Abstract.php.

00237     {
00238         if (empty($this->_code)) {
00239             Mage::throwException($this->_getHelper()->__('Can not retrieve payment method code'));
00240         }
00241         return $this->_code;
00242     }

getConfigData ( field,
storeId = null 
)

Retrieve information from payment configuration

Parameters:
string $field
Returns:
mixed

Definition at line 413 of file Abstract.php.

00414     {
00415         if (null === $storeId) {
00416             $storeId = $this->getStore();
00417         }
00418         $path = 'payment/'.$this->getCode().'/'.$field;
00419         return Mage::getStoreConfig($path, $storeId);
00420     }

getFormBlockType (  ) 

Retrieve block type for method form generation

Returns:
string

Definition at line 249 of file Abstract.php.

00250     {
00251         return $this->_formBlockType;
00252     }

getInfoBlockType (  ) 

Retirve block type for display method information

Returns:
string

Definition at line 259 of file Abstract.php.

00260     {
00261         return $this->_infoBlockType;
00262     }

getInfoInstance (  ) 

Retrieve payment iformation model object

Returns:
Mage_Payment_Model_Info

Definition at line 269 of file Abstract.php.

00270     {
00271         $instance = $this->getData('info_instance');
00272         if (!($instance instanceof Mage_Payment_Model_Info)) {
00273             Mage::throwException($this->_getHelper()->__('Can not retrieve payment iformation object instance'));
00274         }
00275         return $instance;
00276     }

getTitle (  ) 

Retrieve payment method title

Returns:
string

Definition at line 402 of file Abstract.php.

00403     {
00404         return $this->getConfigData('title');
00405     }

initialize ( paymentAction,
stateObject 
)

Method that will be executed instead of authorize or capture if flag isInitilizeNeeded set to true

Parameters:
string $paymentAction
Returns:
Mage_Payment_Model_Abstract

Reimplemented in Mage_AmazonPayments_Model_Payment_Asp, Mage_Paypal_Model_Express, Mage_Paypal_Model_Standard, and Mage_PaypalUk_Model_Express.

Definition at line 466 of file Abstract.php.

00467     {
00468         return $this;
00469     }

isAvailable ( quote = null  ) 

Return true if the method can be used at this time

Returns:
bool

Reimplemented in Mage_AmazonPayments_Model_Payment_Asp, Mage_AmazonPayments_Model_Payment_Cba, Mage_GoogleCheckout_Model_Payment, and Mage_Payment_Model_Method_Free.

Definition at line 454 of file Abstract.php.

00455     {
00456         return true;
00457     }

isGateway (  ) 

Retrieve payment system relation flag

Returns:
bool

Definition at line 175 of file Abstract.php.

00176     {
00177         return $this->_isGateway;
00178     }

isInitializeNeeded (  ) 

flag if we need to run payment initialize while order place

Returns:
bool

Reimplemented in Mage_AmazonPayments_Model_Payment_Cba, Mage_Paypal_Model_Express, Mage_Paypal_Model_Standard, and Mage_PaypalUk_Model_Express.

Definition at line 185 of file Abstract.php.

00186     {
00187         return $this->_isInitializeNeeded;
00188     }

prepareSave (  ) 

Parepare info instance for save

Returns:
Mage_Payment_Model_Abstract

Reimplemented in Mage_Payment_Model_Method_Cc.

Definition at line 444 of file Abstract.php.

00445     {
00446         return $this;
00447     }

processBeforeRefund ( invoice,
payment 
)

Definition at line 336 of file Abstract.php.

00337     {
00338         $payment->setRefundTransactionId($invoice->getTransactionId());
00339         return $this;
00340     }

processBeforeVoid ( invoice,
payment 
)

Definition at line 377 of file Abstract.php.

00378     {
00379         $payment->setVoidTransactionId($invoice->getTransactionId());
00380         return $this;
00381     }

processCreditmemo ( creditmemo,
payment 
)

Reimplemented in Mage_AmazonPayments_Model_Payment_Asp.

Definition at line 360 of file Abstract.php.

00361     {
00362         $creditmemo->setTransactionId($payment->getLastTransId());
00363         return $this;
00364     }

processInvoice ( invoice,
payment 
)

Reimplemented in Mage_AmazonPayments_Model_Payment_Asp, and Mage_AmazonPayments_Model_Payment_Cba.

Definition at line 330 of file Abstract.php.

00331     {
00332         $invoice->setTransactionId($payment->getLastTransId());
00333         return $this;
00334     }

refund ( Varien_Object payment,
amount 
)

Refund money

Parameters:
Varien_Object $invoicePayment
Returns:
Mage_Payment_Model_Abstract

Reimplemented in Mage_AmazonPayments_Model_Payment_Cba, Mage_GoogleCheckout_Model_Payment, Mage_Paygate_Model_Authorizenet, Mage_Paygate_Model_Payflow_Pro, Mage_Paypal_Model_Direct, Mage_Paypal_Model_Express, Mage_PaypalUk_Model_Direct, and Mage_PaypalUk_Model_Express.

Definition at line 349 of file Abstract.php.

00350     {
00351 
00352         if (!$this->canRefund()) {
00353             Mage::throwException($this->_getHelper()->__('Refund action is not available'));
00354         }
00355 
00356 
00357         return $this;
00358     }

validate (  ) 

Validate payment method information object

Parameters:
Varien_Object $info
Returns:
Mage_Payment_Model_Abstract

to validate paymene method is allowed for billing country or not

Reimplemented in Mage_Payment_Model_Method_Cc, and Mage_Paypal_Model_Standard.

Definition at line 284 of file Abstract.php.

00285     {
00286          /**
00287           * to validate paymene method is allowed for billing country or not
00288           */
00289          $paymentInfo = $this->getInfoInstance();
00290          if ($paymentInfo instanceof Mage_Sales_Model_Order_Payment) {
00291              $billingCountry = $paymentInfo->getOrder()->getBillingAddress()->getCountryId();
00292          } else {
00293              $billingCountry = $paymentInfo->getQuote()->getBillingAddress()->getCountryId();
00294          }
00295          if (!$this->canUseForCountry($billingCountry)) {
00296              Mage::throwException($this->_getHelper()->__('Selected payment type is not allowed for billing country.'));
00297          }
00298          return $this;
00299     }

void ( Varien_Object payment  ) 

Void payment

Parameters:
Varien_Object $invoicePayment
Returns:
Mage_Payment_Model_Abstract

Reimplemented in Mage_GoogleCheckout_Model_Payment, Mage_Paygate_Model_Authorizenet, Mage_Paygate_Model_Payflow_Pro, Mage_Paypal_Model_Direct, Mage_Paypal_Model_Express, Mage_PaypalUk_Model_Direct, and Mage_PaypalUk_Model_Express.

Definition at line 389 of file Abstract.php.

00390     {
00391         if (!$this->canVoid($payment)) {
00392             Mage::throwException($this->_getHelper()->__('Void action is not available'));
00393         }
00394         return $this;
00395     }


Member Data Documentation

$_canAuthorize = false [protected]

$_canCapture = false [protected]

$_canCapturePartial = false [protected]

$_canRefund = false [protected]

$_canRefundInvoicePartial = false [protected]

Reimplemented in Mage_GoogleCheckout_Model_Payment.

Definition at line 56 of file Abstract.php.

$_canUseCheckout = true [protected]

$_canUseForMultishipping = true [protected]

$_canUseInternal = true [protected]

$_canVoid = false [protected]

$_code [protected]

$_formBlockType = 'payment/form' [protected]

$_infoBlockType = 'payment/info' [protected]

$_isGateway = false [protected]

$_isInitializeNeeded = false [protected]

const ACTION_AUTHORIZE = 'authorize'

Reimplemented in Mage_AmazonPayments_Model_Payment, and Mage_GoogleCheckout_Model_Payment.

Definition at line 34 of file Abstract.php.

const ACTION_AUTHORIZE_CAPTURE = 'authorize_capture'

Reimplemented in Mage_AmazonPayments_Model_Payment, and Mage_GoogleCheckout_Model_Payment.

Definition at line 35 of file Abstract.php.

const STATUS_APPROVED = 'APPROVED'

Definition at line 38 of file Abstract.php.

const STATUS_DECLINED = 'DECLINED'

Definition at line 40 of file Abstract.php.

const STATUS_ERROR = 'ERROR'

Definition at line 39 of file Abstract.php.

const STATUS_SUCCESS = 'SUCCESS'

Definition at line 42 of file Abstract.php.

const STATUS_UNKNOWN = 'UNKNOWN'

Definition at line 37 of file Abstract.php.

const STATUS_VOID = 'VOID'

Definition at line 41 of file Abstract.php.


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:24:32 2009 for Magento by  doxygen 1.5.8