本文整理汇总了PHP中Magento\Sales\Model\Order\Payment::registerRefundNotification方法的典型用法代码示例。如果您正苦于以下问题:PHP Payment::registerRefundNotification方法的具体用法?PHP Payment::registerRefundNotification怎么用?PHP Payment::registerRefundNotification使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Sales\Model\Order\Payment
的用法示例。
在下文中一共展示了Payment::registerRefundNotification方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testRegisterRefundNotificationWrongAmount
public function testRegisterRefundNotificationWrongAmount()
{
$amount = 30;
$grandTotalCreditMemo = 50;
$invoiceBaseGrandTotal = 50;
$invoiceBaseTotalRefunded = 0;
$this->invoiceMock->expects($this->any())->method('getBaseGrandTotal')->willReturn($invoiceBaseGrandTotal);
$this->invoiceMock->expects($this->any())->method('getBaseTotalRefunded')->willReturn($invoiceBaseTotalRefunded);
$this->creditMemoMock->expects($this->any())->method('getGrandTotal')->willReturn($grandTotalCreditMemo);
$this->payment->setParentTransactionId($this->transactionId);
$this->mockInvoice($this->transactionId, 1);
$this->orderMock->expects($this->once())->method('getBaseCurrency')->willReturn($this->currencyMock);
$parentTransaction = $this->getMock('Magento\\Sales\\Model\\Order\\Payment\\Transaction', ['setOrderId', 'setPaymentId', 'loadByTxnId', 'getId', 'getTxnId', 'getTxnType'], [], '', false);
//generate new transaction and check if not exists
$this->transactionRepositoryMock->expects($this->once())->method('getByTransactionId')->with($this->transactionId)->willReturn($parentTransaction);
$newTransactionId = $this->transactionId . '-refund';
$this->transactionManagerMock->expects($this->once())->method('isTransactionExists')->with($newTransactionId)->willReturn(false);
$this->transactionManagerMock->expects($this->once())->method('generateTransactionId')->with($this->payment, Transaction::TYPE_REFUND, $parentTransaction)->willReturn($newTransactionId);
$this->assertSame($this->payment, $this->payment->registerRefundNotification($amount));
}
示例2: testRegisterRefundNotificationWrongAmount
public function testRegisterRefundNotificationWrongAmount()
{
$amount = 30;
$grandTotalCreditMemo = 50;
$invoiceBaseGrandTotal = 50;
$invoiceBaseTotalRefunded = 0;
$this->invoiceMock->expects($this->any())->method('getBaseGrandTotal')->willReturn($invoiceBaseGrandTotal);
$this->invoiceMock->expects($this->any())->method('getBaseTotalRefunded')->willReturn($invoiceBaseTotalRefunded);
$this->creditMemoMock->expects($this->any())->method('getGrandTotal')->willReturn($grandTotalCreditMemo);
$this->payment->setParentTransactionId($this->transactionId);
$this->mockInvoice($this->transactionId, 1);
$this->orderMock->expects($this->once())->method('getBaseCurrency')->willReturn($this->currencyMock);
$parentTransaction = $this->getMock('Magento\\Sales\\Model\\Order\\Payment\\Transaction', ['setOrderPaymentObject', 'loadByTxnId', 'getId', 'getTxnId', 'getTxnType'], [], '', false);
$parentTransaction->expects($this->atLeastOnce())->method('setOrderPaymentObject')->with($this->payment)->willReturnSelf();
$parentTransaction->expects($this->exactly(1))->method('loadByTxnId')->with($this->transactionId)->willReturnSelf();
$newTransaction = $this->getMock('Magento\\Sales\\Model\\Order\\Payment\\Transaction', ['getId', 'setOrderPaymentObject', 'loadByTxnId', 'setTxnId', 'setTxnType', 'isFailsafe', 'getTxnId', 'getTxnType'], [], '', false);
$this->transactionFactory->expects($this->exactly(2))->method('create')->willReturnOnConsecutiveCalls($parentTransaction, $newTransaction);
$newTransaction->expects($this->exactly(1))->method('loadByTxnId')->with($this->transactionId . '-' . \Magento\Sales\Model\Order\Payment\Transaction::TYPE_REFUND)->willReturnSelf();
$newTransaction->expects($this->atLeastOnce())->method('setOrderPaymentObject')->willReturnSelf();
$this->assertSame($this->payment, $this->payment->registerRefundNotification($amount));
}
示例3: registerRefundNotification
/**
* {@inheritdoc}
*/
public function registerRefundNotification($amount)
{
$pluginInfo = $this->pluginList->getNext($this->subjectType, 'registerRefundNotification');
if (!$pluginInfo) {
return parent::registerRefundNotification($amount);
} else {
return $this->___callPlugins('registerRefundNotification', func_get_args(), $pluginInfo);
}
}