1 <?xml version="1.0" encoding="UTF-8"?>
3 <sect1 id="zend.service.strikeiron.bundled-services">
4 <title>Zend_Service_StrikeIron: Bundled Services</title>
7 <classname>Zend_Service_StrikeIron</classname> comes with wrapper classes for three popular
11 <sect2 id="zend.service.strikeiron.bundled-services.zip-code-information">
12 <title>ZIP Code Information</title>
15 <classname>Zend_Service_StrikeIron_ZipCodeInfo</classname> provides a client for
16 StrikeIron's Zip Code Information Service. For more information on this service, visit
17 these StrikeIron resources:
22 <ulink url="http://www.strikeiron.com/ProductDetail.aspx?p=267">Zip Code
23 Information Service Page</ulink>
30 url="http://sdpws.strikeiron.com/zf1.StrikeIron/sdpZIPCodeInfo?WSDL">Zip
31 Code Information Service WSDL</ulink>
36 The service contains a <methodname>getZipCode()</methodname> method that will retrieve
37 information about a United States ZIP code or Canadian postal code:
40 <programlisting language="php"><![CDATA[
41 $strikeIron = new Zend_Service_StrikeIron(array('username' => 'your-username',
42 'password' => 'your-password'));
44 // Get a client for the Zip Code Information service
45 $zipInfo = $strikeIron->getService(array('class' => 'ZipCodeInfo'));
47 // Get the Zip information for 95014
48 $response = $zipInfo->getZipCode(array('ZipCode' => 95014));
49 $zips = $response->serviceResult;
51 // Display the results
52 if ($zips->count == 0) {
53 echo 'No results found';
55 // a result with one single zip code is returned as an object,
56 // not an array with one element as one might expect.
57 if (! is_array($zips->zipCodes)) {
58 $zips->zipCodes = array($zips->zipCodes);
61 // print all of the possible results
62 foreach ($zips->zipCodes as $z) {
63 $info = $z->zipCodeInfo;
65 // show all properties
68 // or just the city name
69 echo $info->preferredCityName;
73 // Detailed status information
74 // http://www.strikeiron.com/exampledata/StrikeIronZipCodeInformation_v3.pdf
75 $status = $response->serviceStatus;
79 <sect2 id="zend.service.strikeiron.bundled-services.us-address-verification">
80 <title>U.S. Address Verification</title>
83 <classname>Zend_Service_StrikeIron_USAddressVerification</classname> provides a client
84 for StrikeIron's U.S. Address Verification Service. For more information on this
85 service, visit these StrikeIron resources:
90 <ulink url="http://www.strikeiron.com/ProductDetail.aspx?p=198">U.S. Address
91 Verification Service Page</ulink>
98 url="http://ws.strikeiron.com/zf1.StrikeIron/USAddressVerification4_0?WSDL">U.S.
99 Address Verification Service WSDL</ulink>
106 The service contains a <methodname>verifyAddressUSA()</methodname> method that will
107 verify an address in the United States:
110 <programlisting language="php"><![CDATA[
111 $strikeIron = new Zend_Service_StrikeIron(array('username' => 'your-username',
112 'password' => 'your-password'));
114 // Get a client for the Zip Code Information service
115 $verifier = $strikeIron->getService(array('class' => 'USAddressVerification'));
117 // Address to verify. Not all fields are required but
118 // supply as many as possible for the best results.
119 $address = array('firm' => 'Zend Technologies',
120 'addressLine1' => '19200 Stevens Creek Blvd',
121 'addressLine2' => '',
122 'city_state_zip' => 'Cupertino CA 95014');
124 // Verify the address
125 $result = $verifier->verifyAddressUSA($address);
127 // Display the results
128 if ($result->addressErrorNumber != 0) {
129 echo $result->addressErrorNumber;
130 echo $result->addressErrorMessage;
132 // show all properties
135 // or just the firm name
139 $valid = ($result->valid == 'VALID');
144 <sect2 id="zend.service.strikeiron.bundled-services.sales-use-tax-basic">
145 <title>Sales & Use Tax Basic</title>
148 <classname>Zend_Service_StrikeIron_SalesUseTaxBasic</classname> provides a client for
149 StrikeIron's Sales & Use Tax Basic service. For more information on this
150 service, visit these StrikeIron resources:
155 <ulink url="http://www.strikeiron.com/ProductDetail.aspx?p=351">Sales &
156 Use Tax Basic Service Page</ulink>
163 url="http://ws.strikeiron.com/zf1.StrikeIron/taxdatabasic4?WSDL">Sales
164 & Use Tax Basic Service WSDL</ulink>
171 The service contains two methods, <methodname>getTaxRateUSA()</methodname> and
172 <methodname>getTaxRateCanada()</methodname>, that will retrieve sales and use tax data
173 for the United States and Canada, respectively.
176 <programlisting language="php"><![CDATA[
177 $strikeIron = new Zend_Service_StrikeIron(array('username' => 'your-username',
178 'password' => 'your-password'));
180 // Get a client for the Sales & Use Tax Basic service
181 $taxBasic = $strikeIron->getService(array('class' => 'SalesUseTaxBasic'));
183 // Query tax rate for Ontario, Canada
184 $rateInfo = $taxBasic->getTaxRateCanada(array('province' => 'foo'));
185 print_r($rateInfo); // show all properties
186 echo $rateInfo->GST; // or just the GST (Goods & Services Tax)
188 // Query tax rate for Cupertino, CA USA
189 $rateInfo = $taxBasic->getTaxRateUS(array('zip_code' => 95014));
190 print_r($rateInfo); // show all properties
191 echo $rateInfo->state_sales_tax; // or just the state sales tax