コード例 #1
0
 /**
  * Convert magento address to array for braintree
  *
  * @param \Magento\Sales\Api\Data\OrderAddressInterface $address
  * @return array
  */
 public function toBraintreeAddress($address)
 {
     if ($address) {
         $countryId = $address->getCountryId();
         $region = $address->getRegion();
         if ($countryId == 'US') {
             $region = $this->convertRegionToCode($region, $address->getRegionId());
         }
         $street = $address->getStreet();
         $streetAddress = $street[0];
         return ['firstName' => $address->getFirstname(), 'lastName' => $address->getLastname(), 'company' => $address->getCompany(), 'streetAddress' => $streetAddress, 'extendedAddress' => isset($street[1]) ? $street[1] : null, 'locality' => $address->getCity(), 'region' => $region, 'postalCode' => $address->getPostcode(), 'countryCodeAlpha2' => $countryId];
     } else {
         return [];
     }
 }
コード例 #2
0
ファイル: AddressAdapter.php プロジェクト: nja78/magento2
 /**
  * Get last name
  *
  * @return string
  */
 public function getLastname()
 {
     return $this->address->getLastname();
 }