_data[self::MERCHANT_ID])) {
return true;
}
return false;
}
/**
*
* get setup form elements
*
* @return array
*/
public function getElements()
{
$translate = $this->getTranslate();
return array(
array(
'form_id' => 'Paymate',
'id' => self::MERCHANT_ID,
'element' => 'text',
'label' => $this->_('Paymate Username'),
'description' => $translate->_('Enter the username you use to log into the Paymate website
'
. 'Paymate IPN URL:
') . $this->getIpnUrl(),
'attributes' => array(
'class' => 'form-control input-medium',
),
),
);
}
public function formElements()
{
return array(
array(
'id' => self::MERCHANT_ID,
'value' => $this->_data[self::MERCHANT_ID],
'element' => 'hidden',
),
array(
'id' => 'amt',
'value' => $this->getAmount(),
'element' => 'hidden',
),
array(
'id' => 'amt_editable',
'value' => 'N',
'element' => 'hidden',
),
array(
'id' => 'currency',
'value' => $this->getCurrency(),
'element' => 'hidden',
),
array(
'id' => 'return',
'value' => $this->getIpnUrl(),
'element' => 'hidden',
),
array(
'id' => 'ref',
'value' => $this->getTransactionId(),
'element' => 'hidden',
),
array(
'id' => 'popup',
'value' => 'false',
'element' => 'hidden',
),
);
}
public function getPostUrl()
{
return self::POST_URL;
}
/**
*
* process ipn
*
* @param \Cube\Controller\Request\AbstractRequest $request
*
* @return bool
*/
public function processIpn(AbstractRequest $request)
{
$response = false;
if ($request->isPost()) {
$paymentStatus = $request->getParam('responseCode');
$this->setTransactionId($request->getParam('ref'))
->setAmount($request->getParam('paymentAmount'))
->setCurrency($request->getParam('currency'))
->setGatewayPaymentStatus($request->getParam('responseCode'))
->setGatewayTransactionCode($request->getParam('transactionID'));
if ($paymentStatus == 'PA') {
$response = true;
}
}
return $response;
}
}