本文整理汇总了PHP中Magento\Payment\Helper\Data类的典型用法代码示例。如果您正苦于以下问题:PHP Data类的具体用法?PHP Data怎么用?PHP Data使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Data类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _prepareLayout
/**
* Add payment info block to layout
*
* @return $this
*/
protected function _prepareLayout()
{
if ($info = $this->getPaymentInfo()) {
$this->setChild($this->_getInfoBlockName(), $this->_paymentData->getInfoBlock($info, $this->getLayout()));
}
return parent::_prepareLayout();
}
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:12,代码来源:AbstractContainer.php
示例2: setPayment
/**
* Set payment
*
* @param Info $payment
* @return $this
*/
public function setPayment($payment)
{
$paymentInfoBlock = $this->_paymentData->getInfoBlock($payment);
$this->setChild('info', $paymentInfoBlock);
$this->setData('payment', $payment);
return $this;
}
开发者ID:aiesh,项目名称:magento2,代码行数:13,代码来源:Payment.php
示例3: getPaymentMethodInstance
/**
* Retrieve payment method instance
*
* @return \Magento\Payment\Model\MethodInterface
*/
public function getPaymentMethodInstance()
{
if ($this->_paymentMethodInstance === null) {
$this->_paymentMethodInstance = $this->_paymentData->getMethodInstance($this->getMethodCode());
$this->_paymentMethodInstance->setStore($this->getStoreId());
}
return $this->_paymentMethodInstance;
}
开发者ID:whoople,项目名称:magento2-testing,代码行数:13,代码来源:AbstractAgreement.php
示例4: getBillingAgreementMethods
/**
* Retrieve available billing agreement methods
*
* @param null|string|bool|int|\Magento\Store\Model\Store $store
* @param \Magento\Quote\Model\Quote|null $quote
* @return MethodInterface[]
*/
public function getBillingAgreementMethods($store = null, $quote = null)
{
$result = [];
foreach ($this->_paymentData->getStoreMethods($store, $quote) as $method) {
if ($method instanceof MethodInterface) {
$result[] = $method;
}
}
return $result;
}
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:17,代码来源:Data.php
示例5: testGetTransactionUrlTest
public function testGetTransactionUrlTest()
{
$this->prepare();
$expected = 'https://test.url';
$methodInstance = $this->getMockBuilder('Magento\\Payment\\Model\\MethodInterface')->getMockForAbstractClass();
$methodInstance->expects($this->exactly(2))->method('getConfigData')->willReturnMap([['sandbox_flag', null, true], ['cgi_url_test_mode', null, $expected]]);
$this->paymentDataMock->expects($this->exactly(2))->method('getMethodInstance')->willReturn($methodInstance);
$block = new \Magento\Paypal\Block\Payflow\Link\Iframe($this->contextMock, $this->orderFactoryMock, $this->checkoutSessionMock, $this->hssHelperMock, $this->paymentDataMock);
$this->assertEquals($expected, $block->getTransactionUrl());
}
开发者ID:nja78,项目名称:magento2,代码行数:10,代码来源:IframeTest.php
示例6: __construct
/**
* @param \Wirecard\CheckoutPage\Helper\Data $helper
* @param \Magento\Payment\Helper\Data $paymentHelper
* @param \Magento\Framework\Escaper $escaper
* @param \Magento\Framework\View\Asset\Repository $assetRepo
*
*/
public function __construct(\Wirecard\CheckoutPage\Helper\Data $helper, \Magento\Payment\Helper\Data $paymentHelper, \Magento\Framework\Escaper $escaper, \Magento\Framework\View\Asset\Repository $assetRepo)
{
$this->_dataHelper = $helper;
$this->paymentHelper = $paymentHelper;
$this->escaper = $escaper;
$this->assetRepo = $assetRepo;
foreach ($this->methodCodes as $code) {
$this->methods[$code] = $this->paymentHelper->getMethodInstance($code);
}
}
开发者ID:wirecard,项目名称:magento2-wcp,代码行数:17,代码来源:ConfigProvider.php
示例7: isMethodQuoteAvailable
/**
* Сhecks payment method and quote availability
*
* @param string $paymentCode
* @param bool $isInCatalog
* @return bool
*/
public function isMethodQuoteAvailable($paymentCode, $isInCatalog)
{
$quote = $isInCatalog ? null : $this->_checkoutSession->getQuote();
// check payment method availability
/** @var \Magento\Payment\Model\Method\AbstractMethod $methodInstance */
$methodInstance = $this->_paymentData->getMethodInstance($paymentCode);
if (!$methodInstance->isAvailable($quote)) {
return false;
}
return true;
}
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:18,代码来源:CheckoutValidator.php
示例8: testIsMethodQuoteAvailableWithQuoteMethodNotAvailable
/**
* @dataProvider methodAvailabilityDataProvider
* @param bool $availability
*/
public function testIsMethodQuoteAvailableWithQuoteMethodNotAvailable($availability)
{
$quote = $this->getMockBuilder('Magento\\Quote\\Model\\Quote')->disableOriginalConstructor()->setMethods([])->getMock();
$isInCatalog = false;
$paymentCode = 'code';
$methodInstanceMock = $this->getMockBuilder('Magento\\Payment\\Model\\Method\\AbstractMethod')->disableOriginalConstructor()->setMethods([])->getMock();
$this->sessionMock->expects($this->once())->method('getQuote')->will($this->returnValue($quote));
$this->paymentHelperMock->expects($this->once())->method('getMethodInstance')->with($paymentCode)->will($this->returnValue($methodInstanceMock));
$methodInstanceMock->expects($this->once())->method('isAvailable')->with($quote)->will($this->returnValue($availability));
$this->assertEquals($availability, $this->checkoutValidator->isMethodQuoteAvailable($paymentCode, $isInCatalog));
}
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:15,代码来源:CheckoutValidatorTest.php
示例9: getAvailableMethods
/**
* @param \Magento\Quote\Api\Data\CartInterface $quote
* @return \Magento\Payment\Model\MethodInterface[]
* @api
*/
public function getAvailableMethods(\Magento\Quote\Api\Data\CartInterface $quote = null)
{
$store = $quote ? $quote->getStoreId() : null;
$methods = [];
foreach ($this->paymentHelper->getStoreMethods($store, $quote) as $method) {
if ($this->_canUseMethod($method, $quote)) {
$method->setInfoInstance($quote->getPayment());
$methods[] = $method;
}
}
return $methods;
}
开发者ID:Doability,项目名称:magento2dev,代码行数:17,代码来源:MethodList.php
示例10: prepareDataSource
/**
* Prepare Data Source
*
* @param array $dataSource
* @return void
*/
public function prepareDataSource(array &$dataSource)
{
if (isset($dataSource['data']['items'])) {
foreach ($dataSource['data']['items'] as &$item) {
try {
$item[$this->getData('name')] = $this->paymentHelper->getMethodInstance($item[$this->getData('name')])->getTitle();
} catch (\UnexpectedValueException $exception) {
//Displaying payment code (with no changes) if payment method is not available in system
}
}
}
}
开发者ID:nja78,项目名称:magento2,代码行数:18,代码来源:PaymentMethod.php
示例11: testGetConfig
/**
* @param int $customerId
* @param bool $vaultEnabled
* @dataProvider customerIdProvider
*/
public function testGetConfig($customerId, $vaultEnabled)
{
$storeId = 1;
$vaultPaymentCode = 'vault_payment';
$expectedConfiguration = ['vault' => [$vaultPaymentCode => ['is_enabled' => $vaultEnabled]]];
$this->session->expects(static::once())->method('getCustomerId')->willReturn($customerId);
$this->storeManager->expects(static::exactly(2))->method('getStore')->willReturn($this->store);
$this->store->expects(static::exactly(2))->method('getId')->willReturn($storeId);
$this->paymentDataHelper->expects(static::once())->method('getStoreMethods')->with($storeId)->willReturn([$this->vaultPayment]);
$this->vaultPayment->expects(static::once())->method('getCode')->willReturn($vaultPaymentCode);
$this->vaultPayment->expects($customerId !== null ? static::once() : static::never())->method('isActive')->with($storeId)->willReturn($vaultEnabled);
static::assertEquals($expectedConfiguration, $this->vaultConfigProvider->getConfig());
}
开发者ID:Doability,项目名称:magento2dev,代码行数:18,代码来源:VaultConfigProviderTest.php
示例12: testPrepareDataSource
public function testPrepareDataSource()
{
$itemName = 'itemName';
$oldItemValue = 'oldItemValue';
$newItemValue = 'newItemValue';
$dataSource = ['data' => ['items' => [[$itemName => $oldItemValue]]]];
$payment = $this->getMockForAbstractClass('Magento\\Payment\\Model\\MethodInterface');
$payment->expects($this->once())->method('getTitle')->willReturn($newItemValue);
$this->paymentHelper->expects($this->once())->method('getMethodInstance')->with($oldItemValue)->willReturn($payment);
$this->model->setData('name', $itemName);
$this->model->prepareDataSource($dataSource);
$this->assertEquals($newItemValue, $dataSource['data']['items'][0][$itemName]);
}
开发者ID:nja78,项目名称:magento2,代码行数:13,代码来源:PaymentMethodTest.php
示例13: getBillingAgreementMethods
/**
* Retrieve available billing agreement methods
*
* @param null|string|bool|int|\Magento\Store\Model\Store $store
* @param \Magento\Quote\Model\Quote|null $quote
*
* @return MethodInterface[]
*/
public function getBillingAgreementMethods($store = null, $quote = null)
{
$pre = __METHOD__ . " : ";
$this->_logger->debug($pre . 'bof');
$result = [];
foreach ($this->_paymentData->getStoreMethods($store, $quote) as $method) {
if ($method instanceof MethodInterface) {
$result[] = $method;
}
}
$this->_logger->debug($pre . 'eof | result : ', $result);
return $result;
}
开发者ID:PayFast,项目名称:mod-magento_2,代码行数:21,代码来源:Data.php
示例14: testGetConfigAvailable
public function testGetConfigAvailable()
{
$redirectUrl = 'http://redirect.url';
$paytypes = ['paytypes'];
$expectedConfig = ['payment' => ['orbaPayupl' => ['redirectUrl' => $redirectUrl, 'paytypes' => $paytypes]]];
$paymentMethodMock = $this->getPaymentMethodMock();
$paymentMethodMock->expects($this->once())->method('isAvailable')->willReturn(true);
$paymentMethodMock->expects($this->once())->method('getCheckoutRedirectUrl')->willReturn($redirectUrl);
$this->paymentHelper->expects($this->once())->method('getMethodInstance')->with($this->equalTo('orba_payupl'))->willReturn($paymentMethodMock);
$quote = $this->getMockBuilder(\Magento\Quote\Api\Data\CartInterface::class)->getMock();
$this->checkoutSession->expects($this->once())->method('getQuote')->willReturn($quote);
$this->paytypeHelper->expects($this->once())->method('getAllForQuote')->with($this->equalTo($quote))->willReturn($paytypes);
$this->assertEquals($expectedConfig, $this->model->getConfig());
}
开发者ID:tozwierz,项目名称:magento2_payupl,代码行数:14,代码来源:ConfigProviderTest.php
示例15: getMethodInstance
/**
* Retrieve payment method model object
*
* @return \Magento\Payment\Model\MethodInterface
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function getMethodInstance()
{
if (!$this->hasMethodInstance()) {
if (!$this->getMethod()) {
throw new \Magento\Framework\Exception\LocalizedException(__('The payment method you requested is not available.'));
}
try {
$instance = $this->_paymentData->getMethodInstance($this->getMethod());
} catch (\UnexpectedValueException $e) {
$instance = $this->_paymentData->getMethodInstance(Method\Substitution::CODE);
}
$instance->setInfoInstance($this);
$this->setMethodInstance($instance);
}
return $this->_getData('method_instance');
}
开发者ID:shabbirvividads,项目名称:magento2,代码行数:22,代码来源:Info.php
示例16: toOptionArray
/**
* Get options
*
* @return array
*/
public function toOptionArray()
{
if ($this->options === null) {
$this->options = $this->paymentHelper->getPaymentMethodList(true, true);
}
return $this->options;
}
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:12,代码来源:Options.php
示例17: __construct
/**
* @param CcConfig $ccConfig
* @param PaymentHelper $paymentHelper
* @param array $methodCodes
*/
public function __construct(CcConfig $ccConfig, PaymentHelper $paymentHelper, array $methodCodes = [])
{
$this->ccConfig = $ccConfig;
foreach ($methodCodes as $code) {
$this->methods[$code] = $paymentHelper->getMethodInstance($code);
}
}
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:12,代码来源:CcGenericConfigProvider.php
示例18: _prepareLayout
/**
* @return void
*/
protected function _prepareLayout()
{
if ($headBlock = $this->getLayout()->getBlock('head')) {
$headBlock->setTitle(__('Order # %1', $this->getOrder()->getRealOrderId()));
}
$this->setChild('payment_info', $this->_paymentHelper->getInfoBlock($this->getOrder()->getPayment()));
}
开发者ID:aiesh,项目名称:magento2,代码行数:10,代码来源:Creditmemo.php
示例19: __construct
/**
* @param PaymentHelper $paymentHelper
* @param Escaper $escaper
*/
public function __construct(PaymentHelper $paymentHelper, Escaper $escaper)
{
$this->escaper = $escaper;
foreach ($this->methodCodes as $code) {
$this->methods[$code] = $paymentHelper->getMethodInstance($code);
}
}
开发者ID:vkerkhoff,项目名称:magento2-plugin,代码行数:11,代码来源:ConfigProvider.php
示例20: __construct
/**
* @param PaymentHelper $paymentHelper
* @param UrlInterface $urlBuilder
*/
public function __construct(PaymentHelper $paymentHelper, UrlInterface $urlBuilder)
{
$this->paymentHelper = $paymentHelper;
$this->urlBuilder = $urlBuilder;
foreach ($this->methodCodes as $code) {
$this->methods[$code] = $this->paymentHelper->getMethodInstance($code);
}
}
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:12,代码来源:IframeConfigProvider.php
注:本文中的Magento\Payment\Helper\Data类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论