Webador / sendcloud

Provides a PHP client to interact with the SendCloud API in an object-oriented way.
MIT License
16 stars 15 forks source link

Added extra parameter arguments #5

Closed bockhauzen closed 3 years ago

bockhauzen commented 4 years ago

Now you can also send the sender_address

bockhauzen commented 4 years ago

idea to drop the servicePointId parameter and replace it by arguments?

villermen commented 4 years ago

@bockhauzen Hey! Sorry for not getting back on this sooner. I forgot to watch this repository and only just now discovered about this pull request =S

If this is still desired, I'm more inclined to add the arguments as additional parameters so that user-error is less likely to occur. That's how the rest of the client is set up. It would then look something like:

public function getShippingMethods(?int $servicePointId = null, ?int $senderAddressId, ?bool $returnMethodsOnly = null): array

Would that work for you?

I'd still have to look into what the "all" option for "sender_address" exactly does. If it's the same as just plain leaving the option out then it's not necessary to implement in the client either.

bockhauzen commented 3 years ago

Hi,

Woops, late reply as well.

I agree. That would def. be a cleaner solution. One other question;

There also seem to be an issue with: client->createLabel

When trying to use DE as country code it seems to fail.

Im trying to debug it, probaly my brains are just failing.

Thanks anyway for your response!

villermen commented 3 years ago

Update: There seems to be a difference between passing "all" and leaving the parameter out entirely. Not passing the parameter will use the default sender address. On my test account not passing the parameter yields 336 shipping methods and passing "all" yields 984. The latter takes over a solid half minute to complete. I'll probably have to increase the client's timeout over this.

villermen commented 3 years ago

@bockhauzen This is now available in v3.8.0! Note that I've moved your other issue to a separate thread (#10) that still requires reproduction steps.