Problem with New Payment Gateway

Discussion in 'Payments processing' started by marlon4, May 12, 2012.

  1. marlon4

    marlon4 New Member

    Joined:
    Apr 26, 2012
    Messages:
    2
    Hi!

    I'm trying to add a new Payment Gateway using the example that you've shared in your Documentation site (http://www.amember.com/docs/API/Paysystem). I could customize it as per my Payment Gateway's requirement except one thing. My Gateway only accept request using HTTP POST method. But when I was trying to use the example shown in the site, it sends the request using HTTP GET method.

    Is there anyway I can use HTTP POST method to send payment request to my Gateway?

    For your convenience I'm sharing the Am_Paysystem_MyPaySystem below:

    PHP:
    class Am_Paysystem_MyPaySystem extends Am_Paysystem_Abstract
    {
        const 
    PLUGIN_STATUS self::STATUS_PRODUCTION// do not add plugin into production build
        
    const PLUGIN_REVISION '@@VERSION@@'// auto-replaced with production version
     
        
    const URL "http://www.gateway.com/test/payment.php";
        protected 
    $defaultTitle 'MyPaySystem';
        protected 
    $defaultDescription 'Pay using MyPaySystem payment gateway';
        public function 
    getSupportedCurrencies()
        {
              return array(
    'MYR''GBP''EUR''USD');
        }
        
    // 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)
        {
            
    $form->addText('merchant_code', array('size'=>16))
                ->
    setLabel('Merchant Code');
            
    $form->addPassword('merchant_key', array('size'=>16))
                ->
    setLabel('Merchant Key');
        }
        
    /// now lets write payment redirect function
        
    public function _process(Invoice $invoiceAm_Request $requestAm_Paysystem_Result $result)
        {
            
    $a = new Am_Paysystem_Action_Redirect(self::URL);
            
    $a->MerchantCode $this->getConfig('merchant_code');
    //        $a->PaymentId  = $invoice->getLineDescription();
            
    $a->RefNo $invoice->public_id;
            
    $a->Amount =  $invoice->first_total;
    //        $a->sp  = $invoice->second_total;
            
    $a->UserName $invoice->getName();
            
    // set [em] to customer email address
              
    $a->Currency $invoice->currency;
            
    $a->UserEmail $invoice->getEmail();
            
    $a->UserContact $invoice->getPhone();
            
    $a->Remark $invoice->getLineDescription();
            
    $a->Lang 'UTF-8';
            
    $a->ResponseURL $this->getReturnUrl();
            
    // set [lnk] to "cancel" url where customer may choose other payprocessor for this payment
            
    $a->lnk $this->getCancelUrl();
            
    // now return it to core and aMember will do the rest
            
    $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
    Some Description about MyPaySystem
    CUT;
        }
     
        public function 
    createTransaction(Am_Request $requestZend_Controller_Response_Http $response, array $invokeArgs)
        {
            return new 
    Am_Paysystem_Transaction_MyPaySystem($this$request$response$invokeArgs);
        }
    }
    What method should I add or change in the class Am_Paysystem_MyPaySystem to make sure it uses HTTP POST method to send the payment request?

    Thanks for your help.

    Regards,

    --marlon4

Share This Page