• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Order\Payment类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: testCanVoid

 /**
  * @dataProvider canVoidDataProvider
  * @param bool $canVoid
  */
 public function testCanVoid($canVoid)
 {
     $this->_orderMock->expects($this->once())->method('getPayment')->will($this->returnValue($this->_paymentMock));
     $this->_paymentMock->expects($this->once())->method('canVoid', '__wakeup')->with($this->equalTo($this->_model))->will($this->returnValue($canVoid));
     $this->_model->setState(\Magento\Sales\Model\Order\Invoice::STATE_PAID);
     $this->assertEquals($canVoid, $this->_model->canVoid());
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:11,代码来源:InvoiceTest.php


示例2: testCanVoid

 /**
  * @dataProvider canVoidDataProvider
  * @param bool $canVoid
  */
 public function testCanVoid($canVoid)
 {
     $entityName = 'invoice';
     $this->orderMock->expects($this->once())->method('getPayment')->will($this->returnValue($this->_paymentMock));
     $this->orderMock->expects($this->once())->method('setHistoryEntityName')->with($entityName)->will($this->returnSelf());
     $this->_paymentMock->expects($this->once())->method('canVoid', '__wakeup')->will($this->returnValue($canVoid));
     $this->model->setState(\Magento\Sales\Model\Order\Invoice::STATE_PAID);
     $this->assertEquals($canVoid, $this->model->canVoid());
 }
开发者ID:niranjanssiet,项目名称:magento2,代码行数:13,代码来源:InvoiceTest.php


示例3: testHandle

 /**
  * @covers \Magento\BraintreeTwo\Gateway\Response\CaptureDetailsHandler::handle
  */
 public function testHandle()
 {
     $paymentData = $this->getPaymentDataObjectMock();
     $subject['payment'] = $paymentData;
     $this->payment->expects(static::once())->method('setIsTransactionClosed')->with(false);
     $response = ['object' => ['success' => true]];
     $this->subjectReader->expects(self::once())->method('readPayment')->with($subject)->willReturn($paymentData);
     $this->captureHandler->handle($subject, $response);
 }
开发者ID:hientruong90,项目名称:magento2_installer,代码行数:12,代码来源:CaptureDetailsHandlerTest.php


示例4: setUp

 protected function setUp()
 {
     $this->payment = $this->getMockBuilder(Payment::class)->disableOriginalConstructor()->setMethods(['setCcTransId', 'setLastTransId', 'setAdditionalInformation'])->getMock();
     $this->subjectReader = $this->getMockBuilder(SubjectReader::class)->disableOriginalConstructor()->getMock();
     $this->payment->expects(static::once())->method('setCcTransId');
     $this->payment->expects(static::once())->method('setLastTransId');
     $this->payment->expects(static::any())->method('setAdditionalInformation');
     $this->paymentHandler = new PaymentDetailsHandler($this->subjectReader);
 }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:9,代码来源:PaymentDetailsHandlerTest.php


示例5: testBuild

 public function testBuild()
 {
     $additionalData = [DataAssignObserver::DEVICE_DATA => self::DEVICE_DATA];
     $expectedResult = [KountPaymentDataBuilder::DEVICE_DATA => self::DEVICE_DATA];
     $buildSubject = ['payment' => $this->paymentDO];
     $this->paymentMock->expects(static::exactly(count($additionalData)))->method('getAdditionalInformation')->willReturn($additionalData);
     $this->configMock->expects(static::once())->method('hasFraudProtection')->willReturn(true);
     $this->paymentDO->expects(static::once())->method('getPayment')->willReturn($this->paymentMock);
     $this->subjectReaderMock->expects(self::once())->method('readPayment')->with($buildSubject)->willReturn($this->paymentDO);
     static::assertEquals($expectedResult, $this->builder->build($buildSubject));
 }
开发者ID:koliaGI,项目名称:magento2,代码行数:11,代码来源:KountPaymentDataBuilderTest.php


示例6: testHandle

 /**
  * @covers \Magento\BraintreeTwo\Gateway\Response\CloneDetailsHandler::handle
  */
 public function testHandle()
 {
     $paymentData = $this->getPaymentDataObjectMock();
     $transaction = $this->getBraintreeTransaction();
     $subject['payment'] = $paymentData;
     $this->payment->expects(static::once())->method('setTransactionId')->with(self::TRANSACTION_ID);
     $response = ['object' => $transaction];
     $this->subjectReader->expects(self::once())->method('readPayment')->with($subject)->willReturn($paymentData);
     $this->subjectReader->expects(self::once())->method('readTransaction')->with($response)->willReturn($transaction);
     $this->cloneHandler->handle($subject, $response);
 }
开发者ID:koliaGI,项目名称:magento2,代码行数:14,代码来源:CloneDetailsHandlerTest.php


示例7: testBuild

 public function testBuild()
 {
     $additionalData = [[DataAssignObserver::PAYMENT_METHOD_NONCE, self::PAYMENT_METHOD_NONCE]];
     $expectedResult = [PaymentDataBuilder::AMOUNT => 10.0, PaymentDataBuilder::PAYMENT_METHOD_NONCE => self::PAYMENT_METHOD_NONCE, PaymentDataBuilder::MERCHANT_ACCOUNT_ID => self::MERCHANT_ACCOUNT_ID];
     $buildSubject = ['payment' => $this->paymentDO, 'amount' => 10.0];
     $this->paymentMock->expects(static::exactly(count($additionalData)))->method('getAdditionalInformation')->willReturnMap($additionalData);
     $this->configMock->expects(static::once())->method('getValue')->with(Config::KEY_MERCHANT_ACCOUNT_ID)->willReturn(self::MERCHANT_ACCOUNT_ID);
     $this->paymentDO->expects(static::once())->method('getPayment')->willReturn($this->paymentMock);
     $this->subjectReaderMock->expects(self::once())->method('readPayment')->with($buildSubject)->willReturn($this->paymentDO);
     $this->subjectReaderMock->expects(self::once())->method('readAmount')->with($buildSubject)->willReturn(10.0);
     static::assertEquals($expectedResult, $this->builder->build($buildSubject));
 }
开发者ID:koliaGI,项目名称:magento2,代码行数:12,代码来源:PaymentDataBuilderTest.php


示例8: testHandle

 /**
  * @covers \Magento\BraintreeTwo\Gateway\Response\ThreeDSecureDetailsHandler::handle
  */
 public function testHandle()
 {
     $paymentData = $this->getPaymentDataObjectMock();
     $transaction = $this->getBraintreeTransaction();
     $subject = ['payment' => $paymentData];
     $response = ['object' => $transaction];
     $this->subjectReaderMock->expects(self::once())->method('readPayment')->with($subject)->willReturn($paymentData);
     $this->subjectReaderMock->expects(self::once())->method('readTransaction')->with($response)->willReturn($transaction);
     $this->payment->expects(static::at(1))->method('setAdditionalInformation')->with('liabilityShifted', 'Yes');
     $this->payment->expects(static::at(2))->method('setAdditionalInformation')->with('liabilityShiftPossible', 'Yes');
     $this->handler->handle($subject, $response);
 }
开发者ID:hientruong90,项目名称:magento2_installer,代码行数:15,代码来源:ThreeDSecureDetailsHandlerTest.php


示例9: testHandle

 /**
  * @covers \Magento\BraintreeTwo\Gateway\Response\PayPalDetailsHandler::handle
  */
 public function testHandle()
 {
     $paymentData = $this->getPaymentDataObjectMock();
     $transaction = $this->getBraintreeTransaction();
     $subject = ['payment' => $paymentData];
     $response = ['object' => $transaction];
     $this->subjectReader->expects(self::once())->method('readPayment')->with($subject)->willReturn($paymentData);
     $this->subjectReader->expects(self::once())->method('readTransaction')->with($response)->willReturn($transaction);
     $this->subjectReader->expects(static::once())->method('readPayPal')->with($transaction)->willReturn($transaction->paypal);
     $this->payment->expects(static::exactly(2))->method('setAdditionalInformation');
     $this->payPalHandler->handle($subject, $response);
 }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:15,代码来源:PayPalDetailsHandlerTest.php


示例10: testBuild

 /**
  * @covers \Magento\Braintree\Gateway\Request\CaptureDataBuilder::build
  */
 public function testBuild()
 {
     $transactionId = 'b3b99d';
     $amount = 10.0;
     $expected = ['transaction_id' => $transactionId, 'amount' => $amount];
     $buildSubject = ['payment' => $this->paymentDO, 'amount' => $amount];
     $this->payment->expects(static::once())->method('getCcTransId')->willReturn($transactionId);
     $this->paymentDO->expects(static::once())->method('getPayment')->willReturn($this->payment);
     $this->subjectReaderMock->expects(self::once())->method('readPayment')->with($buildSubject)->willReturn($this->paymentDO);
     $this->subjectReaderMock->expects(self::once())->method('readAmount')->with($buildSubject)->willReturn($amount);
     static::assertEquals($expected, $this->builder->build($buildSubject));
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:15,代码来源:CaptureDataBuilderTest.php


示例11: aroundIsCaptureFinal

 public function aroundIsCaptureFinal(\Magento\Sales\Model\Order\Payment $subject, \Closure $proceed, $amountToCapture)
 {
     $result = $proceed($amountToCapture);
     if (!$result) {
         $order = $subject->getOrder();
         $invoices = $order->getInvoiceCollection();
         $invoice = $invoices->getFirstItem();
         $grandTotalBase = $invoice->getBaseGrandTotal();
         /* validate with partial amount if exists */
         $result = $grandTotalBase == $amountToCapture;
     }
     return $result;
 }
开发者ID:praxigento,项目名称:mobi_mod_mage2_wallet,代码行数:13,代码来源:Payment.php


示例12: testBuild

 /**
  * \Magento\BraintreeTwo\Gateway\Request\VaultCaptureDataBuilder::build
  */
 public function testBuild()
 {
     $amount = 30.0;
     $token = '5tfm4c';
     $buildSubject = ['payment' => $this->paymentDO, 'amount' => $amount];
     $expected = ['amount' => $amount, 'paymentMethodToken' => $token];
     $this->subjectReader->expects(self::once())->method('readPayment')->with($buildSubject)->willReturn($this->paymentDO);
     $this->subjectReader->expects(self::once())->method('readAmount')->with($buildSubject)->willReturn($amount);
     $paymentExtension = $this->getMockBuilder(OrderPaymentExtension::class)->setMethods(['getVaultPaymentToken'])->disableOriginalConstructor()->getMock();
     $paymentToken = $this->getMockBuilder(PaymentToken::class)->disableOriginalConstructor()->getMock();
     $paymentExtension->expects(static::once())->method('getVaultPaymentToken')->willReturn($paymentToken);
     $this->payment->expects(static::once())->method('getExtensionAttributes')->willReturn($paymentExtension);
     $paymentToken->expects(static::once())->method('getGatewayToken')->willReturn($token);
     $result = $this->builder->build($buildSubject);
     static::assertEquals($expected, $result);
 }
开发者ID:uibar,项目名称:lavinia2,代码行数:19,代码来源:VaultCaptureDataBuilderTest.php


示例13: initPayment

 /**
  * @param $context
  */
 protected function initPayment($context)
 {
     $this->payment = (new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this))->getObject('Magento\\Sales\\Model\\Order\\Payment', ['context' => $context, 'serviceOrderFactory' => $this->serviceOrderFactory, 'paymentData' => $this->helperMock, 'priceCurrency' => $this->priceCurrencyMock, 'transactionFactory' => $this->transactionFactory, 'transactionCollectionFactory' => $this->transactionCollectionFactory]);
     $this->payment->setMethod('any');
     $this->payment->setOrder($this->orderMock);
     $this->transactionId = 100;
 }
开发者ID:nja78,项目名称:magento2,代码行数:10,代码来源:PaymentTest.php


示例14: testGetShouldCloseParentTransaction

 /**
  * @covers \Magento\Sales\Model\Order\Payment::getShouldCloseParentTransaction()
  * @return void
  */
 public function testGetShouldCloseParentTransaction()
 {
     $this->payment->setShouldCloseParentTransaction(1);
     static::assertTrue($this->payment->getShouldCloseParentTransaction());
     $this->payment->setShouldCloseParentTransaction(0);
     static::assertFalse($this->payment->getShouldCloseParentTransaction());
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:11,代码来源:PaymentTest.php


示例15: aroundGetAuthorizationTransaction

 /**
  * Magento will consider a transaction for voiding only if it is an authorization
  * Braintree allows voiding captures too
  *
  * Lookup an authorization transaction using parent transaction id, if set
  *
  * @param Payment $subject
  * @param callable $proceed
  *
  * @return \Magento\Sales\Model\Order\Payment\Transaction|false
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  */
 public function aroundGetAuthorizationTransaction(Payment $subject, \Closure $proceed)
 {
     if ($subject->getMethodInstance()->getCode() != PaymentMethod::METHOD_CODE) {
         return $proceed();
     }
     $invoice = $this->registry->registry('current_invoice');
     if ($invoice && $invoice->getId()) {
         $transactionId = $this->paymentHelper->clearTransactionId($invoice->getTransactionId());
         $collection = $this->salesTransactionCollectionFactory->create()->addFieldToFilter('txn_id', ['eq' => $transactionId]);
         if ($collection->getSize() < 1) {
             return $proceed();
         } else {
             return $collection->getFirstItem();
         }
     }
     return $proceed();
 }
开发者ID:nja78,项目名称:magento2,代码行数:29,代码来源:PaymentPlugin.php


示例16: testExecuteUpdateAction

 public function testExecuteUpdateAction()
 {
     $orderId = 30;
     $action = 'update';
     $this->requestMock->expects($this->at(0))->method('getParam')->with('order_id')->willReturn($orderId);
     $this->requestMock->expects($this->at(1))->method('getParam')->with('action')->willReturn($action);
     $this->resultRedirectFactoryMock->expects($this->once())->method('create')->willReturn($this->resultRedirectMock);
     $this->objectManagerMock->expects($this->once())->method('create')->with('Magento\\Sales\\Model\\Order')->willReturn($this->orderMock);
     $this->orderMock->expects($this->once())->method('load')->with($orderId)->willReturn($this->orderMock);
     $this->orderMock->expects($this->any())->method('getId')->willReturn($orderId);
     $this->orderMock->expects($this->once())->method('getPayment')->willReturn($this->paymentMock);
     $this->orderMock->expects($this->once())->method('save')->willReturnSelf();
     $this->messageManagerMock->expects($this->once())->method('addSuccess')->with('The payment update has been made.');
     $this->resultRedirectMock->expects($this->once())->method('setPath')->with('sales/*/')->willReturnSelf();
     $this->paymentMock->expects($this->once())->method('update');
     $result = $this->reviewPayment->execute();
     $this->assertEquals($this->resultRedirectMock, $result);
 }
开发者ID:niranjanssiet,项目名称:magento2,代码行数:18,代码来源:ReviewPaymentTest.php


示例17: testExecuteUpdateAction

 public function testExecuteUpdateAction()
 {
     $orderId = 30;
     $action = 'update';
     $this->requestMock->expects($this->at(0))->method('getParam')->with('order_id')->willReturn($orderId);
     $this->requestMock->expects($this->at(1))->method('getParam')->with('action')->willReturn($action);
     $this->resultRedirectFactoryMock->expects($this->once())->method('create')->willReturn($this->resultRedirectMock);
     $this->orderRepositoryMock->expects($this->once())->method('get')->with($orderId)->willReturn($this->orderMock);
     $this->orderMock->expects($this->any())->method('getEntityId')->willReturn($orderId);
     $this->orderMock->expects($this->any())->method('getPayment')->willReturn($this->paymentMock);
     $this->orderRepositoryMock->expects($this->once())->method('save')->with($this->orderMock)->willReturnSelf();
     $this->paymentMock->expects($this->once())->method('update');
     $this->paymentMock->expects($this->any())->method('getIsTransactionApproved')->willReturn(true);
     $this->messageManagerMock->expects($this->once())->method('addSuccess');
     $this->resultRedirectMock->expects($this->once())->method('setPath')->with('sales/order/view')->willReturnSelf();
     $result = $this->reviewPayment->execute();
     $this->assertEquals($this->resultRedirectMock, $result);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:18,代码来源:ReviewPaymentTest.php


示例18: mockPay

 public function mockPay($hasForcedState, $forcedState)
 {
     $this->orderMock->expects($this->any())->method('getPayment')->willReturn($this->paymentMock);
     $this->paymentMock->expects($this->once())->method('hasForcedState')->willReturn($hasForcedState);
     if ($hasForcedState) {
         $this->paymentMock->expects($this->once())->method('getForcedState')->willReturn($forcedState);
     } else {
         $this->paymentMock->expects($this->never())->method('getForcedState');
     }
     $this->paymentMock->expects($this->once())->method('pay')->with($this->model)->willReturnSelf();
     $this->eventManagerMock->expects($this->once())->method('dispatch')->with('sales_order_invoice_pay');
 }
开发者ID:nja78,项目名称:magento2,代码行数:12,代码来源:InvoiceTest.php


示例19: testVaultCaptureExecute

 /**
  * @covers \Magento\Braintree\Gateway\Command\CaptureStrategyCommand::execute
  */
 public function testVaultCaptureExecute()
 {
     $paymentData = $this->getPaymentDataObjectMock();
     $subject['payment'] = $paymentData;
     $this->subjectReaderMock->expects(self::once())->method('readPayment')->with($subject)->willReturn($paymentData);
     $this->payment->expects(static::once())->method('getAuthorizationTransaction')->willReturn(true);
     $this->payment->expects(static::once())->method('getId')->willReturn(1);
     $this->buildSearchCriteria();
     $this->transactionRepository->expects(static::once())->method('getTotalCount')->willReturn(1);
     $this->commandPool->expects(static::once())->method('get')->with(CaptureStrategyCommand::VAULT_CAPTURE)->willReturn($this->command);
     $this->strategyCommand->execute($subject);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:15,代码来源:CaptureStrategyCommandTest.php


示例20: testCheckAdvancedAcceptingByPaymentMethod

 public function testCheckAdvancedAcceptingByPaymentMethod()
 {
     $this->initLayoutMock();
     $this->initOrderMock(self::LAST_REAL_ORDER_ID, Order::STATE_NEW);
     $this->initCheckoutSessionMock(self::LAST_REAL_ORDER_ID, true);
     $this->requestMock->expects($this->once())->method('getParam')->with('RESPMSG')->will($this->returnValue('message'));
     $this->blockMock->expects($this->at(0))->method('setData')->with('goto_section', 'paymentMethod')->will($this->returnSelf());
     $this->blockMock->expects($this->at(1))->method('setData')->with('error_msg', __('Your payment has been declined. Please try again.'))->will($this->returnSelf());
     $this->paymentMock->expects($this->once())->method('getMethod')->will($this->returnValue(Config::METHOD_PAYFLOWADVANCED));
     $payflowadvancedReturnUrl = new PayflowadvancedReturnUrl($this->contextMock, $this->checkoutSessionMock, $this->orderFactoryMock, $this->payflowlinkFactoryMock, $this->helperCheckoutMock, $this->loggerMock);
     $payflowadvancedReturnUrl->execute();
 }
开发者ID:Zash22,项目名称:magento,代码行数:12,代码来源:ReturnUrlTest.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Fixture\OrderInjectable类代码示例发布时间:2022-05-23
下一篇:
PHP Order\Item类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap