[GENERIC] Zend_Translate:
[zend.git] / documentation / manual / en / module_specs / Zend_Service_StrikeIron-BundledServices.xml
blob4dd05fa3332f36b43cae1948a8cea20e178eb716
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:
38         </para>
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';
54 } else {
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);
59     }
61     // print all of the possible results
62     foreach ($zips->zipCodes as $z) {
63         $info = $z->zipCodeInfo;
65         // show all properties
66         print_r($info);
68         // or just the city name
69         echo $info->preferredCityName;
70     }
73 // Detailed status information
74 // http://www.strikeiron.com/exampledata/StrikeIronZipCodeInformation_v3.pdf
75 $status = $response->serviceStatus;
76 ]]></programlisting>
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:
108         </para>
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;
131 } else {
132     // show all properties
133     print_r($result);
135     // or just the firm name
136     echo $result->firm;
138     // valid address?
139     $valid = ($result->valid == 'VALID');
141 ]]></programlisting>
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.
174         </para>
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
192 ]]></programlisting>
193     </sect2>
194 </sect1>