/** * Makes requesting a refund */ public function display() { $sa = new DotpaySellerApi($this->config->getDotpaySellerApiUrl()); $result = $sa->makeReturnMoney($this->config->getDotpayApiUsername(), $this->config->getDotpayApiPassword(), Tools::getValue('payment'), Tools::getValue('amount'), Tools::getValue('order_id'), Tools::getValue('description')); if ($result['http_code'] == 200) { $status = 'success'; $state = $this->config->getDotpayWaitingRefundStatusId(); $history = new OrderHistory(); $history->id_order = Tools::getValue('order_id'); $history->changeIdOrderState($state, $history->id_order); $history->addWithemail(true); } else { $status = 'error'; $this->context->cookie->dotpay_error = $result['detail']; } Tools::redirectAdmin($this->getRedirectUrl($status)); }