/**
  * @param CreditCard $card
  * @param array $data
  * @return array
  */
 protected function addDataFromCard(CreditCard $card, array $data)
 {
     if ($card->getFirstName()) {
         $data['NAME.GIVEN'] = $card->getFirstName();
     }
     if ($card->getLastName()) {
         $data['NAME.FAMILY'] = $card->getLastName();
     }
     if ($card->getSalutation()) {
         $data['NAME.SALUTATION'] = $card->getSalutation();
     }
     if ($card->getTitle()) {
         $data['NAME.TITLE'] = $card->getTitle();
     }
     if ($card->getGender()) {
         $gender = $card->getGender();
         if (CreditCard::GENDER_MALE === $gender) {
             $data['NAME.SEX'] = 'M';
         } elseif (CreditCard::GENDER_FEMALE === $gender) {
             $data['NAME.SEX'] = 'F';
         } else {
             $data['NAME.SEX'] = strtoupper(substr($gender, 0, 1));
         }
     }
     if ($card->getBirthday()) {
         $data['NAME.BIRTHDATE'] = $card->getBirthday();
     }
     if ($card->getCompany()) {
         $data['NAME.COMPANY'] = $card->getCompany();
     }
     if ($card->getCountry()) {
         $data['ADDRESS.COUNTRY'] = $card->getCountry();
     }
     if ($card->getState()) {
         $data['ADDRESS.STATE'] = $card->getState();
     }
     if ($card->getCity()) {
         $data['ADDRESS.CITY'] = $card->getCity();
     }
     if ($card->getPostcode()) {
         $data['ADDRESS.ZIP'] = $card->getPostcode();
     }
     $street = '';
     if ($card->getAddress1()) {
         $street = $card->getAddress1();
     }
     if ($card->getAddress2()) {
         $street .= "\n" . $card->getAddress2();
     }
     $street = trim($street);
     if ($street) {
         $data['ADDRESS.STREET'] = $street;
     }
     if ($card->getEmail()) {
         $data['CONTACT.EMAIL'] = $card->getEmail();
     }
     if ($card->getPhone()) {
         $data['CONTACT.PHONE'] = $card->getPhone();
     }
     if ($card->getMobile()) {
         $data['CONTACT.MOBILE'] = $card->getMobile();
     }
     if ($card->getIdentificationDocumentType() and $card->getIdentificationDocumentNumber()) {
         $data['CUSTOMER.IDENTIFICATION.PAPER'] = $card->getIdentificationDocumentType();
         $data['CUSTOMER.IDENTIFICATION.VALUE'] = $card->getIdentificationDocumentNumber();
     }
     if ($card->getShippingContactDifferences()) {
         $data = $this->addShippingDataFromCard($card, $data);
     }
     return $data;
 }