Overview

Packages

  • IllApps
    • Shipsync
  • PHP

Classes

  • IllApps_Shipsync_Block_Adminhtml_Sales_Order_Shipment_Abstract
  • IllApps_Shipsync_Block_Adminhtml_Sales_Order_Shipment_Packages_View
  • IllApps_Shipsync_Block_Adminhtml_Sales_Order_Shipment_Packages_View_Form
  • IllApps_Shipsync_Block_Adminhtml_Sales_Order_Shipment_Packages_View_Items
  • IllApps_Shipsync_Block_Adminhtml_Sales_Order_Shipment_Packages_View_Package
  • IllApps_Shipsync_Block_Adminhtml_Sales_Order_Shipment_View
  • IllApps_Shipsync_Block_Adminhtml_Sales_Order_View
  • IllApps_Shipsync_Block_Adminhtml_Shipsync
  • IllApps_Shipsync_Block_Adminhtml_Shipsync_Option
  • IllApps_Shipsync_Helper_Data
  • IllApps_Shipsync_IndexController
  • IllApps_Shipsync_Model_Mysql4_Setup
  • IllApps_Shipsync_Model_Mysql4_Shipment_Package
  • IllApps_Shipsync_Model_Mysql4_Shipment_Package_Collection
  • IllApps_Shipsync_Model_Sales_Order_Shipment_Package
  • IllApps_Shipsync_Model_Sales_Order_Shipment_Package_Item
  • IllApps_Shipsync_Model_Sales_Quote_Address
  • IllApps_Shipsync_Model_Shipment_Abstract
  • IllApps_Shipsync_Model_Shipment_Package
  • IllApps_Shipsync_Model_Shipment_Request
  • IllApps_Shipsync_Model_Shipment_Response
  • IllApps_Shipsync_Model_Shipment_Result
  • IllApps_Shipsync_Model_Shipping_Carrier_Abstract
  • IllApps_Shipsync_Model_Shipping_Carrier_Fedex
  • IllApps_Shipsync_Model_Shipping_Carrier_Fedex_Address
  • IllApps_Shipsync_Model_Shipping_Carrier_Fedex_Package
  • IllApps_Shipsync_Model_Shipping_Carrier_Fedex_Rate
  • IllApps_Shipsync_Model_Shipping_Carrier_Fedex_Ship
  • IllApps_Shipsync_Model_Shipping_Carrier_Fedex_Source_B13afilingoption
  • IllApps_Shipsync_Model_Shipping_Carrier_Fedex_Source_Freemethod
  • IllApps_Shipsync_Model_Shipping_Carrier_Fedex_Source_Label_Image
  • IllApps_Shipsync_Model_Shipping_Carrier_Fedex_Source_Label_Orientation
  • IllApps_Shipsync_Model_Shipping_Carrier_Fedex_Source_Label_Stock
  • IllApps_Shipsync_Model_Shipping_Carrier_Fedex_Source_Method
  • IllApps_Shipsync_Model_Shipping_Carrier_Fedex_Source_Packaging
  • IllApps_Shipsync_Model_Shipping_Carrier_Fedex_Source_Rate
  • IllApps_Shipsync_Model_Shipping_Carrier_Fedex_Source_Ratediscount
  • IllApps_Shipsync_Model_Shipping_Carrier_Fedex_Source_Residencedelivery
  • IllApps_Shipsync_Model_Shipping_Carrier_Fedex_Source_Signature
  • IllApps_Shipsync_Model_Shipping_Carrier_Fedex_Source_Smartpost_Endorsement
  • IllApps_Shipsync_Model_Shipping_Carrier_Fedex_Source_Smartpost_Indicia
  • IllApps_Shipsync_Model_Shipping_Carrier_Fedex_Source_Unitofmeasure
  • IllApps_Shipsync_Model_Shipping_Carrier_Fedex_Track
  • IllApps_Shipsync_Model_Shipping_Package
  • IllApps_Shipsync_Model_Shipping_Package_Item
  • IllApps_Shipsync_Model_Shipping_Package_Origins
  • IllApps_Shipsync_Model_Shipping_Package_Sort
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: 
  3: /**
  4:  * ShipSync
  5:  *
  6:  * @category   IllApps
  7:  * @package    IllApps_Shipsync
  8:  * @copyright  Copyright (c) 2014 EcoMATICS, Inc. DBA IllApps (http://www.illapps.com)
  9:  * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 10:  */
 11: 
 12: /**
 13:  * IllApps_Shipsync_Model_Shipment_Package
 14:  */
 15: class IllApps_Shipsync_Model_Shipment_Request extends IllApps_Shipsync_Model_Shipment_Abstract
 16: {
 17:     protected $_masterTrackingId = false;
 18:     protected $_isMasterPackage = true;
 19:         
 20:     
 21:     /*
 22:      * Returns formatted array for ship request
 23:      * 
 24:      * @return array
 25:      */
 26:     public function getShipperDetails()
 27:     {       
 28:         $details = array(
 29:             'Contact' => array(
 30:                 'CompanyName' => $this->getShipperCompany(),
 31:                 'PhoneNumber' => $this->getShipperPhone()
 32:             ),
 33:             'Address' => array(
 34:                 'StreetLines' => $this->getShipperStreetLines(),
 35:                 'City' => $this->getShipperCity(),                
 36:                 'PostalCode' => $this->getShipperPostalCode(),
 37:                 'CountryCode' => $this->getShipperCountryCode()
 38:             )
 39:         );
 40:         
 41:         if ($this->getShipperStateOrProvinceCode() != '') {
 42:             $details['Address']['StateOrProvinceCode'] = $this->getShipperStateOrProvinceCode();
 43:         }
 44:         
 45:         return $details;
 46:     }
 47:     
 48:     /*
 49:      * Returns formatted array for ship request
 50:      *
 51:      * @return array
 52:      */
 53:     public function getRecipientDetails()
 54:     {
 55:         $recipient = array(
 56:             'Contact' => array(
 57:                 'PersonName' => $this->getRecipientAddress()->getName(),
 58:                 'PhoneNumber' => $this->getRecipientAddress()->getTelephone()
 59:             ),
 60:             'Address' => array(
 61:                 'StreetLines' => $this->getRecipientAddress()->getStreet(),
 62:                 'City' => $this->getRecipientAddress()->getCity(),
 63:                 'StateOrProvinceCode' => $this->getRecipientAddress()->getRegionCode(),
 64:                 'PostalCode' => $this->getRecipientAddress()->getPostcode(),
 65:                 'CountryCode' => $this->getRecipientAddress()->getCountryId(),
 66:                 'Residential' => $this->getResidential()
 67:             )
 68:         );
 69:         
 70:         if ($this->getRecipientAddress()->getCompany() != '') {
 71:             $recipient['Contact']['CompanyName'] = $this->getRecipientAddress()->getCompany();
 72:         }
 73:         
 74:         return $recipient;
 75:     }
 76:     
 77:     /*
 78:      * Returns formatted array for ship request
 79:      * 
 80:      * @return array
 81:      */
 82:     public function getLabelSpecification()
 83:     {
 84:         return array(
 85:             'LabelFormatType' => 'COMMON2D',
 86:             'ImageType' => Mage::getStoreConfig('carriers/fedex/label_image'),
 87:             'LabelStockType' => Mage::getStoreConfig('carriers/fedex/label_stock'),
 88:             'LabelPrintingOrientation' => Mage::getStoreConfig('carriers/fedex/label_orientation'),
 89:             'CustomerSpecifiedDetail' => array(
 90:                 'DocTabContent' => array(
 91:                     'DocTabContentType' => 'STANDARD'
 92:                 )
 93:             )
 94:         );
 95:     }
 96:     
 97:     /*
 98:      * Returns formatted array for ship request
 99:      *
100:      * @return array
101:      */
102:     public function getSmartPostDetails()
103:     {
104:         $detail = array(
105:             'Indicia' => Mage::getStoreConfig('carriers/fedex/smartpost_indicia_type'),
106:             'AncillaryEndorsement' => Mage::getStoreConfig('carriers/fedex/smartpost_endorsement'),
107:             'SpecialServices' => 'USPS_DELIVERY_CONFIRMATION',
108:             'HubId' => Mage::getStoreConfig('carriers/fedex/smartpost_hub_id')
109:         );
110:         
111:         return Mage::getStoreConfig('carriers/fedex/smartpost_customer_manifest_id') ? array_merge($detail, Mage::getStoreConfig('carriers/fedex/smartpost_customer_manifest_id')) : $detail;
112:     }
113:     
114:     /*
115:      * Set Master Tracking Id
116:      * 
117:      * @return IllApps_Shipsync_Model_Shipment_Request
118:      */
119:     public function setMasterTrackingId($id)
120:     {
121:         foreach ($id as $key => $val) {
122:             $arr[$key] = $val;
123:         }
124:         $this->_masterTrackingId = $arr;
125:         return $this;
126:     }
127:     
128:     /*
129:      * Get Master Tracking Id
130:      * 
131:      * @return array
132:      */
133:     public function getMasterTrackingId()
134:     {
135:         return $this->_masterTrackingId;
136:     }
137:     
138:     /*
139:      * Return count of all packages in MPS Shipment
140:      *
141:      * @return int
142:      */
143:     public function getPackageCount()
144:     {
145:         return Mage::getStoreConfig('carriers/fedex/mps_shipments') ? count($this->getPackages()) : 1;
146:     }
147:     
148:     /*
149:      * Return total weight of shipment across all packages
150:      * 
151:      * @return float
152:      */
153:     public function getTotalShipmentWeight()
154:     {
155:         $total = 0;
156:         
157:         foreach ($this->getPackages() as $package) {
158:             $total += $package->getWeight();
159:         }
160:         
161:         return $total;
162:     }
163:     
164:     /*
165:      * Get transaction type
166:      *
167:      * @return string
168:      */
169:     public function getTransactionType()
170:     {
171:         return $this->getStore()->getConfig('shipping/origin/country_id') != $this->getRecipientAddress()->getCountryId() ? 'International' : 'Domestic';
172:     }
173:     
174:     /*
175:      * Get transaction method
176:      *
177:      * @return string
178:      */
179:     public function getTransactionMethod()
180:     {
181:         return ($this->getServiceType() == 'GROUND_HOME_DELIVERY' || $this->getServiceType() == 'FEDEX_GROUND') ? 'Ground' : 'Express';
182:     }
183:     
184:     /*
185:      * Return formatted MPS data if necessary
186:      *
187:      * @return array
188:      */
189:     public function getMpsData()
190:     {
191:         if (!Mage::getStoreConfig('carriers/fedex/mps_shipments')) {
192:             return array(
193:                 'PackageCount' => 1
194:             );
195:         }
196:         
197:         else if ($this->getMasterTrackingId()) {
198:             return array(
199:                 'MasterTrackingId' => $this->getMasterTrackingId(),
200:                 'PackageCount' => $this->getPackageCount(),
201:                 'TotalShipmentWeight' => $this->getTotalShipmentWeight()
202:             );
203:         } else {
204:             return array(
205:                 'PackageCount' => $this->getPackageCount(),
206:                 'TotalShipmentWeight' => $this->getTotalShipmentWeight()
207:             );
208:         }
209:     }
210:     
211:     /*
212:      * Toggle after Master package details retrieved
213:      *
214:      * @return IllApps_Shipsync_Model_Shipment_Request
215:      */
216:     public function setIsChildPackage()
217:     {
218:         $this->_isMasterPackage = false;
219:         return $this;
220:     }
221:     
222:     /*
223:      * Test for Master Package
224:      *
225:      * @return bool
226:      */
227:     public function isMasterBool()
228:     {
229:         return $this->_isMasterPackage;
230:     }
231:     
232:     public function getPayorAccount()
233:     {
234:         return Mage::getStoreConfig('carriers/fedex/third_party') ? Mage::getStoreConfig('carriers/fedex/third_party_fedex_account') : $this->getFedexAccount();
235:     }
236:     
237:     public function getPayorAccountCountry()
238:     {
239:         return Mage::getStoreConfig('carriers/fedex/third_party') ? Mage::getStoreConfig('carriers/fedex/third_party_fedex_account') : $this->getFedexAccountCountry();
240:     }
241:     
242:     public function getPayorType()
243:     {
244:         return Mage::getStoreConfig('carriers/fedex/third_party') ? 'THIRD_PARTY' : 'SENDER';
245:     }
246: }
247: 
shipsync-community API documentation generated by ApiGen 2.8.0