2013-07-10 38 views
0

我正在使用自定義付款解決方案,並且一直在通知magento付款被接受或拒絕。magento定製支付網關通知

我有一個PaymentController.php文件,需要輸入代碼來處理這個問題。

支付網關在下面提供了HTTP GET請求。

http://www.websitename.co.uk/mygateway/payment/response?SessionID=&Note=&Tariff=&Status=

  1. SessionID的是由支付網關分配一個唯一的ID

  2. 注意是將其通過的magento產生

  3. 資費是爲了在便士即價格將訂單100P

  4. 狀態是付款狀態,大約有10迪菲租金類型和狀態= 100是一個成功的支付和狀態= 200是一個失敗的支付

所以它可能是http://www.websitename.co.uk/mygateway/payment/response?SessionID=123456&Note=1000051&Tariff=300&Status=100

我不知道如何創建的代碼來處理這個信息要求和工作出狀態

我需要把這個領域的paymentcontroller

public function responseAction() { 
    if($this->getRequest()->isPost()) { 

     /* 
     /* Your gateway's code to make sure the reponse you 
     /* just got is from the gatway and not from some weirdo. 
     /* This generally has some checksum or other checks, 
     /* and is provided by the gateway. 
     /* For now, we assume that the gateway's response is valid 
     */ 

     $validated = true; 
     $orderId = ''; 

     if($validated) { 

回答

0

使用Zend_Http_Client之間的代碼類。

你會發現你需要在這個小教程知道從zend的一切:

http://framework.zend.com/manual/1.12/de/zend.http.client.html

一個快速和骯髒的方法是:

$client = new Zend_Http_Client('http://www.websitename.co.uk/mygateway/payment/response?SessionID=123456&Note=1000051&Tariff=300&Status=100'); 
$response = $client->request(); 

然後檢查響應和你的好去。祝你好運!

+0

感謝您的幫助Mischa Leiss。我已經瀏覽了tutuorial,但是對於這件事還是比較新的,並且有點卡住了。想知道是否可以根據我上面的代碼給我多一點指導。 – user2496374

+0

謝謝米莎萊斯,我仍然堅持這一點。所以上面的代碼我會放在我的代碼中的if語句之前?但是,如何檢查響應並將其設置爲動態,因爲URL每次都會有不同的備註(訂單號)和狀態。這可能是很明顯的解決,但我真的堅持這一點,所以將不勝感激任何更多的幫助,你可以給。 – user2496374