VirtueMart Forum

VirtueMart Dev/Coding Central: VM1 (old version) => Development Projects, Modifications, Hacks & Tweaks. VM1.1 => Payment Modules => Topic started by: doorboy on May 28, 2009, 18:33:45 PM

Title: Modification for payment classes
Post by: doorboy on May 28, 2009, 18:33:45 PM
Hello, I have recently created a payment class for AAFES star cards.  This is sort of the military credit card.  Anyway, I needed a very similar transaction to the authorize class and needed to have capture_payment be called when the order was set to confirmed.  Is there anyway to do this normally.

Basically, I just modified ps_order, starting around line 80, by adding a case if the class was not equal to "ps_authorize":

elseif($payment_class !="ps_authorize" && $payment_class !="payflow_pro")
{
    //call capture_payment if it exists in the class
    require_once( CLASSPATH."payment/".$payment_class.".php");
    $cl_object = new $payment_class();
    $d["order_number"] = $db->f("order_number");
    if (method_exists($cl_object,'capture_payment')==true){
        if( !$cl_object->capture_payment( $d )) {
            return false;
        }
    }
}

Why isn't this already there?  It seems bad to have hard-coded cases for authorize and payflow.

Also, the payflow class is still incorrect in the code.  The file has "ps_pfp.php" rather than "payflow_pro.php".