Zend_Service_StrikeIron-BundledServices.xml 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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>
  5. <para>
  6. <classname>Zend_Service_StrikeIron</classname> comes with wrapper classes for three popular StrikeIron services.
  7. </para>
  8. <sect2 id="zend.service.strikeiron.bundled-services.zip-code-information">
  9. <title>ZIP Code Information</title>
  10. <para>
  11. <classname>Zend_Service_StrikeIron_ZipCodeInfo</classname> provides a client for StrikeIron's
  12. Zip Code Information Service. For more information on this service, visit these
  13. StrikeIron resources:
  14. <itemizedlist>
  15. <listitem>
  16. <para>
  17. <ulink url="http://www.strikeiron.com/ProductDetail.aspx?p=267">Zip Code Information Service Page</ulink>
  18. </para>
  19. </listitem>
  20. <listitem>
  21. <para>
  22. <ulink url="http://sdpws.strikeiron.com/zf1.StrikeIron/sdpZIPCodeInfo?WSDL">Zip Code Information Service WSDL</ulink>
  23. </para>
  24. </listitem>
  25. </itemizedlist>
  26. The service contains a <code>getZipCode()</code> method that will retrieve information
  27. about a United States ZIP code or Canadian postal code:
  28. <programlisting language="php"><![CDATA[
  29. $strikeIron = new Zend_Service_StrikeIron(array('username' => 'your-username',
  30. 'password' => 'your-password'));
  31. // Get a client for the Zip Code Information service
  32. $zipInfo = $strikeIron->getService(array('class' => 'ZipCodeInfo'));
  33. // Get the Zip information for 95014
  34. $response = $zipInfo->getZipCode(array('ZipCode' => 95014));
  35. $zips = $response->serviceResult;
  36. // Display the results
  37. if ($zips->count == 0) {
  38. echo 'No results found';
  39. } else {
  40. // a result with one single zip code is returned as an object,
  41. // not an array with one element as one might expect.
  42. if (! is_array($zips->zipCodes)) {
  43. $zips->zipCodes = array($zips->zipCodes);
  44. }
  45. // print all of the possible results
  46. foreach ($zips->zipCodes as $z) {
  47. $info = $z->zipCodeInfo;
  48. // show all properties
  49. print_r($info);
  50. // or just the city name
  51. echo $info->preferredCityName;
  52. }
  53. }
  54. // Detailed status information
  55. // http://www.strikeiron.com/exampledata/StrikeIronZipCodeInformation_v3.pdf
  56. $status = $response->serviceStatus;
  57. ]]></programlisting>
  58. </para>
  59. </sect2>
  60. <sect2 id="zend.service.strikeiron.bundled-services.us-address-verification">
  61. <title>U.S. Address Verification</title>
  62. <para>
  63. <classname>Zend_Service_StrikeIron_USAddressVerification</classname> provides a client for
  64. StrikeIron's U.S. Address Verification Service. For more information on this
  65. service, visit these StrikeIron resources:
  66. <itemizedlist>
  67. <listitem>
  68. <para>
  69. <ulink url="http://www.strikeiron.com/ProductDetail.aspx?p=198">U.S. Address Verification Service Page</ulink>
  70. </para>
  71. </listitem>
  72. <listitem>
  73. <para>
  74. <ulink url="http://ws.strikeiron.com/zf1.StrikeIron/USAddressVerification4_0?WSDL">U.S. Address Verification Service WSDL</ulink>
  75. </para>
  76. </listitem>
  77. </itemizedlist>
  78. </para>
  79. <para>
  80. The service contains a <code>verifyAddressUSA()</code> method that will verify
  81. an address in the United States:
  82. <programlisting language="php"><![CDATA[
  83. $strikeIron = new Zend_Service_StrikeIron(array('username' => 'your-username',
  84. 'password' => 'your-password'));
  85. // Get a client for the Zip Code Information service
  86. $verifier = $strikeIron->getService(array('class' => 'USAddressVerification'));
  87. // Address to verify. Not all fields are required but
  88. // supply as many as possible for the best results.
  89. $address = array('firm' => 'Zend Technologies',
  90. 'addressLine1' => '19200 Stevens Creek Blvd',
  91. 'addressLine2' => '',
  92. 'city_state_zip' => 'Cupertino CA 95014');
  93. // Verify the address
  94. $result = $verifier->verifyAddressUSA($address);
  95. // Display the results
  96. if ($result->addressErrorNumber != 0) {
  97. echo $result->addressErrorNumber;
  98. echo $result->addressErrorMessage;
  99. } else {
  100. // show all properties
  101. print_r($result);
  102. // or just the firm name
  103. echo $result->firm;
  104. // valid address?
  105. $valid = ($result->valid == 'VALID');
  106. }
  107. ]]></programlisting>
  108. </para>
  109. </sect2>
  110. <sect2 id="zend.service.strikeiron.bundled-services.sales-use-tax-basic">
  111. <title>Sales &amp; Use Tax Basic</title>
  112. <para>
  113. <classname>Zend_Service_StrikeIron_SalesUseTaxBasic</classname> provides a client for
  114. StrikeIron's Sales &amp; Use Tax Basic service. For more information on this
  115. service, visit these StrikeIron resources:
  116. <itemizedlist>
  117. <listitem>
  118. <para>
  119. <ulink url="http://www.strikeiron.com/ProductDetail.aspx?p=351">Sales &amp; Use Tax Basic Service Page</ulink>
  120. </para>
  121. </listitem>
  122. <listitem>
  123. <para>
  124. <ulink url="http://ws.strikeiron.com/zf1.StrikeIron/taxdatabasic4?WSDL">Sales &amp; Use Tax Basic Service WSDL</ulink>
  125. </para>
  126. </listitem>
  127. </itemizedlist>
  128. </para>
  129. <para>
  130. The service contains two methods, <code>getTaxRateUSA()</code> and <code>getTaxRateCanada()</code>,
  131. that will retrieve sales and use tax data for the United States and Canada, respectively.
  132. <programlisting language="php"><![CDATA[
  133. $strikeIron = new Zend_Service_StrikeIron(array('username' => 'your-username',
  134. 'password' => 'your-password'));
  135. // Get a client for the Sales & Use Tax Basic service
  136. $taxBasic = $strikeIron->getService(array('class' => 'SalesUseTaxBasic'));
  137. // Query tax rate for Ontario, Canada
  138. $rateInfo = $taxBasic->getTaxRateCanada(array('province' => 'foo'));
  139. print_r($rateInfo); // show all properties
  140. echo $rateInfo->GST; // or just the GST (Goods & Services Tax)
  141. // Query tax rate for Cupertino, CA USA
  142. $rateInfo = $taxBasic->getTaxRateUS(array('zip_code' => 95014));
  143. print_r($rateInfo); // show all properties
  144. echo $rateInfo->state_sales_tax; // or just the state sales tax
  145. ]]></programlisting>
  146. </para>
  147. </sect2>
  148. </sect1>