/**
  * Action Listener to execute the capture for applicable transactions
  *
  */
 public function refundAction()
 {
     $result = false;
     $code = null;
     require_once dirname(__FILE__) . '/../../lib/Services/Paymill/Transactions.php';
     require_once dirname(__FILE__) . '/../../lib/Services/Paymill/Refunds.php';
     $swConfig = Shopware()->Plugins()->Frontend()->PaymPaymentCreditcard()->Config();
     $refund = new Services_Paymill_Refunds(trim($swConfig->get("privateKey")), 'https://api.paymill.com/v2/');
     $transactionObject = new Services_Paymill_Transactions(trim($swConfig->get("privateKey")), 'https://api.paymill.com/v2/');
     $modelHelper = new Shopware_Plugins_Frontend_PaymPaymentCreditcard_Components_ModelHelper();
     $orderNumber = $modelHelper->getOrderNumberById($this->Request()->getParam("orderId"));
     $transactionId = $modelHelper->getPaymillTransactionId($orderNumber);
     $transactionResult = $transactionObject->getOne($transactionId);
     //Create Transaction
     $parameter = array('transactionId' => $transactionId, 'params' => array('amount' => $transactionResult['amount'], 'description' => $transactionResult['client']['email'] . " " . Shopware()->Config()->get('shopname')));
     $response = $refund->create($parameter);
     if (isset($response['response_code'])) {
         $code = $response['response_code'];
     }
     //Validate result and prepare feedback
     if ($this->_validateRefundResponse($response)) {
         $result = true;
         $modelHelper->setPaymillRefund($orderNumber, $response['id']);
         $this->_updatePaymentStatus(20, $this->Request()->getParam("orderId"));
     }
     $this->View()->assign(array('success' => $result, 'code' => $code));
 }