Ejemplo n.º 1
0
 /**
  * Extract values for input fields from address object
  *
  * @param KlarnaAddr $addr address to get data from
  *
  * @return void
  */
 public function setAddress($addr)
 {
     $reference = @($addr->getFirstName() . ' ' . $addr->getLastName());
     $cellno = $addr->getCellno();
     $telno = $addr->getTelno();
     $phone = strlen($cellno) > 0 ? $cellno : $telno;
     $this->company_name = utf8_encode($addr->getCompanyName());
     $this->first_name = utf8_encode($addr->getFirstName());
     $this->last_name = utf8_encode($addr->getLastName());
     $this->phone_number = utf8_encode($phone);
     $this->zipcode = utf8_encode($addr->getZipCode());
     $this->city = utf8_encode($addr->getCity());
     $this->street = utf8_encode($addr->getStreet());
     $this->house_number = utf8_encode($addr->getHouseNumber());
     $this->house_extension = utf8_encode($addr->getHouseExt());
     $this->reference = utf8_encode($reference);
 }
Ejemplo n.º 2
0
 public function setAddress(KlarnaAddr $addr)
 {
     if (!$addr instanceof KlarnaAddr) {
         throw new KlarnaApiException(__METHOD__ . ': must be passed a KlarnaAddr');
     }
     $reference = @($addr->getFirstName() . ' ' . $addr->getLastName());
     $cellno = $addr->getCellno();
     $telno = $addr->getTelno();
     $phone = strlen($cellno) > 0 ? $cellno : $telno;
     $values =& $this->aInputValues;
     $values['firstName'] = $addr->getFirstName();
     $values['lastName'] = $addr->getLastName();
     $values['phoneNumber'] = $phone;
     $values['zipcode'] = $addr->getZipCode();
     $values['city'] = $addr->getCity();
     $values['street'] = $addr->getStreet();
     $values['homenumber'] = $addr->getHouseNumber();
     $values['house_extension'] = $addr->getHouseExt();
     $values['reference'] = $reference;
 }
Ejemplo n.º 3
0
 /**
  * Get a unique key used to identify the given address
  *
  * The key is a hash of the lower bit ascii portion of company name,
  * first name, last name and street joined with pipes
  *
  * @param KlarnaAddr $addr address
  *
  * @return string key for this address
  */
 public static function getAddressKey($addr)
 {
     return hash('crc32', preg_replace('/[^\\w]*/', '', $addr->getCompanyName() . '|' . $addr->getFirstName() . '|' . $addr->getLastName() . '|' . $addr->getStreet()));
 }