So, horray - I'm trying to create a new custom payment gateway. It is intended for authentication / capture through a third-party API, but should NOT be redirected to a third-party site.
From my understanding, when an order is placed / finalized in Magento, and the gateway is set to “Authorize and capture”, it should disable the “capture” method from the gateway model. Currently, he does not.
Of course, if I specifically capture from the "Administrator" view, he will try to capture, but this should happen immediately after verification (and again, I understand that he should already).
In my gateway model, I have the following (truncated for readability):
<?php
class Example_Gateway_Model_Payment extends Mage_Payment_Model_Method_Cc
{
protected $_code = 'example';
protected $_isGateway = true;
protected $_canAuthorize = true;
protected $_canCapture = true;
protected $_canUseInternal = true;
protected $_canUseCheckout = true;
protected $_formBlockType = 'example/form_example';
public function authorize(Varien_Object $payment, $amount)
{
Mage::log('Authorizing!');
}
public function capture(Varien_Object $payment, $amount)
{
Mage::log('** Capturing **');
}
public function assignData($data)
{
Mage::log('Assigning Data');
}
}
- assignData() validate(), __construct(), . , , .
config.xml :
<?xml version="1.0"?>
<config>
<modules>
<Example_Gateway>
<version>0.0.5</version>
</Example_Gateway>
</modules>
<global>
<blocks>
<gateway>
<class>Example_Gateway_Block</class>
</gateway>
</blocks>
<models>
<gateway>
<class>Example_Gateway_Model</class>
</gateway>
</models>
<helpers>
<gateway>
<class>Example_Gateway_Helper</class>
</gateway>
</helpers>
</global>
<frontend>
</frontend>
<default>
<payment>
<gateway>
<sort_order>0</sort_order>
<model>gateway/payment</model>
<enabled>1</enabled>
<order_staus>processing</order_status>
<payment_action>authorize_capture</payment_action>
<cctypes>VI,MC,AE,DI</cctypes>
<useccv>1</useccv>
</gateway>
</payment>
</default>
</config>
, , ; , sales_flat_order_payment / (txn id ..)
, CC , .
? - , .
!
UPDATE:
, checkout_type_onepage_save_order, capture() , , .
, , Magento capture() , authorize_capture, .?