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


PHP Mage_Paypal_Model_Config::exportExpressCheckoutStyleSettings方法代码示例

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


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

示例1: start

 /**
  * Reserve order ID for specified quote and start checkout on PayPal
  * @return string
  */
 public function start($returnUrl, $cancelUrl)
 {
     $this->_quote->reserveOrderId()->save();
     // prepare API
     $this->_getApi();
     $this->_api->setAmount($this->_quote->getBaseGrandTotal())->setCurrencyCode($this->_quote->getBaseCurrencyCode())->setInvNum($this->_quote->getReservedOrderId())->setReturnUrl($returnUrl)->setCancelUrl($cancelUrl)->setSolutionType($this->_config->solutionType)->setPaymentAction($this->_config->paymentAction);
     // supress or export shipping address
     if ($this->_quote->getIsVirtual()) {
         $this->_api->setSuppressShipping(true);
     } else {
         $address = $this->_quote->getShippingAddress();
         $isOverriden = 0;
         if (true === $address->validate()) {
             $isOverriden = 1;
             $this->_api->setAddress($address);
         }
         $this->_quote->getPayment()->setAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_SHIPPING_OVERRIDEN, $isOverriden);
         $this->_quote->getPayment()->save();
     }
     // add line items
     if ($this->_config->lineItemsEnabled) {
         list($items, $totals) = Mage::helper('paypal')->prepareLineItems($this->_quote);
         $this->_api->setLineItems($items)->setLineItemTotals($totals);
     }
     $this->_config->exportExpressCheckoutStyleSettings($this->_api);
     // call API and redirect with token
     $this->_api->callSetExpressCheckout();
     $token = $this->_api->getToken();
     $this->_redirectUrl = $this->_config->getExpressCheckoutStartUrl($token);
     return $token;
 }
开发者ID:joebushi,项目名称:magento-mirror,代码行数:35,代码来源:Checkout.php

示例2: start

 /**
  * Reserve order ID for specified quote and start checkout on PayPal
  * @return string
  */
 public function start($returnUrl, $cancelUrl)
 {
     $this->_quote->reserveOrderId()->save();
     // prepare API
     $this->_getApi();
     $this->_api->setAmount($this->_quote->getBaseGrandTotal())->setCurrencyCode($this->_quote->getBaseCurrencyCode())->setInvNum($this->_quote->getReservedOrderId())->setReturnUrl($returnUrl)->setCancelUrl($cancelUrl)->setSolutionType($this->_config->solutionType)->setPaymentAction($this->_config->paymentAction);
     if ($this->_giropayUrls) {
         list($successUrl, $cancelUrl, $pendingUrl) = $this->_giropayUrls;
         $this->_api->addData(array('giropay_cancel_url' => $cancelUrl, 'giropay_success_url' => $successUrl, 'giropay_bank_txn_pending_url' => $pendingUrl));
     }
     // supress or export shipping address
     if ($this->_quote->getIsVirtual()) {
         $this->_api->setSuppressShipping(true);
     } else {
         $address = $this->_quote->getShippingAddress();
         $isOverriden = 0;
         if (true === $address->validate()) {
             $isOverriden = 1;
             $this->_api->setAddress($address);
         }
         $this->_quote->getPayment()->setAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_SHIPPING_OVERRIDEN, $isOverriden);
         $this->_quote->getPayment()->save();
     }
     // add line items
     if ($this->_config->lineItemsEnabled && Mage::helper('paypal')->doLineItemsMatchAmount($this->_quote, $this->_quote->getBaseGrandTotal())) {
         //For transfering line items order amount must be equal to cart total amount
         list($items, $totals) = Mage::helper('paypal')->prepareLineItems($this->_quote);
         $this->_api->setLineItems($items)->setLineItemTotals($totals);
     }
     $this->_config->exportExpressCheckoutStyleSettings($this->_api);
     // call API and redirect with token
     $this->_api->callSetExpressCheckout();
     $token = $this->_api->getToken();
     $this->_redirectUrl = $this->_config->getExpressCheckoutStartUrl($token);
     return $token;
 }
开发者ID:hunnybohara,项目名称:magento-chinese-localization,代码行数:40,代码来源:Checkout.php


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