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:
39 <programlisting language="php"><![CDATA[
40 $strikeIron = new Zend_Service_StrikeIron(array('username' => 'your-username',
41 'password' => 'your-password'));
43 // Get a client for the Zip Code Information service
44 $zipInfo = $strikeIron->getService(array('class' => 'ZipCodeInfo'));
46 // Get the Zip information for 95014
47 $response = $zipInfo->getZipCode(array('ZipCode' => 95014));
48 $zips = $response->serviceResult;
50 // Display the results
51 if ($zips->count == 0) {
52 echo 'No results found';
54 // a result with one single zip code is returned as an object,
55 // not an array with one element as one might expect.
56 if (! is_array($zips->zipCodes)) {
57 $zips->zipCodes = array($zips->zipCodes);
60 // print all of the possible results
61 foreach ($zips->zipCodes as $z) {
62 $info = $z->zipCodeInfo;
64 // show all properties
67 // or just the city name
68 echo $info->preferredCityName;
72 // Detailed status information
73 // http://www.strikeiron.com/exampledata/StrikeIronZipCodeInformation_v3.pdf
74 $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:
109 <programlisting language="php"><![CDATA[
110 $strikeIron = new Zend_Service_StrikeIron(array('username' => 'your-username',
111 'password' => 'your-password'));
113 // Get a client for the Zip Code Information service
114 $verifier = $strikeIron->getService(array('class' => 'USAddressVerification'));
116 // Address to verify. Not all fields are required but
117 // supply as many as possible for the best results.
118 $address = array('firm' => 'Zend Technologies',
119 'addressLine1' => '19200 Stevens Creek Blvd',
120 'addressLine2' => '',
121 'city_state_zip' => 'Cupertino CA 95014');
123 // Verify the address
124 $result = $verifier->verifyAddressUSA($address);
126 // Display the results
127 if ($result->addressErrorNumber != 0) {
128 echo $result->addressErrorNumber;
129 echo $result->addressErrorMessage;
131 // show all properties
134 // or just the firm name
138 $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.
175 <programlisting language="php"><![CDATA[
176 $strikeIron = new Zend_Service_StrikeIron(array('username' => 'your-username',
177 'password' => 'your-password'));
179 // Get a client for the Sales & Use Tax Basic service
180 $taxBasic = $strikeIron->getService(array('class' => 'SalesUseTaxBasic'));
182 // Query tax rate for Ontario, Canada
183 $rateInfo = $taxBasic->getTaxRateCanada(array('province' => 'foo'));
184 print_r($rateInfo); // show all properties
185 echo $rateInfo->GST; // or just the GST (Goods & Services Tax)
187 // Query tax rate for Cupertino, CA USA
188 $rateInfo = $taxBasic->getTaxRateUS(array('zip_code' => 95014));
189 print_r($rateInfo); // show all properties
190 echo $rateInfo->state_sales_tax; // or just the state sales tax