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


PHP Payment::place方法代码示例

本文整理汇总了PHP中Magento\Sales\Model\Order\Payment::place方法的典型用法代码示例。如果您正苦于以下问题:PHP Payment::place方法的具体用法?PHP Payment::place怎么用?PHP Payment::place使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Sales\Model\Order\Payment的用法示例。


在下文中一共展示了Payment::place方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testPlace

 public function testPlace()
 {
     $newOrderStatus = 'new_status';
     /** @var \Magento\Sales\Model\Order\Config | \PHPUnit_Framework_MockObject_MockObject $orderConfigMock */
     $orderConfigMock = $this->getMockBuilder('Magento\\Sales\\Model\\Order\\Config')->disableOriginalConstructor()->setMethods(['getStateStatuses', 'getStateDefaultStatus'])->getMock();
     $orderConfigMock->expects($this->once())->method('getStateStatuses')->with(\Magento\Sales\Model\Order::STATE_NEW)->will($this->returnValue(['firstStatus', 'secondStatus']));
     $orderConfigMock->expects($this->once())->method('getStateDefaultStatus')->with(\Magento\Sales\Model\Order::STATE_NEW)->will($this->returnValue($newOrderStatus));
     $this->orderMock->expects($this->exactly(2))->method('getConfig')->will($this->returnValue($orderConfigMock));
     $this->orderMock->expects($this->once())->method('setState')->with(\Magento\Sales\Model\Order::STATE_NEW, $newOrderStatus);
     $this->paymentMethodMock->expects($this->once())->method('getConfigPaymentAction')->willReturn(null);
     $this->eventManagerMock->expects($this->at(0))->method('dispatch')->with('sales_order_payment_place_start', ['payment' => $this->payment]);
     $this->eventManagerMock->expects($this->at(1))->method('dispatch')->with('sales_order_payment_place_end', ['payment' => $this->payment]);
     $this->assertEquals($this->payment, $this->payment->place());
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:14,代码来源:PaymentTest.php

示例2: testPlaceActionAuthorizeCapture

 public function testPlaceActionAuthorizeCapture()
 {
     $newOrderStatus = 'new_status';
     $customerNote = 'blabla';
     $sum = 10;
     $this->orderMock->expects($this->any())->method('getTotalDue')->willReturn($sum);
     $this->orderMock->expects($this->any())->method('getBaseTotalDue')->willReturn($sum);
     $this->helperMock->expects($this->once())->method('getMethodInstance')->will($this->returnValue($this->paymentMethodMock));
     $this->paymentMethodMock->expects($this->once())->method('getConfigPaymentAction')->willReturn(\Magento\Payment\Model\Method\AbstractMethod::ACTION_AUTHORIZE_CAPTURE);
     $this->paymentMethodMock->expects($this->any())->method('getConfigData')->with('order_status', null)->willReturn($newOrderStatus);
     $statusHistory = $this->getMockForAbstractClass('Magento\\Sales\\Api\\Data\\OrderStatusHistoryInterface');
     $this->invoiceMock->expects($this->once())->method('register')->willReturnSelf();
     $this->invoiceMock->expects($this->once())->method('capture')->willReturnSelf();
     $this->paymentMethodMock->expects($this->once())->method('canCapture')->willReturn(true);
     $this->orderMock->expects($this->any())->method('prepareInvoice')->willReturn($this->invoiceMock);
     $this->orderMock->expects($this->once())->method('addRelatedObject')->with($this->invoiceMock);
     $this->orderMock->expects($this->any())->method('getCustomerNote')->willReturn($customerNote);
     $this->orderMock->expects($this->any())->method('addStatusHistoryComment')->with($customerNote)->willReturn($statusHistory);
     $this->mockGetDefaultStatus(Order::STATE_PROCESSING, $newOrderStatus, ['first', 'second']);
     $this->orderMock->expects($this->any())->method('setState')->with(Order::STATE_PROCESSING)->willReturnSelf();
     $this->orderMock->expects($this->any())->method('setStatus')->with($newOrderStatus)->willReturnSelf();
     $this->paymentMethodMock->expects($this->once())->method('getConfigPaymentAction')->willReturn(null);
     $this->assertEquals($this->payment, $this->payment->place());
     $this->assertEquals($this->invoiceMock, $this->payment->getCreatedInvoice());
     $this->assertEquals($sum, $this->payment->getAmountAuthorized());
     $this->assertEquals($sum, $this->payment->getBaseAmountAuthorized());
 }
开发者ID:nja78,项目名称:magento2,代码行数:27,代码来源:PaymentTest.php

示例3: testPlace

 public function testPlace()
 {
     $newOrderStatus = 'new_status';
     $this->helperMock->expects($this->once())->method('getMethodInstance')->will($this->returnValue($this->paymentMethodMock));
     $this->mockGetDefaultStatus(Order::STATE_NEW, $newOrderStatus, ['first', 'second']);
     $this->assertOrderUpdated(Order::STATE_NEW, $newOrderStatus);
     $this->paymentMethodMock->expects($this->once())->method('getConfigPaymentAction')->willReturn(null);
     $this->eventManagerMock->expects($this->at(0))->method('dispatch')->with('sales_order_payment_place_start', ['payment' => $this->payment]);
     $this->eventManagerMock->expects($this->at(1))->method('dispatch')->with('sales_order_payment_place_end', ['payment' => $this->payment]);
     $this->assertEquals($this->payment, $this->payment->place());
 }
开发者ID:kid17,项目名称:magento2,代码行数:11,代码来源:PaymentTest.php

示例4: place

 /**
  * {@inheritdoc}
  */
 public function place()
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'place');
     if (!$pluginInfo) {
         return parent::place();
     } else {
         return $this->___callPlugins('place', func_get_args(), $pluginInfo);
     }
 }
开发者ID:CSYE6225,项目名称:UnixSysProgramming,代码行数:12,代码来源:Interceptor.php


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