当前位置: 首页>>代码示例>>PHP>>正文


PHP Payment::registerRefundNotification方法代码示例

本文整理汇总了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));
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:20,代码来源:PaymentTest.php

示例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));
 }
开发者ID:nja78,项目名称:magento2,代码行数:21,代码来源:PaymentTest.php

示例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);
     }
 }
开发者ID:CSYE6225,项目名称:UnixSysProgramming,代码行数:12,代码来源:Interceptor.php


注:本文中的Magento\Sales\Model\Order\Payment::registerRefundNotification方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。