| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!-- Reviewed: no -->
- <sect1 id="zend.service.strikeiron.bundled-services">
- <title>Zend_Service_StrikeIron: Bundled Services</title>
- <para>
- <classname>Zend_Service_StrikeIron</classname> comes with wrapper classes for three popular
- StrikeIron services.
- </para>
- <sect2 id="zend.service.strikeiron.bundled-services.zip-code-information">
- <title>ZIP Code Information</title>
- <para>
- <classname>Zend_Service_StrikeIron_ZipCodeInfo</classname> provides a client for
- StrikeIron's Zip Code Information Service. For more information on this service, visit
- these StrikeIron resources:
- <itemizedlist>
- <listitem>
- <para>
- <ulink url="http://www.strikeiron.com/ProductDetail.aspx?p=267">Zip Code
- Information Service Page</ulink>
- </para>
- </listitem>
- <listitem>
- <para>
- <ulink
- url="http://sdpws.strikeiron.com/zf1.StrikeIron/sdpZIPCodeInfo?WSDL">Zip
- Code Information Service WSDL</ulink>
- </para>
- </listitem>
- </itemizedlist>
- The service contains a <methodname>getZipCode()</methodname> method that will retrieve
- information about a United States ZIP code or Canadian postal code:
- </para>
- <programlisting language="php"><![CDATA[
- $strikeIron = new Zend_Service_StrikeIron(array('username' => 'your-username',
- 'password' => 'your-password'));
- // Get a client for the Zip Code Information service
- $zipInfo = $strikeIron->getService(array('class' => 'ZipCodeInfo'));
- // Get the Zip information for 95014
- $response = $zipInfo->getZipCode(array('ZipCode' => 95014));
- $zips = $response->serviceResult;
- // Display the results
- if ($zips->count == 0) {
- echo 'No results found';
- } else {
- // a result with one single zip code is returned as an object,
- // not an array with one element as one might expect.
- if (! is_array($zips->zipCodes)) {
- $zips->zipCodes = array($zips->zipCodes);
- }
- // print all of the possible results
- foreach ($zips->zipCodes as $z) {
- $info = $z->zipCodeInfo;
- // show all properties
- print_r($info);
- // or just the city name
- echo $info->preferredCityName;
- }
- }
- // Detailed status information
- // http://www.strikeiron.com/exampledata/StrikeIronZipCodeInformation_v3.pdf
- $status = $response->serviceStatus;
- ]]></programlisting>
- </sect2>
- <sect2 id="zend.service.strikeiron.bundled-services.us-address-verification">
- <title>U.S. Address Verification</title>
- <para>
- <classname>Zend_Service_StrikeIron_USAddressVerification</classname> provides a client
- for StrikeIron's U.S. Address Verification Service. For more information on this
- service, visit these StrikeIron resources:
- <itemizedlist>
- <listitem>
- <para>
- <ulink url="http://www.strikeiron.com/ProductDetail.aspx?p=198">U.S. Address
- Verification Service Page</ulink>
- </para>
- </listitem>
- <listitem>
- <para>
- <ulink
- url="http://ws.strikeiron.com/zf1.StrikeIron/USAddressVerification4_0?WSDL">U.S.
- Address Verification Service WSDL</ulink>
- </para>
- </listitem>
- </itemizedlist>
- </para>
- <para>
- The service contains a <methodname>verifyAddressUSA()</methodname> method that will
- verify an address in the United States:
- </para>
- <programlisting language="php"><![CDATA[
- $strikeIron = new Zend_Service_StrikeIron(array('username' => 'your-username',
- 'password' => 'your-password'));
- // Get a client for the Zip Code Information service
- $verifier = $strikeIron->getService(array('class' => 'USAddressVerification'));
- // Address to verify. Not all fields are required but
- // supply as many as possible for the best results.
- $address = array('firm' => 'Zend Technologies',
- 'addressLine1' => '19200 Stevens Creek Blvd',
- 'addressLine2' => '',
- 'city_state_zip' => 'Cupertino CA 95014');
- // Verify the address
- $result = $verifier->verifyAddressUSA($address);
- // Display the results
- if ($result->addressErrorNumber != 0) {
- echo $result->addressErrorNumber;
- echo $result->addressErrorMessage;
- } else {
- // show all properties
- print_r($result);
- // or just the firm name
- echo $result->firm;
- // valid address?
- $valid = ($result->valid == 'VALID');
- }
- ]]></programlisting>
- </sect2>
- <sect2 id="zend.service.strikeiron.bundled-services.sales-use-tax-basic">
- <title>Sales & Use Tax Basic</title>
- <para>
- <classname>Zend_Service_StrikeIron_SalesUseTaxBasic</classname> provides a client for
- StrikeIron's Sales & Use Tax Basic service. For more information on this
- service, visit these StrikeIron resources:
- <itemizedlist>
- <listitem>
- <para>
- <ulink url="http://www.strikeiron.com/ProductDetail.aspx?p=351">Sales &
- Use Tax Basic Service Page</ulink>
- </para>
- </listitem>
- <listitem>
- <para>
- <ulink
- url="http://ws.strikeiron.com/zf1.StrikeIron/taxdatabasic4?WSDL">Sales
- & Use Tax Basic Service WSDL</ulink>
- </para>
- </listitem>
- </itemizedlist>
- </para>
- <para>
- The service contains two methods, <methodname>getTaxRateUSA()</methodname> and
- <methodname>getTaxRateCanada()</methodname>, that will retrieve sales and use tax data
- for the United States and Canada, respectively.
- </para>
- <programlisting language="php"><![CDATA[
- $strikeIron = new Zend_Service_StrikeIron(array('username' => 'your-username',
- 'password' => 'your-password'));
- // Get a client for the Sales & Use Tax Basic service
- $taxBasic = $strikeIron->getService(array('class' => 'SalesUseTaxBasic'));
- // Query tax rate for Ontario, Canada
- $rateInfo = $taxBasic->getTaxRateCanada(array('province' => 'foo'));
- print_r($rateInfo); // show all properties
- echo $rateInfo->GST; // or just the GST (Goods & Services Tax)
- // Query tax rate for Cupertino, CA USA
- $rateInfo = $taxBasic->getTaxRateUS(array('zip_code' => 95014));
- print_r($rateInfo); // show all properties
- echo $rateInfo->state_sales_tax; // or just the state sales tax
- ]]></programlisting>
- </sect2>
- </sect1>
|