本文整理汇总了PHP中Magento\Sales\Model\Order::getQuoteId方法的典型用法代码示例。如果您正苦于以下问题:PHP Order::getQuoteId方法的具体用法?PHP Order::getQuoteId怎么用?PHP Order::getQuoteId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Sales\Model\Order
的用法示例。
在下文中一共展示了Order::getQuoteId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testRedirectActionIsContentGenerated
/**
* @magentoDataFixture Magento/Sales/_files/order.php
*/
public function testRedirectActionIsContentGenerated()
{
$this->_order->load('100000001', 'increment_id');
$this->_order->getPayment()->setMethod(\Magento\Paypal\Model\Config::METHOD_WPS);
$this->_order->save();
$this->_order->load('100000001', 'increment_id');
$this->_session->setLastRealOrderId($this->_order->getRealOrderId())->setLastQuoteId($this->_order->getQuoteId());
$this->dispatch('paypal/standard/redirect');
$this->assertContains('<form action="https://www.paypal.com/cgi-bin/webscr" id="paypal_standard_checkout"' . ' name="paypal_standard_checkout" method="POST">', $this->getResponse()->getBody());
}
示例2: startTransaction
public function startTransaction(Order $order, UrlInterface $url)
{
$config = new Config($this->_scopeConfig);
$config->configureSDK();
$total = $order->getGrandTotal();
$items = $order->getAllVisibleItems();
$orderId = $order->getIncrementId();
$quoteId = $order->getQuoteId();
$currency = $order->getOrderCurrencyCode();
$returnUrl = $url->getUrl('paynl/checkout/finish/');
$exchangeUrl = $url->getUrl('paynl/checkout/exchange/');
$paymentOptionId = $this->getPaymentOptionId();
$arrBillingAddress = $order->getBillingAddress()->toArray();
$arrShippingAddress = $order->getShippingAddress()->toArray();
$enduser = array('initials' => substr($arrBillingAddress['firstname'], 0, 1), 'lastName' => $arrBillingAddress['lastname'], 'phoneNumber' => $arrBillingAddress['telephone'], 'emailAddress' => $arrBillingAddress['email']);
$address = array();
$arrAddress = \Paynl\Helper::splitAddress($arrBillingAddress['street']);
$address['streetName'] = $arrAddress[0];
$address['houseNumber'] = $arrAddress[1];
$address['zipCode'] = $arrBillingAddress['postcode'];
$address['city'] = $arrBillingAddress['city'];
$address['country'] = $arrBillingAddress['country_id'];
$shippingAddress = array();
$arrAddress2 = \Paynl\Helper::splitAddress($arrShippingAddress['street']);
$shippingAddress['streetName'] = $arrAddress2[0];
$shippingAddress['houseNumber'] = $arrAddress2[1];
$shippingAddress['zipCode'] = $arrShippingAddress['postcode'];
$shippingAddress['city'] = $arrShippingAddress['city'];
$shippingAddress['country'] = $arrShippingAddress['country_id'];
$data = array('amount' => $total, 'returnUrl' => $returnUrl, 'paymentMethod' => $paymentOptionId, 'description' => $orderId, 'extra1' => $orderId, 'extra2' => $quoteId, 'exchangeUrl' => $exchangeUrl, 'currency' => $currency);
$data['address'] = $address;
$data['shippingAddress'] = $shippingAddress;
$data['enduser'] = $enduser;
$arrProducts = array();
foreach ($items as $item) {
$arrItem = $item->toArray();
if ($arrItem['price_incl_tax'] != null) {
$product = array('id' => $arrItem['product_id'], 'name' => $arrItem['name'], 'price' => $arrItem['price_incl_tax'], 'qty' => $arrItem['qty_ordered'], 'tax' => $arrItem['tax_amount']);
}
$arrProducts[] = $product;
}
//shipping
$shippingCost = $order->getShippingAddress()->getShippingInclTax();
$shippingTax = $order->getShippingAddress()->getShippingTaxAmount();
$shippingDescription = $order->getShippingAddress()->getShippingDescription();
$arrProducts[] = array('id' => 'shipping', 'name' => $shippingDescription, 'price' => $shippingCost, 'qty' => 1, 'tax' => $shippingTax);
// kortingen
$discount = $order->getSubtotal() - $order->getSubtotalWithDiscount();
if ($discount > 0) {
$arrProducts[] = array('id' => 'discount', 'name' => __('Discount'), 'price' => $discount * -1, 'qty' => 1, 'tax' => 0);
}
$data['products'] = $arrProducts;
if ($config->isTestMode()) {
$data['testmode'] = 1;
}
$data['ipaddress'] = $order->getRemoteIp();
$transaction = \Paynl\Transaction::start($data);
return $transaction->getRedirectUrl();
}
示例3: _initCheckout
/**
* Instantiate
*
* @return void
* @throws \Magento\Framework\Exception\LocalizedException
*/
protected function _initCheckout()
{
$pre = __METHOD__ . " : ";
$this->_logger->debug($pre . 'bof');
$this->_order = $this->_checkoutSession->getLastRealOrder();
if (!$this->_order->getId()) {
$this->getResponse()->setStatusHeader(404, '1.1', 'Not found');
throw new \Magento\Framework\Exception\LocalizedException(__('We could not find "Order" for processing'));
}
if ($this->_order->getState() != \Magento\Sales\Model\Order::STATE_PENDING_PAYMENT) {
$this->_order->setState(\Magento\Sales\Model\Order::STATE_PENDING_PAYMENT)->save();
}
if ($this->_order->getQuoteId()) {
$this->_checkoutSession->setPayfastQuoteId($this->_checkoutSession->getQuoteId());
$this->_checkoutSession->setPayfastSuccessQuoteId($this->_checkoutSession->getLastSuccessQuoteId());
$this->_checkoutSession->setPayfastRealOrderId($this->_checkoutSession->getLastRealOrderId());
$this->_checkoutSession->getQuote()->setIsActive(false)->save();
//$this->_checkoutSession->clear();
}
$this->_logger->debug($pre . 'eof');
//$this->_checkout = $this->_checkoutTypes[$this->_checkoutType];
}
示例4: setDataFromOrder
/**
* Set entity data to request
*
* @param \Magento\Sales\Model\Order $order
* @param \Magento\Authorizenet\Model\Directpost $paymentMethod
* @return $this
*/
public function setDataFromOrder(\Magento\Sales\Model\Order $order, \Magento\Authorizenet\Model\Directpost $paymentMethod)
{
$payment = $order->getPayment();
$this->setXType($payment->getAnetTransType());
$this->setXFpSequence($order->getQuoteId());
$this->setXInvoiceNum($order->getIncrementId());
$this->setXAmount($payment->getBaseAmountAuthorized());
$this->setXCurrencyCode($order->getBaseCurrencyCode());
$this->setXTax(sprintf('%.2F', $order->getBaseTaxAmount()))->setXFreight(sprintf('%.2F', $order->getBaseShippingAmount()));
//need to use strval() because NULL values IE6-8 decodes as "null" in JSON in JavaScript,
//but we need "" for null values.
$billing = $order->getBillingAddress();
if (!empty($billing)) {
$this->setXFirstName(strval($billing->getFirstname()))->setXLastName(strval($billing->getLastname()))->setXCompany(strval($billing->getCompany()))->setXAddress(strval($billing->getStreetLine(1)))->setXCity(strval($billing->getCity()))->setXState(strval($billing->getRegion()))->setXZip(strval($billing->getPostcode()))->setXCountry(strval($billing->getCountry()))->setXPhone(strval($billing->getTelephone()))->setXFax(strval($billing->getFax()))->setXCustId(strval($billing->getCustomerId()))->setXCustomerIp(strval($order->getRemoteIp()))->setXCustomerTaxId(strval($billing->getTaxId()))->setXEmail(strval($order->getCustomerEmail()))->setXEmailCustomer(strval($paymentMethod->getConfigData('email_customer')))->setXMerchantEmail(strval($paymentMethod->getConfigData('merchant_email')));
}
$shipping = $order->getShippingAddress();
if (!empty($shipping)) {
$this->setXShipToFirstName(strval($shipping->getFirstname()))->setXShipToLastName(strval($shipping->getLastname()))->setXShipToCompany(strval($shipping->getCompany()))->setXShipToAddress(strval($shipping->getStreetLine(1)))->setXShipToCity(strval($shipping->getCity()))->setXShipToState(strval($shipping->getRegion()))->setXShipToZip(strval($shipping->getPostcode()))->setXShipToCountry(strval($shipping->getCountry()));
}
$this->setXPoNum(strval($payment->getPoNumber()));
return $this;
}
示例5: _processOrder
/**
* Operate with order using information from silent post
*
* @param \Magento\Sales\Model\Order $order
* @return void
* @throws \Magento\Framework\Model\Exception
*/
protected function _processOrder(\Magento\Sales\Model\Order $order)
{
$response = $this->getResponse();
$payment = $order->getPayment();
$payment->setTransactionId($response->getPnref())->setIsTransactionClosed(0);
$canSendNewOrderEmail = true;
if ($response->getResult() == self::RESPONSE_CODE_FRAUDSERVICE_FILTER || $response->getResult() == self::RESPONSE_CODE_DECLINED_BY_FILTER) {
$canSendNewOrderEmail = false;
$fraudMessage = $this->_getFraudMessage() ? $response->getFraudMessage() : $response->getRespmsg();
$payment->setIsTransactionPending(true)->setIsFraudDetected(true)->setAdditionalInformation('paypal_fraud_filters', $fraudMessage);
}
if ($response->getAvsdata() && strstr(substr($response->getAvsdata(), 0, 2), 'N')) {
$payment->setAdditionalInformation('paypal_avs_code', substr($response->getAvsdata(), 0, 2));
}
if ($response->getCvv2match() && $response->getCvv2match() != 'Y') {
$payment->setAdditionalInformation('paypal_cvv2_match', $response->getCvv2match());
}
switch ($response->getType()) {
case self::TRXTYPE_AUTH_ONLY:
$payment->registerAuthorizationNotification($payment->getBaseAmountAuthorized());
break;
case self::TRXTYPE_SALE:
$payment->registerCaptureNotification($payment->getBaseAmountAuthorized());
break;
default:
break;
}
$order->save();
try {
if ($canSendNewOrderEmail) {
$order->sendNewOrderEmail();
}
$this->_quoteFactory->create()->load($order->getQuoteId())->setIsActive(false)->save();
} catch (\Exception $e) {
throw new \Magento\Framework\Model\Exception(__('We cannot send the new order email.'));
}
}
示例6: getOrderItemForTransaction
/**
* @param \Magento\Sales\Model\Order $order
* @return mixed
*/
protected function getOrderItemForTransaction(\Magento\Sales\Model\Order $order)
{
$order->getItemByQuoteItemId($order->getQuoteId());
foreach ($order->getItemsCollection() as $item) {
if (!$item->isDeleted() && !$item->getParentItemId()) {
return $item;
}
}
return null;
}