ParcelPro_Carrier - Version 1.0.5

Version Notes

Version 1.0.5
API format changes

Version 1.0.4
FIX: Logs prematurely truncated.

Version 1.0.3
Logging bugfix

Version 1.0.2
Improved logging

Version 1.0.1
Actually use default location for ShipFrom
Some error logging added

Version 1.0.0
New release.

Download this release

Release Info

Developer Parcel Pro, Inc. Joey Chan, Project Lead Jasper Lynn, Project Manager
Extension ParcelPro_Carrier
Version 1.0.5
Comparing to
See all releases


Code changes from version 1.0.4 to 1.0.5

app/code/community/ParcelPro/Carrier/Model/Carrier.php CHANGED
@@ -466,7 +466,10 @@ class ParcelPro_Carrier_Model_Carrier extends Mage_Shipping_Model_Carrier_Abstra
466
  $shipmentResult = $this->_sendRequestShipment($this->_shipment_path. '/' . $quoteID);
467
 
468
  if($shipmentResult){
469
- $result->setShippingLabelContent(base64_decode($shipmentResult->LabelImage));
 
 
 
470
  //$result->setTrackingNumber($shipmentResult->TrackingNumber);
471
  $result->setTrackingNumber($shipmentResult->InternalTrackingNumber);
472
 
@@ -1171,16 +1174,28 @@ class ParcelPro_Carrier_Model_Carrier extends Mage_Shipping_Model_Carrier_Abstra
1171
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
1172
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
1173
  curl_setopt($ch, CURLOPT_HTTPHEADER, array(
1174
- 'Content-Type: application/xml',
1175
  'Content-Length: 0'
1176
  )
1177
  );
1178
 
 
 
1179
  $data = curl_exec ($ch);
 
 
 
 
 
 
 
1180
  curl_close ($ch);
 
 
 
1181
  if($data){
1182
- $result = json_encode(simplexml_load_string($data));
1183
- return json_decode($result, false);
1184
  }else{
1185
  return null;
1186
  }
466
  $shipmentResult = $this->_sendRequestShipment($this->_shipment_path. '/' . $quoteID);
467
 
468
  if($shipmentResult){
469
+ if(base64_decode($shipmentResult->LabelImage))
470
+ $result->setShippingLabelContent(base64_decode($shipmentResult->LabelImage));
471
+ else
472
+ $result->setShippingLabelContent(call_user_func_array("pack",array_merge(array("C*"),$shipmentResult->LabelImage)));
473
  //$result->setTrackingNumber($shipmentResult->TrackingNumber);
474
  $result->setTrackingNumber($shipmentResult->InternalTrackingNumber);
475
 
1174
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
1175
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
1176
  curl_setopt($ch, CURLOPT_HTTPHEADER, array(
1177
+ 'Content-Type: application/json',
1178
  'Content-Length: 0'
1179
  )
1180
  );
1181
 
1182
+ curl_setopt($ch, CURLOPT_HEADER, true);
1183
+
1184
  $data = curl_exec ($ch);
1185
+ list($header,$data) = explode("\r\n\r\n",$data,2);
1186
+ $header = explode("\r\n",$header);
1187
+ while(explode(" ",$header[0])[1]=='100'){
1188
+ list($header,$data) = explode("\r\n\r\n",$data,2);
1189
+ $header = explode("\r\n",$header);
1190
+ }
1191
+ $http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
1192
  curl_close ($ch);
1193
+ if($http_status == '400'){
1194
+ Mage::log("Shipment failed:".explode(" ",$header[0],3)[2],null,'ppimagento.log');
1195
+ }
1196
  if($data){
1197
+ //$result = json_encode(simplexml_load_string($data));
1198
+ return json_decode($data, false);
1199
  }else{
1200
  return null;
1201
  }
package.xml CHANGED
@@ -1,14 +1,17 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ParcelPro_Carrier</name>
4
- <version>1.0.4</version>
5
  <stability>stable</stability>
6
  <license uri="https://www.mozilla.org/MPL/2.0/">MPL 2.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Parcel Pro for Magento is a web-based Insured Shipping solution that integrates with your Magento online store, adding Parcel Pro as one of your shipping options. It allows you to set the price of shipping and insurance coverage quickly and easily.</summary>
10
  <description>Parcel Pro for Magento is a web-based Insured Shipping solution that integrates with your Magento online store. It adds Parcel Pro as one of your shipping options, allowing you to set the price of shipping and insurance coverage easily. You must have a Magento store. By having Parcel Pro for Magento installed into your Magento store, you&#x2019;ll have a powerful new option for your customers to choose from when selecting Insured Shipping. With solid integration with your favorite carriers, Parcel Pro for Magento lets your customers check out in a breeze, with the costs of shipping and insurance embedded into your price.</description>
11
- <notes>Version 1.0.4&#xD;
 
 
 
12
  FIX: Logs prematurely truncated.&#xD;
13
  &#xD;
14
  Version 1.0.3&#xD;
@@ -24,9 +27,9 @@ Some error logging added&#xD;
24
  Version 1.0.0&#xD;
25
  New release.</notes>
26
  <authors><author><name>Parcel Pro, Inc.</name><user>ParcelProInc</user><email>techsupport@parcelpro.com</email></author></authors>
27
- <date>2014-09-25</date>
28
- <time>18:39:12</time>
29
- <contents><target name="magecommunity"><dir name="ParcelPro"><dir name="Carrier"><dir name="Block"><dir name="Adminhtml"><dir name="Button"><dir name="Refresh"><file name="Cms.php" hash="4e17c2e2488321dec06785af3b3c3706"/></dir></dir></dir></dir><dir name="Helper"><file name="Parcelpro.php" hash="473cd2f7f29d2406dbf21930b76a6f99"/></dir><dir name="Model"><file name="Carrier.php" hash="e79510658a74f153b8604eeb36652d4b"/><file name="Config.php" hash="1a524a99e831bcbad22ffd50316aec44"/><dir name="Mysql4"><dir name="Config"><file name="Collection.php" hash="60720e05a974b362891d4dba01694132"/></dir><file name="Config.php" hash="ac407fcd7973e28342bc99a24fad7b4a"/></dir><dir name="Resource"><dir name="Mysql4"><file name="Setup.php" hash="4c6b2c661d616ccce831185d30cc340e"/></dir></dir><dir name="Source"><file name="Carriers.php" hash="fbae840c7a2bb07d36f61aab7cf4d960"/><file name="Dropoff.php" hash="ab1c1c54e22ed3f1c628cd2f34b50ea8"/><file name="Fedexmethod.php" hash="1966f6b0e4cb1f5a8cbb8be5a2b38981"/><file name="Freemethod.php" hash="2f590b14abae6718abdd8ab1ebbca2b8"/><file name="Packaging.php" hash="85e5e9416c4ba68bedd12558edafe384"/><file name="Unitofmeasure.php" hash="4048107787504d7aef1b662de777e93d"/><file name="Upsmethod.php" hash="4eed70c1e0f051622251377dd2ffe050"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="RefreshController.php" hash="01dc45dd06e8af8968cce7fbaa554cb9"/></dir><file name="IndexController.php" hash="dd116c50612320505894e151b43a8fcc"/></dir><dir name="etc"><file name="config.xml" hash="2e9655e356b5609e5b50f90c94bb79df"/><file name="system.xml" hash="25e4b2b1e7c61b4bf55d5015d5cab0df"/></dir><dir name="sql"><dir name="carrier_setup"><file name="mysql4-install-1.0.0.php" hash="42faff48ed0752ba42739316ac02e890"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="ParcelPro_Carrier.xml" hash=""/></dir></target></contents>
30
  <compatible/>
31
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
32
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ParcelPro_Carrier</name>
4
+ <version>1.0.5</version>
5
  <stability>stable</stability>
6
  <license uri="https://www.mozilla.org/MPL/2.0/">MPL 2.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Parcel Pro for Magento is a web-based Insured Shipping solution that integrates with your Magento online store, adding Parcel Pro as one of your shipping options. It allows you to set the price of shipping and insurance coverage quickly and easily.</summary>
10
  <description>Parcel Pro for Magento is a web-based Insured Shipping solution that integrates with your Magento online store. It adds Parcel Pro as one of your shipping options, allowing you to set the price of shipping and insurance coverage easily. You must have a Magento store. By having Parcel Pro for Magento installed into your Magento store, you&#x2019;ll have a powerful new option for your customers to choose from when selecting Insured Shipping. With solid integration with your favorite carriers, Parcel Pro for Magento lets your customers check out in a breeze, with the costs of shipping and insurance embedded into your price.</description>
11
+ <notes>Version 1.0.5&#xD;
12
+ API format changes&#xD;
13
+ &#xD;
14
+ Version 1.0.4&#xD;
15
  FIX: Logs prematurely truncated.&#xD;
16
  &#xD;
17
  Version 1.0.3&#xD;
27
  Version 1.0.0&#xD;
28
  New release.</notes>
29
  <authors><author><name>Parcel Pro, Inc.</name><user>ParcelProInc</user><email>techsupport@parcelpro.com</email></author></authors>
30
+ <date>2014-09-26</date>
31
+ <time>22:07:48</time>
32
+ <contents><target name="magecommunity"><dir name="ParcelPro"><dir name="Carrier"><dir name="Block"><dir name="Adminhtml"><dir name="Button"><dir name="Refresh"><file name="Cms.php" hash="4e17c2e2488321dec06785af3b3c3706"/></dir></dir></dir></dir><dir name="Helper"><file name="Parcelpro.php" hash="473cd2f7f29d2406dbf21930b76a6f99"/></dir><dir name="Model"><file name="Carrier.php" hash="edb06e85da805e8cf8271ac6b289ff96"/><file name="Config.php" hash="1a524a99e831bcbad22ffd50316aec44"/><dir name="Mysql4"><dir name="Config"><file name="Collection.php" hash="60720e05a974b362891d4dba01694132"/></dir><file name="Config.php" hash="ac407fcd7973e28342bc99a24fad7b4a"/></dir><dir name="Resource"><dir name="Mysql4"><file name="Setup.php" hash="4c6b2c661d616ccce831185d30cc340e"/></dir></dir><dir name="Source"><file name="Carriers.php" hash="fbae840c7a2bb07d36f61aab7cf4d960"/><file name="Dropoff.php" hash="ab1c1c54e22ed3f1c628cd2f34b50ea8"/><file name="Fedexmethod.php" hash="1966f6b0e4cb1f5a8cbb8be5a2b38981"/><file name="Freemethod.php" hash="2f590b14abae6718abdd8ab1ebbca2b8"/><file name="Packaging.php" hash="85e5e9416c4ba68bedd12558edafe384"/><file name="Unitofmeasure.php" hash="4048107787504d7aef1b662de777e93d"/><file name="Upsmethod.php" hash="4eed70c1e0f051622251377dd2ffe050"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="RefreshController.php" hash="01dc45dd06e8af8968cce7fbaa554cb9"/></dir><file name="IndexController.php" hash="dd116c50612320505894e151b43a8fcc"/></dir><dir name="etc"><file name="config.xml" hash="2e9655e356b5609e5b50f90c94bb79df"/><file name="system.xml" hash="25e4b2b1e7c61b4bf55d5015d5cab0df"/></dir><dir name="sql"><dir name="carrier_setup"><file name="mysql4-install-1.0.0.php" hash="42faff48ed0752ba42739316ac02e890"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="ParcelPro_Carrier.xml" hash=""/></dir></target></contents>
33
  <compatible/>
34
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
35
  </package>