[MANUAL] English:
[zend.git] / documentation / manual / en / module_specs / Zend_Service_StrikeIron-BundledServices.xml
blob601ecf16954f46462c84e7c8b62d92123aa34ffb
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!-- Reviewed: no -->
3 <sect1 id="zend.service.strikeiron.bundled-services">
4     <title>Zend_Service_StrikeIron: Bundled Services</title>
6     <para>
7         <classname>Zend_Service_StrikeIron</classname> comes with wrapper classes for three popular
8         StrikeIron services.
9     </para>
11     <sect2 id="zend.service.strikeiron.bundled-services.zip-code-information">
12         <title>ZIP Code Information</title>
14         <para>
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:
19             <itemizedlist>
20                 <listitem>
21                     <para>
22                       <ulink url="http://www.strikeiron.com/ProductDetail.aspx?p=267">Zip Code
23                           Information Service Page</ulink>
24                     </para>
25                 </listitem>
27                 <listitem>
28                     <para>
29                       <ulink
30                           url="http://sdpws.strikeiron.com/zf1.StrikeIron/sdpZIPCodeInfo?WSDL">Zip
31                           Code Information Service WSDL</ulink>
32                     </para>
33                 </listitem>
34             </itemizedlist>
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';
53 } else {
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);
58     }
60     // print all of the possible results
61     foreach ($zips->zipCodes as $z) {
62         $info = $z->zipCodeInfo;
64         // show all properties
65         print_r($info);
67         // or just the city name
68         echo $info->preferredCityName;
69     }
72 // Detailed status information
73 // http://www.strikeiron.com/exampledata/StrikeIronZipCodeInformation_v3.pdf
74 $status = $response->serviceStatus;
75 ]]></programlisting>
76         </para>
77     </sect2>
79     <sect2 id="zend.service.strikeiron.bundled-services.us-address-verification">
80         <title>U.S. Address Verification</title>
82         <para>
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:
87             <itemizedlist>
88                 <listitem>
89                     <para>
90                         <ulink url="http://www.strikeiron.com/ProductDetail.aspx?p=198">U.S. Address
91                             Verification Service Page</ulink>
92                     </para>
93                 </listitem>
95                 <listitem>
96                     <para>
97                         <ulink
98                             url="http://ws.strikeiron.com/zf1.StrikeIron/USAddressVerification4_0?WSDL">U.S.
99                             Address Verification Service WSDL</ulink>
100                     </para>
101                 </listitem>
102             </itemizedlist>
103         </para>
105         <para>
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;
130 } else {
131     // show all properties
132     print_r($result);
134     // or just the firm name
135     echo $result->firm;
137     // valid address?
138     $valid = ($result->valid == 'VALID');
140 ]]></programlisting>
141         </para>
142     </sect2>
144     <sect2 id="zend.service.strikeiron.bundled-services.sales-use-tax-basic">
145         <title>Sales &amp; Use Tax Basic</title>
147         <para>
148             <classname>Zend_Service_StrikeIron_SalesUseTaxBasic</classname> provides a client for
149             StrikeIron's Sales &amp; Use Tax Basic service. For more information on this
150             service, visit these StrikeIron resources:
152             <itemizedlist>
153                 <listitem>
154                     <para>
155                         <ulink url="http://www.strikeiron.com/ProductDetail.aspx?p=351">Sales &amp;
156                             Use Tax Basic Service Page</ulink>
157                     </para>
158                 </listitem>
160                 <listitem>
161                     <para>
162                         <ulink
163                             url="http://ws.strikeiron.com/zf1.StrikeIron/taxdatabasic4?WSDL">Sales
164                             &amp; Use Tax Basic Service WSDL</ulink>
165                     </para>
166                 </listitem>
167             </itemizedlist>
168         </para>
170         <para>
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
191 ]]></programlisting>
192         </para>
193     </sect2>
194 </sect1>