Post by zaidladha » Wed May 31, 2017 3:23 am

Hi,
I had purchased a module awhile back, and had a problem, the developer was going to get back to me, but I am sad to say it appears he has passed away.

Can anyone help me with this?

There are 2 sets of code, 1 for the quick estimate part of the shipping (which works correctly), and one for the full estimate in the checkout (which does not work).

Does work

Code: Select all

	// Set for Debug Information
						$submission_type = "Submitted Using: Quick Estimate";						
						
						// Set stdClass and Array for Purolator Response
						$request = new stdClass();
						$request->ReceiverAddress = new stdClass();
						$request->TotalWeight = new stdClass();
						$request->Shipment = new stdClass();
						$request->Shipment->PackageInformation = new stdClass();
						$request->Shipment->PackageInformation->OptionsInformation = new stdClass();
						$request->Shipment->PackageInformation->OptionsInformation->Options = new stdClass();
						$request->Shipment->PackageInformation->OptionsInformation->Options->OptionIDValuePair = new stdClass();
						
						$response = new stdClass();
						$response->ShipmentEstimates = new stdClass();
						$response->ShipmentEstimates->ShipmentEstimate = new stdClass();
						$response->ShipmentEstimates->ShipmentEstimate->Surcharges = new stdClass();
						$response->ShipmentEstimates->ShipmentEstimate->Surcharges->Surcharge = new stdClass();
						$response->ResponseInformation = new stdClass();
						$response->ResponseInformation->Errors = new stdClass();
								
						$return_error = FALSE;   		
						 
						$purolator_title = $this->language->get('heading_title');
						$purolator_sort_order = $this->config->get('purolator_sort_order');
							
						// Customer information checked for compatibility with the Backend Order Entry System	
						if (!$this->config->get('purolator_test')) {
							if (isset($this->session->data['customer_info'])) {
								$wsdl = str_replace("/admin/", "", DIR_APPLICATION) . '/wsdl/development/EstimatingService.wsdl';
							} else {
								$wsdl = './wsdl/development/EstimatingService.wsdl';
							}
							$server_call = 'https://devwebservices.purolator.com/PWS/V1/Estimating/EstimatingService.asmx';
				
						} else {
							if (isset($this->session->data['customer_info'])) {
								$wsdl = str_replace("/admin/", "", DIR_APPLICATION) . '/wsdl/production/EstimatingService.wsdl';
							} else {
								$wsdl = './wsdl/production/EstimatingService.wsdl';
							}
							$server_call = 'https://webservices.purolator.com/PWS/V1/Estimating/EstimatingService.asmx';
						}
						
						
						//Create a SOAP Client
							
						/** Purpose : Creates a SOAP Client in Non-WSDL mode with the appropriate authentication and 
						*             header information
						*
						*	Provided by Purolator: https://devwebservices.purolator.com/EWS/V1/Estimating/EstimatingService.asmx?wsdl
						**/
						
						//Set the parameters for the Non-WSDL mode SOAP communication with your Development/Production credentials
						$client = new SoapClient( $wsdl, 
									array	(
										'trace'			=>	true,
										'location'		=>	$server_call,
										'uri'			=>	"http://purolator.com/pws/datatypes/v1",
										'login'			=>	$this->config->get('purolator_key'),
										'password'		=>	$this->config->get('purolator_keyPassword')
									)
						);
						
						//Define the SOAP Envelope Headers
						
						$headers[] = new SoapHeader ( 'http://purolator.com/pws/datatypes/v1', 
										'RequestContext', 
										array (
										'Version'           =>  '1.3',
										'Language'          =>  'en',
										'GroupID'           =>  'xxx',
										'RequestReference'  =>  'Rating Example'
									)
						); 
						
						//Apply the SOAP Header to your client                            
						$client->__setSoapHeaders($headers);
						
						//Populate the Billing Account Number
						$request->BillingAccountNumber = $this->config->get('purolator_accountNumber');
						
						//Populate the Origin Information
						$request->SenderPostalCode = $this->config->get('purolator_originPostalCode');
						
						//Populate the Desination Information
						$request->ReceiverAddress->Province = $address['zone_code'];
						$request->ReceiverAddress->Country = $address['iso_code_2'];
						$request->ReceiverAddress->PostalCode = $receiver_postalcode;
						
						//Populate the Package Information
						$request->PackageType = "CustomerPackaging";
						
						//Populate the Shipment Weight
						$request->TotalWeight->Value = $weight;
						$request->TotalWeight->WeightUnit = $weight_code;
						
						//Execute the request and capture the response
						$response = $client->GetQuickEstimate($request);
					
					} // END OF QUICK ESTIMATE

Does not work

