예제 #1
0
 /**
  * Check whether quote is allowed for current user context
  *
  * @param \Magento\Sales\Model\Quote $quote
  * @return bool
  */
 protected function isAllowed(\Magento\Sales\Model\Quote $quote)
 {
     return $this->userContext->getUserType() == UserContextInterface::USER_TYPE_CUSTOMER ? $quote->getCustomerId() == $this->userContext->getUserId() : true;
 }
예제 #2
0
 /**
  * Ensure that quote has customer data specified in customer fixture.
  *
  * @param \Magento\Sales\Model\Quote $quote
  */
 protected function _validateCustomerDataInQuote($quote)
 {
     $customerIdFromFixture = 1;
     $customerEmailFromFixture = '*****@*****.**';
     $customerFirstNameFromFixture = 'Firstname';
     $this->assertEquals($customerEmailFromFixture, $quote->getCustomerEmail(), 'Customer email was not set to Quote correctly.');
     $this->assertEquals($customerIdFromFixture, $quote->getCustomerId(), 'Customer ID was not set to Quote correctly.');
     $this->assertEquals($customerFirstNameFromFixture, $quote->getCustomerFirstname(), 'Customer first name was not set to Quote correctly.');
 }
예제 #3
0
 /**
  * Fetch quote customer data
  *
  * @param Quote $quote
  * @return array
  */
 public function map(Quote $quote)
 {
     return [Customer::ID => $quote->getCustomerId(), Customer::EMAIL => $quote->getCustomerEmail(), Customer::GROUP_ID => $quote->getCustomerGroupId(), Customer::TAX_CLASS_ID => $quote->getCustomerTaxClassId(), Customer::PREFIX => $quote->getCustomerPrefix(), Customer::FIRST_NAME => $quote->getCustomerFirstname(), Customer::MIDDLE_NAME => $quote->getCustomerMiddlename(), Customer::LAST_NAME => $quote->getCustomerLastname(), Customer::SUFFIX => $quote->getCustomerSuffix(), Customer::DOB => $quote->getCustomerDob(), Customer::NOTE => $quote->getCustomerNote(), Customer::NOTE_NOTIFY => $quote->getCustomerNoteNotify(), Customer::IS_GUEST => $quote->getCustomerIsGuest(), Customer::GENDER => $quote->getCustomerGender(), Customer::TAXVAT => $quote->getCustomerTaxvat()];
 }