1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135:
<?php
/**
* Viva Payments (REST) Fetch Transactions Request
*/
namespace Omnipay\VivaPayments\Message;
/**
* Viva Payments (REST) Fetch Transactions Request
*
* This method allows you to obtain:
*
* * Details for all transactions for a given Payment Order.
* * A list of all transactions that occurred on a given day.
*
* ### Example
*
* Possible parameters are:
*
* * date -- the date on which the transaction was made.
* * clearanceDate -- the date on which the transaction was cleared.
* * transactionReference -- the ID of a transaction, as returned by the GET parameter
* when redirecting a customer back to your site. This will be a 36 character UUID.
* * transactionId -- the Order Code which will be the 12 or 16 digit code returned from
* a purchase() request.
*
* <code>
* $transaction = $gateway->fetchTransactions(array(
* 'transactionReference' => $transaction_id,
* ));
* $response = $transaction->send();
* if ($response->isSuccessful()) {
* $transactionList = $response->getData();
* } else {
* echo "Fetch transactions failed.\n";
* echo "Error code == " . $response->getCode() . "\n";
* echo "Error message == " . $response->getMessage() . "\n";
* }
* </code>
*
* @see Omnipay\VivaPayments\RestGateway
* @link https://github.com/VivaPayments/API/wiki
* @link https://www.vivawallet.com/en-us/company
* @link https://github.com/VivaPayments/API/wiki/GetTransactions
*/
class FetchTransactionsRequest extends AbstractRestRequest
{
/**
* Get the transaction date.
*
* YYYY-MM-DD format appears to be used by the gateway.
*
* @return string
*/
public function getDate()
{
return $this->getParameter('date');
}
/**
* Set the transaction date.
*
* YYYY-MM-DD format appears to be used by the gateway.
*
* @param string $value
* @return AbstractRestRequest provides a fluent interface.
*/
public function setDate($value)
{
return $this->setParameter('date', $value);
}
/**
* Get the transaction clearance date.
*
* YYYY-MM-DD format appears to be used by the gateway.
*
* @return string
*/
public function getClearanceDate()
{
return $this->getParameter('clearanceDate');
}
/**
* Set the transaction clearance date.
*
* YYYY-MM-DD format appears to be used by the gateway.
*
* @param string $value
* @return AbstractRestRequest provides a fluent interface.
*/
public function setClearanceDate($value)
{
return $this->setParameter('clearanceDate', $value);
}
public function getData()
{
$data = array();
if ($this->getDate()) {
$data['date'] = $this->getDate();
}
if ($this->getClearanceDate()) {
$data['clearancedate'] = $this->getClearanceDate();
}
if ($this->getTransactionId()) {
$data['ordercode'] = $this->getTransactionId();
}
return array_merge($data, parent::getData());
}
protected function getHttpMethod()
{
return 'GET';
}
/**
* Get transaction endpoint.
*
* Purchases are created using the /purchases resource.
*
* @return string
*/
protected function getEndpoint()
{
if ($this->getTransactionReference()) {
return parent::getEndpoint() . '/transactions/' . $this->getTransactionReference();
}
return parent::getEndpoint() . '/transactions/';
}
}