Code: Select all

	// Set for Debug Information
						$submission_type = "Submitted Using: Full Estimate";
						
						// Set stdClass and Array for Purolator Request
						$request = new stdClass();
						
						$request->ShowAlternativeServicesIndicator = new stdClass();
						
						$request->Shipment = new stdClass();
						$request->Shipment->PackageInformation = new stdClass();
						$request->Shipment->PackageInformation->OptionsInformation = new stdClass();
						$request->Shipment->PackageInformation->OptionsInformation->Options = new stdClass();
						$request->Shipment->PackageInformation->OptionsInformation->Options->OptionIDValuePair = new stdClass();
						$request->Shipment->PackageInformation->TotalWeight = new stdClass();
						
						$request->Shipment->PickupInformation = new stdClass();
						
						$request->Shipment->PaymentInformation = new stdClass();
						$request->Shipment->PaymentInformation->PaymentType = new stdClass();
						
						$request->Shipment->SenderInformation = new stdClass();
						$request->Shipment->SenderInformation->Address = new stdClass();
						
						$request->Shipment->ReceiverInformation = new stdClass();
						$request->Shipment->ReceiverInformation->Address = new stdClass();
						
						// Set stdClass and Array for Purolator Response
						$response = new stdClass();
						
						$response->ShipmentEstimates = new stdClass();
						$response->ShipmentEstimates->ShipmentEstimate = new stdClass();
						$response->ShipmentEstimates->ShipmentEstimate->Surcharges = new stdClass();
						$response->ShipmentEstimates->ShipmentEstimate->Surcharges->Surcharge = new stdClass();
						$response->ShipmentEstimates->ShipmentEstimate->Surcharges->Surcharge->Amount = new stdClass();
						
						$response->ResponseInformation = new stdClass();
						$response->ResponseInformation->Errors = new stdClass();
						
						$client = new stdClass();  		
						 
						$purolator_title = $this->language->get('heading_title');
						$purolator_sort_order = $this->config->get('purolator_sort_order');
								
						// Customer information checked for compatibility with the Backend Order Entry System
						if (!$this->config->get('purolator_test')) {
							if (isset($this->session->data['customer_info'])) {
								$wsdl = str_replace("/admin/", "", DIR_APPLICATION) . '/wsdl/development/EstimatingService.wsdl';
							} else {
								$wsdl = './wsdl/development/EstimatingService.wsdl';
							}
							$server_call = 'https://devwebservices.purolator.com/PWS/V1/Estimating/EstimatingService.asmx';
				
						} else {
							if (isset($this->session->data['customer_info'])) {
								$wsdl = str_replace("/admin/", "", DIR_APPLICATION) . '/wsdl/production/EstimatingService.wsdl';
							} else {
								$wsdl = './wsdl/production/EstimatingService.wsdl';
							}
							$server_call = 'https://webservices.purolator.com/PWS/V1/Estimating/EstimatingService.asmx';
						}
						
						//Create a SOAP Client
							
						/** Purpose : Creates a SOAP Client in Non-WSDL mode with the appropriate authentication and 
						*             header information
						*
						*	Provided by Purolator: https://devwebservices.purolator.com/EWS/V1/Estimating/EstimatingService.asmx?wsdl
						**/
						
						//Set the parameters for the Non-WSDL mode SOAP communication with your Development/Production credentials
						$client = new SoapClient( $wsdl, 
									array	(
											'trace'			=>	true,
											'location'		=>	$server_call,
											'uri'			=>	"http://purolator.com/pws/datatypes/v1",
											'login'			=>	$this->config->get('purolator_key'),
											'password'		=>	$this->config->get('purolator_keyPassword')
										)
								);
						
						//Define the SOAP Envelope Headers
						
						$headers[] = new SoapHeader ( 'http://purolator.com/pws/datatypes/v1', 
									'RequestContext', 
									array (
											'Version'           =>  '1.3',
											'Language'          =>  'en',
											'GroupID'           =>  'xxx',
											'RequestReference'  =>  'Rating Example'
										  )
								  ); 
						
						//Apply the SOAP Header to your client                            
						$client->__setSoapHeaders($headers);
						
						//Populate the Origin Information
						$request->Shipment->SenderInformation->Address->Name = $this->config->get('config_name');
						$request->Shipment->SenderInformation->Address->StreetNumber = "";
						$request->Shipment->SenderInformation->Address->StreetName = $this->config->get('purolator_originAddress1');
						$request->Shipment->SenderInformation->Address->City = $this->config->get('purolator_originCity');
						$request->Shipment->SenderInformation->Address->Province = $this->config->get('purolator_originProvince');
						$request->Shipment->SenderInformation->Address->Country = "CA";  // CURRENTLY HARDCODED - PUROLATOR IS A CANADIAN COURIER.
						$request->Shipment->SenderInformation->Address->PostalCode = $this->config->get('purolator_originPostalCode');
						
						//Populate the Desination Information
						$request->Shipment->ReceiverInformation->Address->Name = $address['firstname'] . ' ' . $address['lastname'];
						$request->Shipment->ReceiverInformation->Address->StreetNumber = "";
						$request->Shipment->ReceiverInformation->Address->StreetName = $address['address_1'];
						$request->Shipment->ReceiverInformation->Address->City = $address['city'];
						$request->Shipment->ReceiverInformation->Address->Province = $address['zone_code'];
						$request->Shipment->ReceiverInformation->Address->Country = $address['iso_code_2'];
						$request->Shipment->ReceiverInformation->Address->PostalCode = $receiver_postalcode;
						
						//Populate the Package Information
						$request->Shipment->PackageInformation->TotalWeight->Value = $weight;
						$request->Shipment->PackageInformation->TotalWeight->WeightUnit = $weight_code;
						$request->Shipment->PackageInformation->TotalPieces = $vbox; //$cart_count;
						
						
						if($address['iso_code_2'] == "CA") {
							$request->Shipment->PackageInformation->ServiceID = "PurolatorExpress";
                        } elseif($address['iso_code_2'] == "US") {
                            $request->Shipment->PackageInformation->ServiceID = "PurolatorExpressU.S.";
                        } else {
                            $request->Shipment->PackageInformation->ServiceID = "PurolatorExpressInternational";
                        }


						
						//Populate the Payment Information
						$request->Shipment->PaymentInformation->PaymentType = "Sender";
						$request->Shipment->PaymentInformation->BillingAccountNumber = $this->config->get('purolator_accountNumber');;
						$request->Shipment->PaymentInformation->RegisteredAccountNumber = $this->config->get('purolator_accountNumber');;
						
						//Populate the Pickup Information
						$request->Shipment->PickupInformation->PickupType = "DropOff";
						$request->ShowAlternativeServicesIndicator = "true";
						
						//Define OptionsInformation
						if($address['iso_code_2'] == "CA") {
							//ResidentialSignatureDomestic
							$request->Shipment->PackageInformation->OptionsInformation->Options->OptionIDValuePair->ID = "ResidentialSignatureDomestic";
							$request->Shipment->PackageInformation->OptionsInformation->Options->OptionIDValuePair->Value = "true";
							
							//OriginSignatureNotRequired
							$request->Shipment->PackageInformation->OptionsInformation->Options->OptionIDValuePair->ID = "OriginSignatureNotRequired";
							$request->Shipment->PackageInformation->OptionsInformation->Options->OptionIDValuePair->Value = "true";
						}
						
						//Execute the request and capture the response
						$response = $client->GetFullEstimate($request);
						
					} // END OF LOGGED IN CHECK

