This repository has been archived on 2026-10-23. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
inside/includes/payex2/payex_pxaccount.php
T
nikolark 52cc657538 Major cleanups
* Structures static file locations
* Moves index.php to /
* Updates paths all over
* Hides menu items of unused features
* Hides menu items of legacy features
* Adds README
2012-04-20 23:45:21 +02:00

151 lines
3.5 KiB
PHP

<?php
require_once('payex.php');
/**
* Class for using the Client/PxAccount Payex webservice.
* Please report bugs to support.solutions@payex.no
*
* @author Jon Helge Stensrud, Keyteq AS
* @version 5.3
*
*/
class PayexPxAccount extends Payex
{
var $transactions;
function PayexPxAccount($setup = false)
{
$this->__setup($setup);
$this->__createClient($this->__setup->getPxAccountWSDL());
}
function getTransactions()
{
return $this->transactions;
}
function ListTransactions($clientType, $clientRef, $maxRowCount, $filterByTransactionNumber)
{
$hash = $this->__generateHash($this->__accountNumber, $clientType, $clientRef, $maxRowCount, $filterByTransactionNumber);
$params = array(
'accountNumber' => $this->__accountNumber,
'clientType' => $clientType,
'clientRef' => $clientRef,
'maxRowCount' => $maxRowCount,
'filterByTransactionNumber' => $filterByTransactionNumber,
'hash' => $hash
);
$return_data = $this->client->ListTransactions($params);
$this->transactions = array();
if ( $this->__processResponse($return_data) )
{
if ( is_array($return_data) )
$resptext = array_pop($return_data);
else
$resptext = $return_data;
// parse transactions xml.
$xmlroot = &new KQXmlobj();
$xmlroot->from_xml($resptext);
// get <transactions>-tag
if ( $transactionsXml = &$xmlroot->get_child('transactions') )
{
// loop through all <transaction>-tags
while ( $transactionXml = &$transactionsXml->get_child('transaction') )
{
// fill Transaction transfer-object with values from xml
$transaction = new PayexPxAccountTransaction();
$transaction->setTransactionNumber($transactionXml->get_value('transactionNumber'));
$transaction->setTransactionDate($transactionXml->get_value('transactionDate'));
$transaction->setName($transactionXml->get_value('name'));
$transaction->setTransactionDescription($transactionXml->get_value('transactionDescription'));
$transaction->setAmount($transactionXml->get_value('amount'));
$transaction->setCurrency($transactionXml->get_value('currency'));
$transaction->setPaymentMethod($transactionXml->get_value('paymentMethod'));
// add transaction to array, to be returned by $this->getTransactions()
$this->transactions[] = $transaction;
}
}
return true;
}
return false;
}
}
class PayexPxAccountTransaction
{
var $transactionNumber;
var $transactionDate;
var $name;
var $transactionDescription;
var $amount;
var $currency;
var $paymentMethod;
function getTransactionNumber()
{
return $this->transactionNumber;
}
function setTransactionNumber($transactionNumber)
{
$this->transactionNumber = $transactionNumber;
}
function getTransactionDate()
{
return $this->transactionDate;
}
function setTransactionDate($transactionDate)
{
$this->transactionDate = $transactionDate;
}
function getName()
{
return $this->name;
}
function setName($name)
{
$this->name = $name;
}
function getTransactionDescription()
{
return $this->transactionDescription;
}
function setTransactionDescription($transactionDescription)
{
$this->transactionDescription = $transactionDescription;
}
function getAmount()
{
return $this->amount;
}
function setAmount($amount)
{
$this->amount = $amount;
}
function getCurrency()
{
return $this->currency;
}
function setCurrency($currency)
{
$this->currency = $currency;
}
function getPaymentMethod()
{
return $this->paymentMethod;
}
function setPaymentMethod($paymentMethod)
{
$this->paymentMethod = $paymentMethod;
}
}
?>