Mage_GoogleCheckout_Model_Payment Class Reference

Inheritance diagram for Mage_GoogleCheckout_Model_Payment:

Mage_Payment_Model_Method_Abstract Varien_Object

List of all members.

Public Member Functions

 canEdit ()
 isAvailable ($quote=null)
 getOrderPlaceRedirectUrl ()
 authorize (Varien_Object $payment, $amount)
 capture (Varien_Object $payment, $amount)
 refund (Varien_Object $payment, $amount)
 void (Varien_Object $payment)
 cancel (Varien_Object $payment)

Public Attributes

const ACTION_AUTHORIZE = 0
const ACTION_AUTHORIZE_CAPTURE = 1

Protected Attributes

 $_code = 'googlecheckout'
 $_formBlockType = 'googlecheckout/form'
 $_isGateway = false
 $_canAuthorize = true
 $_canCapture = true
 $_canCapturePartial = true
 $_canRefund = true
 $_canRefundInvoicePartial = true
 $_canVoid = true
 $_canUseInternal = false
 $_canUseCheckout = false
 $_canUseForMultishipping = false


Detailed Description

Definition at line 27 of file Payment.php.


Member Function Documentation

authorize ( Varien_Object payment,
amount 
)

Authorize

Parameters:
Varien_Object $orderPayment
Returns:
Mage_GoogleCheckout_Model_Payment

Reimplemented from Mage_Payment_Model_Method_Abstract.

Definition at line 86 of file Payment.php.

00087     {
00088         $api = Mage::getModel('googlecheckout/api')->setStoreId($payment->getOrder()->getStoreId());
00089         $api->authorize($payment->getOrder()->getExtOrderId());
00090 
00091         return $this;
00092     }

cancel ( Varien_Object payment  ) 

Void payment

Parameters:
Varien_Object $invoicePayment
Returns:
Mage_GoogleCheckout_Model_Payment

Reimplemented from Mage_Payment_Model_Method_Abstract.

Definition at line 163 of file Payment.php.

00164     {
00165         if (!$payment->getOrder()->getBeingCanceledFromGoogleApi()) {
00166             $hlp = Mage::helper('googlecheckout');
00167             $reason = $this->getReason() ? $this->getReason() : $hlp->__('Unknown Reason');
00168             $comment = $this->getComment() ? $this->getComment() : $hlp->__('No Comment');
00169 
00170             $api = Mage::getModel('googlecheckout/api')->setStoreId($payment->getOrder()->getStoreId());
00171             $api->cancel($payment->getOrder()->getExtOrderId(), $reason, $comment);
00172         }
00173 
00174         return $this;
00175     }

canEdit (  ) 

Can be edit order (renew order)

Returns:
bool

Reimplemented from Mage_Payment_Model_Method_Abstract.

Definition at line 54 of file Payment.php.

00055     {
00056         return false;
00057     }

capture ( Varien_Object payment,
amount 
)

Capture payment

Parameters:
Varien_Object $orderPayment
Returns:
Mage_GoogleCheckout_Model_Payment

Reimplemented from Mage_Payment_Model_Method_Abstract.

Definition at line 100 of file Payment.php.

00101     {
00102         /*
00103         try {
00104             $this->authorize($payment, $amount);
00105         } catch (Exception $e) {
00106             // authorization is not expired yet
00107         }
00108         */
00109 
00110         if ($payment->getOrder()->getPaymentAuthorizationExpiration() < Mage::getModel('core/date')->gmtTimestamp()) {
00111             try {
00112                 $this->authorize($payment, $amount);
00113             } catch (Exception $e) {
00114                 // authorization is not expired yet
00115             }
00116         }
00117 
00118         $api = Mage::getModel('googlecheckout/api')->setStoreId($payment->getOrder()->getStoreId());
00119         $api->charge($payment->getOrder()->getExtOrderId(), $amount);
00120         $payment->setForcedState(Mage_Sales_Model_Order_Invoice::STATE_OPEN);
00121 
00122         return $this;
00123     }

getOrderPlaceRedirectUrl (  ) 

Return Order Place Redirect URL

