joshbmarshall / auspost

Australia Post API for PHP
MIT License
5 stars 2 forks source link

Add Star Track flag #2

Closed hirani89 closed 2 years ago

hirani89 commented 2 years ago

Hi Josh,

Thanks for creating this library. I am trying to integrate StarTrack API into my project.

I did some testing and it seems that the API does not like digit account number sent in the header if the account is a StarTrack account.

I tried editing your code to remove the padding and that solved the issue.

I have added a StarTrack flag when creating a new Auspost instance. Please check it out and merge the request.

Regards

joshbmarshall commented 2 years ago

Thanks for this, looks like the construct change would make it break for existing systems as the position of the startrack variable is where the test mode variable is sitting.

Maybe instead we should make a function to get the account number (padded or not depending on the startrack status) and have a mode setting function to put it into startrack mode.

I like your pull request, just need a change like that to make it backwards compatible.

I'm not sure if I can make changes to your pull request before accepting it.

hirani89 commented 2 years ago

I have now added a function you can call to make it StarTrack. That way, existing implementations of the library don't have to be changed

joshbmarshall commented 2 years ago

It's a little bit dirty, I'll accept the pull request then make some adjustments and document the process. I'll get you to confirm once I've done it that it still works correctly.

joshbmarshall commented 2 years ago

@hirani89 I have added a commit that documents how it can be used with StarTrack and changes slightly so that you don't have to pass the account number twice. Can you please confirm it works for you, if it does I will create a new release