$this->load->model('payment/pp_payflow_iframe');
$this->load->language('payment/pp_payflow_iframe');
if (isset($this->request->post['order_id']) && $this->request->post['order_id'] != '') {
$order_id = $this->request->post['order_id'];
$paypal_order = $this->model_payment_pp_payflow_iframe->getOrder($order_id);
if ($paypal_order) {
$call_data = array(
'TRXTYPE' => 'V',
'TENDER' => 'C',
'ORIGID' => $paypal_order['transaction_reference'],
);
$result = $this->model_payment_pp_payflow_iframe->call($call_data);
if ($result['RESULT'] == 0) {
$json['success'] = $this->language->get('text_void_success');
$this->model_payment_pp_payflow_iframe->updateOrderStatus($order_id, 1);
$data = array(
'order_id' => $order_id,
'type' => 'V',
'transaction_reference' => $result['PNREF'],
'amount' => '',
);
$this->model_payment_pp_payflow_iframe->addTransaction($data);
$this->model_payment_pp_payflow_iframe->updateOrderStatus($order_id, 1);
$json['success'] = array(
'transaction_type' => $this->language->get('text_void'),
'transaction_reference' => $result['PNREF'],
'time' => date('Y-m-d H:i:s'),
'amount' => '0.00',
);
} else {
$json['error'] = $result['RESPMSG'];
}
} else {
$json['error'] = $this->language->get('error_missing_order');
}
} else {
$json['error'] = $this->language->get('error_missing_data');
}
$this->response->setOutput(json_encode($json));