/**
  * 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);
 }
Example #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;
 }