diff --git a/src/FedExAddressResolver.php b/src/FedExAddressResolver.php index 9f02e06..05431c8 100644 --- a/src/FedExAddressResolver.php +++ b/src/FedExAddressResolver.php @@ -48,4 +48,108 @@ public static function addressResolveAU(AddressInterface $address) { return $party; } + /** + * Resolve Addresses in Hong Kong. + * + * @param \Drupal\address\AddressInterface $address + * The address to resolve. + * + * @return \NicholasCreativeMedia\FedExPHP\Structs\Party + * A Fedex Compatible party. + */ + public static function addressResolveHK(AddressInterface $address) { + + $party = new Party(); + + $party->setAddress(new Address( + array_filter([$address->getAddressLine1(), $address->getAddressLine2()]), + $address->getAdministrativeArea() . ', ' . $address->getLocality(), + NULL, + $address->getPostalCode(), + NULL, + $address->getCountryCode(), + NULL, + FALSE + )); + + return $party; + } + + public static function addressResolveBB(AddressInterface $address) { + + $party = new Party(); + + $party->setAddress(new Address( + array_filter([$address->getAddressLine1(), $address->getAddressLine2()]), + $address->getAdministrativeArea(), + NULL, + $address->getPostalCode(), + NULL, + $address->getCountryCode(), + NULL, + FALSE + )); + + return $party; + } + + /** + * Resolve Addresses in Ireland. + * + * @param \Drupal\address\AddressInterface $address + * The address to resolve. + * + * @return \NicholasCreativeMedia\FedExPHP\Structs\Party + * A Fedex Compatible party. + */ + public static function addressResolveIE(AddressInterface $address) { + + $provinces = [ + 'Co. Carlow' => 'N0', + 'Co. Cavan' => 'N1', + 'Co. Clare' => 'N2', + 'Co. Cork' => ' N3', + 'Co. Donegal' => 'N4', + 'Co. Dublin' => 'N5', + 'Co. Galway' => 'N6', + 'Co. Kerry' => 'N7', + 'Co. Kildare' => 'N8', + 'Co. Kilkenny' => 'N9', + 'Co. Laois' => 'NA', + 'Co. Leitrim' => 'NG', + 'Co. Limerick' => 'NI', + 'Co. Longford' => 'NK', + 'Co. Louth' => 'NL', + 'Co. Mayo' => 'NM', + 'Co. Meath' => 'NO', + 'Co. Monaghan' => 'NP', + 'Co. Offaly' => 'NQ', + 'Co. Roscommon' => 'NR', + 'Co. Sligo' => 'NW', + 'Co. Tipperary' => 'NX', + 'Co. Tipperary' => 'NY', + 'Co. Waterford' => 'NZ', + 'Co. Westmeath' => '10', + 'Co. Wexford' => '11', + 'Co. Wicklow' => '12', + + ]; + + + $party = new Party(); + + $party->setAddress(new Address( + array_filter([$address->getAddressLine1(), $address->getAddressLine2()]), + $address->getAdministrativeArea(), + $provinces[$address->getAdministrativeArea()], + $address->getPostalCode(), + NULL, + $address->getCountryCode(), + NULL, + FALSE + )); + + return $party; + } + }