Source for file gMerchantCalculations.php

Documentation is available at gMerchantCalculations.php

  1. <?php
  2.  
  3. /**
  4. * ========================================================
  5. * phpGCheckout, Open Source PHP G Checkout Library
  6. * http://www.phpgcheckout.com
  7. * ========================================================
  8. *
  9. * Copyright (c) 2006 Expert Database Solutions, LLC
  10. *
  11. * Permission is hereby granted, free of charge, to any person obtaining a
  12. * copy of this software and associated documentation files (the "Software"),
  13. * to deal in the Software without restriction, including without limitation the
  14. * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15. * copies of the Software, and to permit persons to whom the Software is
  16. * furnished to do so, subject to the following conditions:
  17. *
  18. * The above copyright notice and this permission notice shall be included in all
  19. * copies or substantial portions of the Software.
  20. *
  21. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  22. * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  23. * PARTICULAR PURPOSE AND NONINFRINGEMENT.
  24. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
  25. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
  26. * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  27. *
  28. */
  29. class gMerchantCalculations {
  30. var $_merchant_calculations_url;
  31. var $_accept_merchant_coupons; /* Boolean */
  32. var $_accept_gift_certificates; /* Boolean */
  33. function gMerchantCalculations($url, $bAcceptMerchantCoupons = null, $bAcceptGiftCertificates = null) {
  34. $this->_merchant_calculations_url = $url;
  35. $this->_accept_merchant_coupons = $bAcceptMerchantCoupons;
  36. $this->_accept_gift_certificates = $bAcceptGiftCertificates;
  37. }
  38. function getXML() {
  39. $str_xml = "";
  40. /**
  41. * Check for url
  42. */
  43. if(!empty($this->_merchant_calculations_url))
  44. $str_xml .= " <merchant-calculations-url>$this->_merchant_calculations_url</merchant-calculations-url>";
  45. else
  46. return ""; /* if there's no url return empty string */
  47. /**
  48. * Accept Merchant Coupons
  49. */
  50. if(!empty($this->_accept_merchant_coupons))
  51. $str_xml .= " <accept-merchant-coupons>$this->_accept_merchant_coupons</accept-merchant-coupons>";
  52. /**
  53. * Accept Gift Certificates
  54. */
  55. if(!empty($this->_accept_gift_certificates))
  56. $str_xml .= " <accept-gift-certificates>$this->_accept_gift_certificates</accept-gift-certificates>";
  57.  
  58. return $str_xml;
  59. }
  60. }
  61. ?>

Documentation generated on Mon, 04 Dec 2006 11:09:34 -0500 by phpDocumentor 1.3.0RC3