本文整理汇总了PHP中Sylius\Component\Core\Model\OrderInterface::getCurrencyCode方法的典型用法代码示例。如果您正苦于以下问题:PHP OrderInterface::getCurrencyCode方法的具体用法?PHP OrderInterface::getCurrencyCode怎么用?PHP OrderInterface::getCurrencyCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sylius\Component\Core\Model\OrderInterface
的用法示例。
在下文中一共展示了OrderInterface::getCurrencyCode方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
function it_executes_request(InvoiceNumberGeneratorInterface $invoiceNumberGenerator, CurrencyConverterInterface $currencyConverter, Convert $request, PaymentInterface $payment, OrderInterface $order, OrderItemInterface $orderItem, ProductVariantInterface $productVariant, ProductInterface $product)
{
$request->getTo()->willReturn('array');
$payment->getId()->willReturn(19);
$order->getId()->willReturn(92);
$order->getId()->willReturn(92);
$order->getCurrencyCode()->willReturn('PLN');
$order->getTotal()->willReturn(22000);
$order->getItems()->willReturn([$orderItem]);
$order->getAdjustmentsTotalRecursively(AdjustmentInterface::TAX_ADJUSTMENT)->willReturn(0);
$order->getOrderPromotionTotal()->willReturn(0);
$order->getShippingTotal()->willReturn(2000);
$orderItem->getVariant()->willReturn($productVariant);
$orderItem->getDiscountedUnitPrice()->willReturn(20000);
$orderItem->getQuantity()->willReturn(1);
$productVariant->getProduct()->willReturn($product);
$product->getName()->willReturn('Lamborghini Aventador Model');
$request->getSource()->willReturn($payment);
$payment->getOrder()->willReturn($order);
$invoiceNumberGenerator->generate($order, $payment)->willReturn('19-92');
$currencyConverter->convertFromBase(22000, 'PLN')->willReturn(88000);
$currencyConverter->convertFromBase(20000, 'PLN')->willReturn(80000);
$currencyConverter->convertFromBase(2000, 'PLN')->willReturn(8000);
$details = ['PAYMENTREQUEST_0_INVNUM' => '19-92', 'PAYMENTREQUEST_0_CURRENCYCODE' => 'PLN', 'PAYMENTREQUEST_0_AMT' => 880.0, 'PAYMENTREQUEST_0_ITEMAMT' => 880.0, 'L_PAYMENTREQUEST_0_NAME0' => 'Lamborghini Aventador Model', 'L_PAYMENTREQUEST_0_AMT0' => 800.0, 'L_PAYMENTREQUEST_0_QTY0' => 1, 'L_PAYMENTREQUEST_0_NAME1' => 'Shipping Total', 'L_PAYMENTREQUEST_0_AMT1' => 80.0, 'L_PAYMENTREQUEST_0_QTY1' => 1];
$request->setResult($details)->shouldBeCalled();
$this->execute($request);
}
示例2: update
/**
* {@inheritdoc}
*
* @throws \InvalidArgumentException
*/
public function update(OrderInterface $order)
{
$currencyCode = $order->getCurrencyCode();
/** @var CurrencyInterface $currency */
$currency = $this->currencyRepository->findOneBy(['code' => $currencyCode]);
Assert::notNull($currency);
$order->setExchangeRate($currency->getExchangeRate());
}
示例3:
function it_updates_orders_exchange_rate(RepositoryInterface $currencyRepository, OrderInterface $order, CurrencyInterface $currency)
{
$order->getCurrencyCode()->willReturn('USD');
$currency->getCode()->willReturn('USD');
$currency->getExchangeRate()->willReturn(2);
$currencyRepository->findOneBy(['code' => 'USD'])->willReturn($currency);
$order->setExchangeRate(2)->shouldBeCalled();
$this->update($order);
}
示例4:
function it_sets_last_order_currency_with_target_state_currency_code_and_amount(OrderInterface $order, PaymentInterface $payment)
{
$order->getState()->willReturn(OrderInterface::STATE_CART);
$order->getLastPayment(PaymentInterface::STATE_CART)->willReturn($payment);
$order->getCurrencyCode()->willReturn('PLN');
$order->getTotal()->willReturn(1000);
$payment->setCurrencyCode('PLN')->shouldBeCalled();
$payment->setAmount(1000)->shouldBeCalled();
$this->process($order);
}
示例5: processOrderPayments
/**
* {@inheritdoc}
*/
public function processOrderPayments(OrderInterface $order)
{
if ($order->getLastPayment(PaymentInterface::STATE_NEW)) {
return;
}
/** @var $payment PaymentInterface */
$payment = $this->paymentFactory->createWithAmountAndCurrencyCode($order->getTotal(), $order->getCurrencyCode());
$this->setPaymentMethodIfNeeded($order, $payment);
$order->addPayment($payment);
}
示例6:
function it_does_not_apply_bigger_discount_than_promotion_subject_total(ChannelInterface $channel, OrderInterface $order, OrderItemInterface $firstItem, OrderItemInterface $secondItem, PromotionInterface $promotion, ProportionalIntegerDistributorInterface $proportionalIntegerDistributor, UnitsPromotionAdjustmentsApplicatorInterface $unitsPromotionAdjustmentsApplicator)
{
$order->getCurrencyCode()->willReturn('USD');
$order->getChannel()->willReturn($channel);
$channel->getCode()->willReturn('WEB_US');
$order->countItems()->willReturn(2);
$order->getItems()->willReturn(new \ArrayIterator([$firstItem->getWrappedObject(), $secondItem->getWrappedObject()]));
$order->getPromotionSubjectTotal()->willReturn(10000);
$firstItem->getTotal()->willReturn(6000);
$secondItem->getTotal()->willReturn(4000);
$proportionalIntegerDistributor->distribute([6000, 4000], -10000)->willReturn([-6000, -4000]);
$unitsPromotionAdjustmentsApplicator->apply($order, $promotion, [-6000, -4000])->shouldBeCalled();
$this->execute($order, ['WEB_US' => ['amount' => 15000]], $promotion)->shouldReturn(true);
}
示例7:
function it_recalculates_prices_adding_customer_to_the_context(ChannelInterface $channel, CustomerGroupInterface $group, CustomerInterface $customer, OrderInterface $order, OrderItemInterface $item, ProductVariantInterface $variant, ProductVariantPriceCalculatorInterface $productVariantPriceCalculator)
{
$order->getCustomer()->willReturn($customer);
$order->getChannel()->willReturn(null);
$order->getItems()->willReturn([$item]);
$order->getCurrencyCode()->willReturn(null);
$customer->getGroup()->willReturn($group);
$item->isImmutable()->willReturn(false);
$item->getQuantity()->willReturn(5);
$item->getVariant()->willReturn($variant);
$order->getChannel()->willReturn($channel);
$productVariantPriceCalculator->calculate($variant, ['channel' => $channel])->willReturn(10);
$item->setUnitPrice(10)->shouldBeCalled();
$this->process($order);
}
示例8: process
/**
* {@inheritdoc}
*/
public function process(OrderInterface $order)
{
if (OrderInterface::STATE_CANCELLED === $order->getState()) {
return;
}
$newPayment = $order->getLastPayment(PaymentInterface::STATE_NEW);
if (null !== $newPayment) {
$newPayment->setAmount($order->getTotal());
return;
}
/** @var $payment PaymentInterface */
$payment = $this->paymentFactory->createWithAmountAndCurrencyCode($order->getTotal(), $order->getCurrencyCode());
$this->setPaymentMethodIfNeeded($order, $payment);
$order->addPayment($payment);
}
示例9: provideOrderPayment
/**
* {@inheritdoc}
*/
public function provideOrderPayment(OrderInterface $order, $targetState)
{
/** @var PaymentInterface $payment */
$payment = $this->paymentFactory->createWithAmountAndCurrencyCode($order->getTotal(), $order->getCurrencyCode());
$paymentMethod = $this->getDefaultPaymentMethod($payment, $order);
$lastPayment = $this->getLastPayment($order);
if (null !== $lastPayment) {
$paymentMethod = $lastPayment->getMethod();
}
if (null === $paymentMethod) {
throw new NotProvidedOrderPaymentException();
}
$payment->setMethod($paymentMethod);
$this->applyRequiredTransition($payment, $targetState);
return $payment;
}
示例10:
function it_sets_orders_total_on_payment_amount_when_payment_is_new(OrderInterface $order, PaymentInterface $payment)
{
$order->getState()->willReturn(OrderInterface::STATE_NEW);
$order->getTotal()->willReturn(123);
$order->getCurrencyCode()->willReturn('EUR');
$payment->getState()->willReturn(PaymentInterface::STATE_NEW);
$order->getLastPayment(PaymentInterface::STATE_NEW)->willReturn($payment);
$payment->setAmount(123)->shouldBeCalled();
$payment->setCurrencyCode('EUR')->shouldBeCalled();
$this->process($order);
}
示例11:
function it_does_not_add_payment_during_processing_if_new_payment_already_exists(PaymentFactoryInterface $paymentFactory, PaymentInterface $newPaymentReadyToPay, PaymentInterface $cancelledPayment, PaymentInterface $payment, OrderInterface $order)
{
$order->getState()->willReturn(OrderInterface::STATE_NEW);
$order->getTotal()->willReturn(1234);
$order->getCurrencyCode()->willReturn('EUR');
$order->getLastPayment(PaymentInterface::STATE_CANCELLED)->willReturn($cancelledPayment);
$order->getLastPayment(PaymentInterface::STATE_FAILED)->willReturn(null);
$order->getLastPayment(PaymentInterface::STATE_NEW)->willReturn($newPaymentReadyToPay);
$paymentFactory->createWithAmountAndCurrencyCode(1234, 'EUR')->willReturn($payment);
$payment->setMethod($cancelledPayment)->shouldNotBeCalled();
$order->addPayment($payment)->shouldNotBeCalled();
$this->processOrderPayments($order);
}
示例12:
function it_throws_exception_if_payment_method_cannot_be_resolved_for_provided_payment(OrderInterface $order, PaymentFactoryInterface $paymentFactory, PaymentInterface $lastFailedPayment, PaymentInterface $newPayment)
{
$order->getTotal()->willReturn(1000);
$order->getCurrencyCode()->willReturn('USD');
$order->getLastPayment(PaymentInterface::STATE_CANCELLED)->willReturn(null);
$order->getLastPayment(PaymentInterface::STATE_FAILED)->willReturn($lastFailedPayment);
$lastFailedPayment->getMethod()->willReturn(null);
$paymentFactory->createWithAmountAndCurrencyCode(1000, 'USD')->willReturn($newPayment);
$this->shouldThrow(NotProvidedOrderPaymentException::class)->during('provideOrderPayment', [$order, PaymentInterface::STATE_NEW]);
}