/**
  * Creates a key based on both addresses found in the orderContext
  *
  * @param Customweb_Payment_Authorization_IOrderContext $orderContext
  * @param array $additionalData Other identifiers to be added to the generated key (e.g. amount, payment type etc)
  * @return string
  */
 public static function generateAddressKey(Customweb_Payment_Authorization_IOrderContext $orderContext, $additionalData = array())
 {
     $billing = $orderContext->getBillingAddress();
     $shipping = $orderContext->getShippingAddress();
     $addressParts = array_merge(self::addressPartsToArray($billing), self::addressPartsToArray($shipping), $additionalData);
     $addressString = Customweb_Core_String::_(implode($addressParts))->toLowerCase()->toString();
     return substr(hash('SHA512', $addressString), 0, 160);
 }
Example #2
0
 /**
  * This method takes the two order contexts and compare their shipping addresses.
  * The method returns true, when they equal.
  *
  * @param Customweb_Payment_Authorization_IOrderContext $orderContext1
  * @param Customweb_Payment_Authorization_IOrderContext $orderContext2
  * @return boolean
  */
 public static function compareShippingAddresses(Customweb_Payment_Authorization_IOrderContext $orderContext1, Customweb_Payment_Authorization_IOrderContext $orderContext2)
 {
     return self::compareAddresses($orderContext1->getShippingAddress(), $orderContext2->getShippingAddress());
 }