예제 #1
0
 /**
  * @param PriceBox $subject
  * @return string
  */
 private function getTaxRateIds(PriceBox $subject)
 {
     $rateIds = [];
     $customerSession = $this->customerSession;
     $billingAddress = $customerSession->getDefaultTaxBillingAddress();
     $shippingAddress = $customerSession->getDefaultTaxShippingAddress();
     $customerTaxClassId = $customerSession->getCustomerTaxClassId();
     if (!empty($billingAddress)) {
         $billingAddress = new \Magento\Framework\DataObject($billingAddress);
     }
     if (!empty($shippingAddress)) {
         $shippingAddress = new \Magento\Framework\DataObject($shippingAddress);
     }
     if (!empty($billingAddress) || !empty($shippingAddress)) {
         $rateRequest = $this->getTaxCalculation()->getRateRequest($billingAddress, $shippingAddress, $customerTaxClassId, $this->scopeResolver->getScope()->getId(), $this->customerSession->getCustomerId());
         $rateRequest->setProductClassId($subject->getSaleableItem()->getTaxClassId());
         $rateIds = $this->getTaxCalculation()->getResource()->getRateIds($rateRequest);
     }
     return implode('_', $rateIds);
 }
 public function testGetSaleableItem()
 {
     $this->assertEquals($this->saleable, $this->model->getSaleableItem());
 }