Active Member

Posts

Joined
Wed Jun 05, 2013 3:07 pm

Post by IP_CAM » Thu Jun 01, 2017 1:55 am

well, I just hope, that you do not expect someone, eager to find out, by just presenting
two strange pieces of Custom Code, to be used in an unknown Version and Theme.. :'(
So, better get professional support, if you really plan to get this solved, I really don't think,
that someone plans, to invest a considerable amount of time and brain, just for the plain fun of it.
Sorry for the bad News, it's just the way, it likely works, when it comes to custom things.
Good Luck, no offense, just plain information!
Ernie

Please don't send me OC Forum Personal Messages, just contact: jti@jacob.ch
---
OC 1.5.6.5 LIGHT Test Site: http://www.bigmax.ch/shop/
OC 1.5.6.5 V-PRO Test Site: http://www.jacob.ch/shop/
My Github OC Site: https://github.com/IP-CAM
2'450+ FREE OC Extensions from the World's largest Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by zaidladha » Thu Jun 01, 2017 2:28 pm

Hi IP_CAM
Thanks for the reply, and I have seen that you have helped a lot of people in the forums, as I see your name often pops up with solutions to things I google lol.

Anyways I thought I would try here as well, I have posted in the commercial forums about the upgrade from 1.5.6.4 to 2.3.0.2 although I don't expect anyone to have checked that, my bad, I should have followed basic rules. I am using version 2.3.0.2 and this is code that was updated for me from 1.5.6.4

I wasn't sure about rules about posting an entire module, so I just posted the parts that I think are having the issue. the quick estimate works fine, but the full estimate doesn't even seem to get submitted to purolator. When i check the debug on the quick estimate it gives me this in the debug:
"2017-06-01 6:09:56 - Model: 1046
2017-06-01 6:09:56 - Quantity: 1
2017-06-01 6:09:56 - Physical Weight: 6.8039553660528
2017-06-01 6:09:56 - Weight Code: kg
2017-06-01 6:09:56 - ------------
2017-06-01 6:09:56 - Information Sent to Purolator
2017-06-01 6:09:56 - =============================
2017-06-01 6:09:56 - Submitted Using: Quick Estimate
2017-06-01 6:09:56 - Weight Sent: 7
2017-06-01 6:09:56 - Weight Code: kg
2017-06-01 6:09:56 - =============================
2017-06-01 6:09:56 - Submission Completed"

When I use the full estimate it just gives me
""2017-06-01 6:09:56 - Model: 1046
2017-06-01 6:09:56 - Quantity: 1
2017-06-01 6:09:56 - Physical Weight: 6.8039553660528
2017-06-01 6:09:56 - Weight Code: kg
2017-06-01 6:09:56 - ------------"

To be honest I was hoping it was something real simple I was not seeing. If you think this is something you can fix, I would gladly reward you via paypal if its an amount I can deal with. Send me a PM if you can, I would really like to get this sorted out asap. I have already contacted Purolator to make sure that it's not something on their end am waiting to hear back.

Active Member

Posts

Joined
Wed Jun 05, 2013 3:07 pm
Who is online

Users browsing this forum: No registered users and 2 guests