_data[self::INSTID])) {
return true;
}
return false;
}
/**
*
* get setup form elements
*
* @return array
*/
public function getElements()
{
$translate = $this->getTranslate();
return array(
array(
'form_id' => 'WorldPay',
'id' => self::INSTID,
'element' => 'text',
'label' => $this->_('WorldPay ID'),
'description' => $translate->_('Enter your merchant installation Id
'
. 'WorldPay IPN URL:
') . $this->getIpnUrl(),
'attributes' => array(
'class' => 'form-control input-medium',
),
),
);
}
public function formElements()
{
return array(
array(
'id' => self::INSTID,
'value' => $this->_data[self::INSTID],
'element' => 'hidden',
),
array(
'id' => 'cartId',
'value' => $this->getTransactionId(),
'element' => 'hidden',
),
array(
'id' => 'amount',
'value' => $this->getAmount(),
'element' => 'hidden',
),
array(
'id' => 'currency',
'value' => $this->getCurrency(),
'element' => 'hidden',
),
array(
'id' => 'desc',
'value' => $this->getName(),
'element' => 'hidden',
),
array(
'id' => 'MC_callback',
'value' => $this->getIpnUrl(),
'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('transStatus');
$this->setTransactionId($request->getParam('cartId'))
->setAmount($request->getParam('amount'))
->setCurrency($request->getParam('currency'))
->setGatewayPaymentStatus($request->getParam('rawAuthMessage'))
->setGatewayTransactionCode($request->getParam('transId'));
if ($paymentStatus == 'Y') {
$response = true;
}
}
return $response;
}
}