2016-03-03 154 views
2

如何查看eway进行的当前交易以及如果支付成功,我如何更新过期日期和时间。eWay支付网关定期支付

是否有任何函数来检查eway所做的最近交易。

$requestbody = array(
      'RebillCustomerID' => $rebillCustomerID, 
      'RebillID' => $rebillID 
     ); 
     $client = $this->createObjet(); 
     return $result = $client->QueryTransactions($requestbody); 

我使用这个,但在返回所有交易细节。 如果还有其他选择,请帮助我。

回答

1

没有一个API只返回eWAY经常性的最新事务。您可以通过查找任何非“待定”或“未来”交易的最近交易时间来查找当前交易。

这样做会去为一个简单的例子如下:

$requestbody = array(
    'RebillCustomerID' => $rebillCustomerID, 
    'RebillID' => $rebillID 
); 

$result = $client->QueryTransactions($requestbody); 

$current = mostRecent($result); 

function mostRecent ($result){ 
    $return = ''; 
    foreach ($result->QueryTransactionsResult->rebillTransaction as $r) { 
     $mostRecent = 0; 
     if ($r->Status != 'Pending' && $r->Status != 'Future') { 
      $curDate = strtotime($r->TransactionDate); 
      if ($curDate > $mostRecent) { 
       $mostRecent = $curDate; 
       $return = $r; 
      } 
     } 
    } 
    return $return; 
}