dhl-php-sdk icon indicating copy to clipboard operation
dhl-php-sdk copied to clipboard

Auto assign EKP-Ending depending on need

Open Petschko opened this issue 7 years ago • 6 comments

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!

Petschko avatar Aug 09 '17 08:08 Petschko

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... :)

leolems avatar Nov 21 '17 11:11 leolems

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^^

Petschko avatar Nov 22 '17 02:11 Petschko

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 =)

Morgy93 avatar Jul 10 '18 07:07 Morgy93

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

Petschko avatar Jul 14 '18 12:07 Petschko

"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.

mpitz avatar Jun 25 '20 08:06 mpitz

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;

drechsler-development avatar Jul 09 '21 15:07 drechsler-development