/** * @param string $methodCode * @param string $htmlTransactionId * @dataProvider testGetHtmlTransactionIdProvider */ public function testGetHtmlTransactionId($methodCode, $htmlTransactionId) { $txnId = 'XXX123123XXX'; $htmlTransactionId = sprintf($htmlTransactionId, 'sandbox', $txnId); $this->configMock->expects($this->any())->method('getValue')->with($this->stringContains('sandboxFlag'))->willReturn(true); $this->assertEquals($htmlTransactionId, $this->_helper->getHtmlTransactionId($methodCode, $txnId)); }
/** * Update transaction with HTML representation of txn_id * * @param EventObserver $observer * @return void */ public function execute(EventObserver $observer) { /** @var \Magento\Sales\Model\Order\Payment\Transaction $transaction */ $transaction = $observer->getDataObject(); $order = $transaction->getOrder(); $payment = $order->getPayment(); $methodInstance = $payment->getMethodInstance(); $paymentCode = $methodInstance->getCode(); $transactionLink = $this->paypalData->getHtmlTransactionId($paymentCode, $transaction->getTxnId()); $transaction->setData('html_txn_id', $transactionLink); }