public function testGetExtOrderIdByPayuplOrderIdSuccess() { $payuplOrderId = 'ABC'; $extOrderId = '123'; $resultTableRow = ['additional_information' => serialize([\Magento\Sales\Model\Order\Payment\Transaction::RAW_DETAILS => ['order_id' => $extOrderId]])]; $this->internalTestGetAdditionalDataByPayuplOrderId($payuplOrderId, $resultTableRow); $this->assertEquals($extOrderId, $this->model->getExtOrderIdByPayuplOrderId($payuplOrderId)); }
/** * @inheritDoc */ public function create($orderId = '', $description = '', $amount = null) { $realPayuplOrderId = $this->transactionResource->getExtOrderIdByPayuplOrderId($orderId); if ($realPayuplOrderId) { $posId = $this->orderDataGetter->getPosId(); $ts = $this->orderDataGetter->getTs(); $sig = $this->orderDataGetter->getSigForOrderRetrieve(['pos_id' => $posId, 'session_id' => $realPayuplOrderId, 'ts' => $ts]); $authData = ['posId' => $posId, 'sessionId' => $realPayuplOrderId, 'ts' => $ts, 'sig' => $sig]; $getResult = $this->methodCaller->call('refundGet', [$authData]); if ($getResult) { $createResult = $this->methodCaller->call('refundAdd', [$authData, ['refundsHash' => $getResult->refsHash, 'amount' => $amount, 'desc' => $description, 'autoData' => true]]); if ($createResult < 0) { $this->logger->error('Refund error ' . $createResult . ' for transaction ' . $orderId); } return $createResult === 0; } } return false; }