Returns:
string Order Redirect URL

Definition at line 75 of file Payment.php.

00076     {
00077         return Mage::getUrl('googlecheckout/redirect/redirect');
00078     }

isAvailable ( quote = null  ) 

Return true if the method can be used at this time Use google/checkout/active flag of admin module config

Returns:
bool

Reimplemented from Mage_Payment_Model_Method_Abstract.

Definition at line 65 of file Payment.php.

00066     {
00067         return Mage::getStoreConfig('google/checkout/active') > 0;
00068     }

refund ( Varien_Object payment,
amount 
)

Refund money

Parameters:
Varien_Object $invoicePayment
Returns:
Mage_GoogleCheckout_Model_Payment

Reimplemented from Mage_Payment_Model_Method_Abstract.

Definition at line 132 of file Payment.php.

00133     {
00134         $hlp = Mage::helper('googlecheckout');
00135 
00136 //        foreach ($payment->getCreditMemo()->getCommentsCollection() as $comment) {
00137 //            $this->setReason($hlp->__('See Comments'));
00138 //            $this->setComment($comment->getComment());
00139 //        }
00140 
00141         $reason = $this->getReason() ? $this->getReason() : $hlp->__('No Reason');
00142         $comment = $this->getComment() ? $this->getComment() : $hlp->__('No Comment');
00143 
00144         $api = Mage::getModel('googlecheckout/api')->setStoreId($payment->getOrder()->getStoreId());
00145         $api->refund($payment->getOrder()->getExtOrderId(), $amount, $reason, $comment);
00146 
00147         return $this;
00148     }

void ( Varien_Object payment  ) 

Void payment

Parameters:
Varien_Object $invoicePayment
Returns:
Mage_Payment_Model_Abstract

Reimplemented from Mage_Payment_Model_Method_Abstract.

Definition at line 150 of file Payment.php.

00151     {
00152         $this->cancel($payment);
00153 
00154         return $this;
00155     }


Member Data Documentation

$_canAuthorize = true [protected]

Reimplemented from Mage_Payment_Model_Method_Abstract.

Definition at line 39 of file Payment.php.

$_canCapture = true [protected]

Reimplemented from Mage_Payment_Model_Method_Abstract.

Definition at line 40 of file Payment.php.

$_canCapturePartial = true [protected]

Reimplemented from Mage_Payment_Model_Method_Abstract.

Definition at line 41 of file Payment.php.

$_canRefund = true [protected]

Reimplemented from Mage_Payment_Model_Method_Abstract.

Definition at line 42 of file Payment.php.

$_canRefundInvoicePartial = true [protected]

Reimplemented from Mage_Payment_Model_Method_Abstract.

Definition at line 43 of file Payment.php.

$_canUseCheckout = false [protected]

Reimplemented from Mage_Payment_Model_Method_Abstract.

Definition at line 46 of file Payment.php.

$_canUseForMultishipping = false [protected]

Reimplemented from Mage_Payment_Model_Method_Abstract.

Definition at line 47 of file Payment.php.

$_canUseInternal = false [protected]

Reimplemented from Mage_Payment_Model_Method_Abstract.

Definition at line 45 of file Payment.php.

$_canVoid = true [protected]

Reimplemented from Mage_Payment_Model_Method_Abstract.

Definition at line 44 of file Payment.php.

$_code = 'googlecheckout' [protected]

Reimplemented from Mage_Payment_Model_Method_Abstract.

Definition at line 32 of file Payment.php.

$_formBlockType = 'googlecheckout/form' [protected]

Reimplemented from Mage_Payment_Model_Method_Abstract.

Definition at line 33 of file Payment.php.

$_isGateway = false [protected]

Availability options

Reimplemented from Mage_Payment_Model_Method_Abstract.

Definition at line 38 of file Payment.php.

const ACTION_AUTHORIZE = 0

Reimplemented from Mage_Payment_Model_Method_Abstract.

Definition at line 29 of file Payment.php.

Reimplemented from Mage_Payment_Model_Method_Abstract.

Definition at line 30 of file Payment.php.


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

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