private function getResponseData() { $data = array('term' => $this->payment->item()->term, 'type' => $this->payment->item()->type, 'order' => $this->payment->item()->order, 'amount' => $this->payment->item()->amount, 'cur' => $this->payment->item()->cur, 'rc' => $this->payment->item()->rc, 'approval' => $this->payment->item()->approval, 'irn' => $this->payment->item()->irn, 'rrn' => $this->payment->item()->rrn, 'status' => $this->payment->item()->status, 'time' => Time::ts()); $rc = $this->payment->item()->rc; $pan = $this->payment->item()->pan; if ($pan) { $data['pan'] = $pan; } if ($rc !== '00') { if (isset(ProcessorException::$errors[$rc])) { $data['message'] = ProcessorException::$errors[$rc]; } } Secure::sign($data, $this->type->sid(), $this->term->secret); return $data; }
/** * Process logic by payment Type * * @return string $rc */ private function doProcessType() { $type = new Type($this->payment->type, $this->payment->toArray()); $paymentExist = self::findDouble($this->payment->id, $this->payment->term, $this->payment->order, $this->payment->amount, $type->sid(), array(Status::SUCCESS, Status::PROCESSED)); if ($paymentExist) { return '-3'; } switch ($type->sid()) { case Type::AUTH: case Type::SALE: case Type::PAYMENT: break; case Type::COMPLETE: // completing auth request $payment = self::find($this->payment->term, $this->payment->order, $this->payment->irn, $this->payment->rrn, Type::AUTH, Status::SUCCESS); if (!$payment) { return '-2'; } break; case Type::REFUND: // refund for finished processing: sale, complete, payment $payment = self::find($this->payment->term, $this->payment->order, $this->payment->irn, $this->payment->rrn, array(Type::SALE, Type::COMPLETE, Type::PAYMENT), Status::SUCCESS); if (!$payment) { // refund for not finishing processing: auth $payment = self::find($this->payment->term, $this->payment->order, $this->payment->irn, $this->payment->rrn, Type::AUTH, Status::SUCCESS); if (!$payment) { return '-2'; } } break; } return '00'; }