Custom Payment plugin - NAB transact

Discussion in 'Customization & add-ons' started by glyn_szasz, May 21, 2013.

  1. glyn_szasz

    glyn_szasz New Member

    Joined:
    Feb 4, 2013
    Messages:
    12
    I am awfully confused and getting a little out of depth and probably just need a prod in the right direction. I need to integrate NAB transact into aMember.
    Going through the documentation you need to add a number of hidden fields to your form which I can do via a HTML text brick within the form editor. These hidden fields look like:
    HTML:
    <input type="hidden" name="refund_policy" value="http://www.onpower.com.au/refund_policy.html">
    <input type="hidden" name="privacy_policy" value="http://www.onpower.com.au/legal/privacy-policy.html">
    <input type="hidden" name="information_fields" value="name_f,name_l,company,email">
    <input type="hidden" name="receipt_address" value="<<email>>">
    <input type="hidden" name="print_zero_qty" value="FALSE">
    <input type="hidden" name="get_added" value="true">
    Once the form is processed it needs to be sent to "https://transact.nab.com.au/test/hpp/payment".
    So my plugin looks like the below so far:
    PHP:
    <?php
     
    class Am_Paysystem_NAB extends Am_Paysystem_Abstract
    {
        const 
    PLUGIN_STATUS self::STATUS_DEV// do not add plugin into production build
        
    const PLUGIN_REVISION '0.01'// auto-replaced with production version
     
        
    const URL 'https://transact.nab.com.au/test/hpp/payment'// test payment url
     
        
    protected $defaultTitle 'NAB - credit card payment';
        protected 
    $defaultDescription 'purchase using MasterCard or Visa';
     
        
    // here you add elements to HTML_QuickForm2 form with
        // parameters necessary to configure your form
        // saved parameters are available with $this->getConfig('paramname')
        // api call in other plugin functions 
        
    public function _initSetupForm(Am_Form_Setup $form)
        {
        }
        
    /// now lets write payment redirect function
        
    public function _process(Invoice $invoiceAm_Request $requestAm_Paysystem_Result $result)
        {
            
    $a = new Am_Paysystem_Action_Redirect(self::URL);
            
    $result->setAction($a);
        }
        
    // let aMember know how this plugin is going to deal with recurring payments
        
    public function getRecurringType()
        {
            return 
    self::REPORTS_EOT;
        }
     
        public function 
    getReadme()
        {
    return <<<CUT
        My payment plugin readme
     
    Readme instructions here....
    CUT;
        }
     
        public function 
    createTransaction(Am_Request $requestZend_Controller_Response_Http $response, array $invokeArgs)
        {
            return new 
    Am_Paysystem_Transaction_Yourps_Ipn($this$request$response$invokeArgs);
        }
    }
    Where am I going wrong? I am hoping that the user will select the NAB payment button then click on the Next button and be taken to the NAB credit card payment page. Once the button is clicked the relevent fields of the form are sent via POST to NAB.

    Any advice is gratefully accepted. I apologise if I have posted this in the wrong area.

    Thanks in advance.

Share This Page