Services_Ebay
[ class tree: Services_Ebay ] [ index: Services_Ebay ] [ all elements ]

Source for file Order.php

Documentation is available at Order.php

  1. <?PHP
  2. /**
  3.  * Model for an eBay order
  4.  *
  5.  * @package Services_Ebay
  6.  * @author  Stephan Schmidt <schst@php.net>
  7.  */
  8. {
  9.    /**
  10.     * create a new order
  11.     *
  12.     * @param    array 
  13.     * @param    object 
  14.     */
  15.     public function __construct($props$session = null)
  16.     {
  17.         parent::__construct($props$session);
  18.         $this->properties['TransactionArray'= array('Transaction' => array());
  19.         $this->properties['ShippingDetails']  = array(
  20.                                                         'ShippingServiceOptions'            => array(),
  21.                                                         'InternationalShippingServiceOption'=> array(),
  22.                                                         'SalesTax'                          => array()
  23.                                                      );
  24.     }
  25.  
  26.    /**
  27.     * set a property
  28.     * (overriding the parent one)
  29.     *
  30.     * @prop     string  property name
  31.     * @prop     mixed   property value
  32.     */   
  33.     public function __set($prop$value)
  34.     {
  35.         $shippingDetailsSubElements = array(
  36.                                             'ApplyShippingDiscount',
  37.                                             'InsuranceFee',
  38.                                             'InsuranceOption',
  39.                                             'ThirdPartyCheckout'
  40.                                         );
  41.         if (in_array($prop$shippingDetailsSubElements)) {
  42.             $this->properties['ShippingDetails'][$prop$value;
  43.         else {
  44.             $this->properties[$prop$value;
  45.         }
  46.     }
  47.     
  48.    /**
  49.     * add a new transaction
  50.     *
  51.     * @param    string 
  52.     * @param    string 
  53.     */    
  54.     public function AddTransaction($ItemId$TransactionId)
  55.     {
  56.         $Transaction = array(
  57.                             'Item'          => array(
  58.                                                       'ItemID' => $ItemId
  59.                                                     ),
  60.                             'TransactionID' => $TransactionId
  61.                             );
  62.                             
  63.         array_push($this->properties['TransactionArray']['Transaction']$Transaction);
  64.     }
  65.  
  66.    /**
  67.     * add a new shipping option
  68.     *
  69.     * @param    string 
  70.     * @param    string 
  71.     */    
  72.     public function AddShippingServiceOption($ShippingInsuranceCost$ShippingService$ShippingServiceAdditionalCost,
  73.                                              $ShippingServiceCost$ShippingServicePriority)
  74.     {
  75.         $Option = array(
  76.                             'ShippingInsuranceCost'         => $ShippingInsuranceCost,
  77.                             'ShippingService'               => $ShippingService,
  78.                             'ShippingServiceAdditionalCost' => $ShippingServiceAdditionalCost,
  79.                             'ShippingServiceCost'           => $ShippingServiceCost,
  80.                             'ShippingServicePriority'       => $ShippingServicePriority
  81.                        );
  82.                             
  83.         array_push($this->properties['ShippingDetails']['ShippingServiceOptions']$Option);
  84.     }
  85.  
  86.    /**
  87.     * Add International shipping service options
  88.     *
  89.     * @param    string 
  90.     * @param    string 
  91.     * @param    string 
  92.     * @param    int 
  93.     * @param    string 
  94.     */
  95.     public function AddInternationalShippingServiceOption($ShippingService$ShippingServiceAdditionalCost,
  96.                                                           $ShippingServiceCost$ShippingServicePriority,
  97.                                                           $ShipToLocation)
  98.     {
  99.         $Options = array(
  100.                             'ShippingService'               => $ShippingService,
  101.                             'ShippingServiceAdditionalCost' => $ShippingServiceAdditionalCost,
  102.                             'ShippingServiceCost'           => $ShippingServiceCost,
  103.                             'ShippingServicePriority'       => $ShippingServicePriority,
  104.                             'ShipToLocation'                => $ShipToLocation
  105.                         );
  106.  
  107.         array_push($this->properties['ShippingDetails']['InternationalShippingServiceOption']$Options);
  108.     }
  109.  
  110.    /**
  111.     * Add Sales tax options
  112.     *
  113.     * @param    float 
  114.     * @param    string 
  115.     * @param    boolean 
  116.     */
  117.     public function AddSalesTax($SalesTaxPercent$SalesTaxState$ShippingIncludedInTax)
  118.     {
  119.         $Option = array(
  120.                             'SalesTaxPercent'       => $SalesTaxPercent,
  121.                             'SalesTaxState'         => $SalesTaxState,
  122.                             'ShippingIncludedInTax' => $ShippingIncludedInTax
  123.                         );
  124.  
  125.         array_push($this->properties['ShippingDetails']['SalesTax']$Option);
  126.     }
  127. }
  128. ?>

Documentation generated on Mon, 11 Mar 2019 15:49:49 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.