예제 #1
0
 public function testGetSpecificConfigPathPayflowAdvancedLink()
 {
     // _mapWpukFieldset
     $this->_model->setMethod(Config::METHOD_PAYFLOWADVANCED);
     $this->_scopeConfig->expects($this->once())->method('getValue')->with('payment/' . Config::METHOD_PAYFLOWADVANCED . '/payment_action')->willReturn('Authorization');
     $this->assertEquals('Authorization', $this->_model->getValue('payment_action'));
 }
예제 #2
0
 /**
  * @return bool
  */
 protected function shouldRender()
 {
     $this->config->setMethod(Config::METHOD_EXPRESS);
     $isInCatalog = $this->getIsInCatalogProduct();
     $isInContext = (bool) (int) $this->config->getValue('in_context');
     $isEnabled = $isInContext && $isInCatalog || !$isInContext;
     $this->config->setMethod($this->_paymentMethodCode);
     return $isEnabled && $this->_shouldRender;
 }
예제 #3
0
 /**
  * Set shipping options to api
  * @param \Magento\Paypal\Model\Cart $cart
  * @param \Magento\Quote\Model\Quote\Address|null $address
  * @return void
  */
 private function setShippingOptions(PaypalCart $cart, Address $address = null)
 {
     // for included tax always disable line items (related to paypal amount rounding problem)
     $this->_api->setIsLineItemsEnabled($this->_config->getValue(PaypalConfig::TRANSFER_CART_LINE_ITEMS));
     // add shipping options if needed and line items are available
     $cartItems = $cart->getAllItems();
     if ($this->_config->getValue(PaypalConfig::TRANSFER_CART_LINE_ITEMS) && $this->_config->getValue(PaypalConfig::TRANSFER_SHIPPING_OPTIONS) && !empty($cartItems)) {
         if (!$this->_quote->getIsVirtual()) {
             $options = $this->_prepareShippingOptions($address, true);
             if ($options) {
                 $this->_api->setShippingOptionsCallbackUrl($this->_coreUrl->getUrl('*/*/shippingOptionsCallback', ['quote_id' => $this->_quote->getId()]))->setShippingOptions($options);
             }
         }
     }
 }
예제 #4
0
파일: Checkout.php 프로젝트: nja78/magento2
 /**
  * Set create billing agreement flag to api call
  *
  * @return $this
  */
 protected function _setBillingAgreementRequest()
 {
     if (!$this->_customerId) {
         return $this;
     }
     $isRequested = $this->_isBARequested || $this->_quote->getPayment()->getAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT);
     if (!($this->_config->getValue('allow_ba_signup') == PaypalConfig::EC_BA_SIGNUP_AUTO || $isRequested && $this->_config->shouldAskToCreateBillingAgreement())) {
         return $this;
     }
     if (!$this->_agreementFactory->create()->needToCreateForCustomer($this->_customerId)) {
         return $this;
     }
     $this->_api->setBillingType($this->_api->getBillingAgreementType());
     return $this;
 }
예제 #5
0
 /**
  * Check whether API certificate authentication should be used
  *
  * @return bool
  * @SuppressWarnings(PHPMD.BooleanGetMethodName)
  */
 public function getUseCertAuthentication()
 {
     return (bool) $this->_config->getValue('apiAuthentication');
 }
 /**
  * Log debug data to file
  *
  * @return void
  */
 protected function _debug()
 {
     if ($this->_config && $this->_config->getValue('debug')) {
         $this->logger->debug(var_export($this->_debugData, true));
     }
 }
 /**
  * @return string
  */
 public function getMerchantId()
 {
     return $this->config->getValue('merchant_id');
 }
 /**
  * @return bool
  */
 protected function isInContextCheckout()
 {
     $this->config->setMethod(Config::METHOD_EXPRESS);
     return (bool) (int) $this->config->getValue('in_context');
 }
 /**
  * @return bool
  */
 private function isInContext()
 {
     return (bool) (int) $this->config->getValue('in_context');
 }