Best way to convert Authorize.NET plugin to use "Authorize Only" payment method

Started by iantrobbins, July 11, 2012, 05:38:08 AM

Previous topic - Next topic

iantrobbins

I've looked around, but haven't been able to find anything that might clearly define the approach I need to take to convert the standard Authorize.NET plugin used in VirtueMart 2 from its standard "AUTH_CAPTURE" payment method (which charges the shopper's card right as soon as the order is purchased) to an "AUTH_ONLY" method (which checks to see if the shopper's card has the funds, but only bills their card manually when the order ships out).

I've seen several comments about changing this parameter in the admin interface, but I haven't been lucky enough to see a setting for this in VirtueMart's admin panel. My first assumption would be to simply change the 'x_type' parameter in the array in the '_setTransactionData($orderDetails)' function from "AUTH_CAPTURE" to "AUTH_ONLY" (located in the file: /plugins/vmpayment/authorizenet/authorizenet.php'), but I'm not sure if its that simple, or if there are additional steps/protocols that need to be in place to do this.

Thank you for your replies!
-Ian

iantrobbins

Hopefully I'm not "jumping the gun", but I may have found the answer to my issue in the com_virtuemart.2.0.8 version of the payment method plugin, it looks like there is a piece of code in there that may be just what I need... I could be wrong, but it seems that this may be the ticket:

function _setTransactionData ($orderDetails, $method) {
// backward compatible
      if (isset($method->xtype)) {
         $xtype = $method->xtype;
      }
      else {
         $xtype = 'AUTH_CAPTURE';
      }
      return array(
         'x_amount'            => $orderDetails->order_total,
         'x_invoice_num'       => $orderDetails->order_number,
         'x_method'            => 'CC',
         'x_type'              => $xtype,
         'x_recurring_billing' => 0, //$this->_recurringPayment($params),
         'x_card_num'          => $this->_cc_number,
         'x_card_code'         => $this->_cc_cvv,
         'x_exp_date'          => $this->_getFormattedDate ($this->_cc_expire_month, $this->_cc_expire_year)
      );
   }


(please let me know if I'm on the right track or not... The version of the payment method plugin I have currently installed only has the 'x_type' => 'AUTH_CAPTURE' available... this may be my answer, which might offer the 'AUTH_ONLY' method... I'll let you know what I find out!)

iantrobbins

Just wanted to provide an update to this issue. I think I've found a way to hook into the event system finally! It seems that the following event hooks into the order status update like I need: plgVmOnUpdateOrderShipment .... I had no idea about this event/hook, as it wasn't in the VM plugin documentation.

Another thing I've come across is the fact that the Payment and Shipment plugins (vmpayment and vmshipment, respectively) have been phased out and replaced with a combined plugin class by the name of vmPSplugin, which seems to provide functionality for both payment and shipping (please correct me if I'm wrong about any of this... this is just what I've gathered through my stumbling through it). I'm sure all of you are aware, but these items should be included in the wiki asap.

I'll provide an update if I find out anything more or when I finish this task.