dhl-php-sdk
dhl-php-sdk copied to clipboard
Auto assign EKP-Ending depending on need
I've think about assigning the last 4 digits of the EKP automaticly depending on which Product is used (and if a Return-Lebel is needed)...
But I'm a bit unsure if this is a good idea, feel free to tell me what you think about it!
Adding a fixed "0101" to the EPK is not going to work for international shipments, so a more flexible solution would be appreciated. Thanks for the awesome LIB by the way... :)
You're welcome! I wish I could improve it, but I don't have a head at the moment to code after work...
Anyway I will try to implement it then, thanks for the Answer^^
It would be awesome to predefine different EKP and then let it automatically choose the right one. Something like
$credentials->setNationalShipmentEkp('EKP account number for national shipment');
$credentials->setInternationalShipmentEkp('EKP account number for international shipment');
$credentials->setReturnShipmentEkp('EKP account number for return shipment');
and the service chooses the EKP to use depending on which product is used.
By the way .. it's EKP and not EPK =)
It would be super helpful if I know, in which case which Number should be set. I don't want to create a bad automatic-function
It's a good idea to create these functions like you mentioned @Morgy93
"on need"
However, it would only be helpful if a corresponding number had not already been given. Perhaps the application that uses the module already generates the EKP with 14 digits.
But yes, would be nice. It was a stumbling block when I wanted to implement it for the first time.
Hi
Isn't the accountNumber in Version 3.0 (and lower versions) just a concatenated string of the EKP + Procedure + Participant? So the Procedure will be the second and third character in the appropriate DHL product. Like '01' in 'V01PAK' for a 'DHL PAKET' So the accountNumber could be something like
//VALIDATION of $product agains possible products is not implemented here. This is just an example!!
function getProcedure(string $product){
return strlen($product) ? substr($product,1,2) : '';
}
$procedure = $this->getProcedure($this->product);
['accountNumber'] = $this->ekp.$procedure.$this->participant;