Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

result is not array on getAccountDetails using eparcel account number #4

Open
tashantukin opened this issue Jun 22, 2023 · 14 comments
Open

Comments

@tashantukin
Copy link

tashantukin commented Jun 22, 2023

Hi, i tried to use an eparcel account number and it seems to add an 220F on the response. am I missing something?

Thanks,

@joshbmarshall
Copy link
Owner

are you using the api from the Auspost Business account?

@tashantukin
Copy link
Author

Hi @joshbmarshall thanks for replying. I am not really sure. how can I check that? ive tried to use the endpoint from postman and it works fine.

@joshbmarshall
Copy link
Owner

This library uses the endpoints at digitalapi.auspost.com.au - does that match what you're using?

@tashantukin
Copy link
Author

this is the response from Postman, I think you are right about the austpost

{
    "account_number": "2001191933",
    "name": "DEMO - AusPost",
    "valid_from": "2017-11-01",
    "valid_to": "2999-01-01",
    "expired": false,
    "addresses": [
        {
            "type": "MERCHANT_LOCATION",
            "lines": [
                "1 Main Street"
            ],
            "suburb": "MELBOURNE",
            "postcode": "3000",
            "state": "VIC",
            "country": "AU"
        }
    ],

@tashantukin
Copy link
Author

image

@joshbmarshall
Copy link
Owner

Have you set the test mode correctly?

@tashantukin
Copy link
Author

tashantukin commented Jun 22, 2023

yes, I have set it to true, this is where is it giving a non array response, with 220F,
image
image

@joshbmarshall
Copy link
Owner

can you debug up the chain, ie what is $this->getResponse() , what is coming back from Auspost? see if you can find where the 220f comes in

@tashantukin
Copy link
Author

tashantukin commented Jun 22, 2023

hi @joshbmarshall i think it is coming from here, sorry I am not familiar with sockets
image

@tashantukin
Copy link
Author

hi @joshbmarshall in any case, do you have any idea why that 220f is showing up on the response? thanks.

@joshbmarshall
Copy link
Owner

The only way I can see it in the response is if the api was sending it to you. Have you tried a different php version or platform?

@jp135i
Copy link

jp135i commented Sep 23, 2023

Hi Josh,

Thanks for all your hard work on this library.

I am seeing the same sort of behaviour but with different prefix characters - I have seen both "2001" and "399d" and then what looks like a correct response, however not the full response as it seems to be cut off.

Here is my response in php (some specific details edited) =>
"399d
{"account_number":"2010000000","name":"DEMO - AusPost","valid_from":"2017-11-01","valid_to":"2999-12-31","expired":false,"addresses":[{"type":"MERCHANT_LOCATION","lines":["1 Main Street"],"suburb":"MELBOURNE","postcode":"3000","state":"VIC","country":"AU"}],"details":{"is_sscc_non_standard_barcode_enabled_international":"false","email_address":"emailaddress@company","is_location":"false","is_sscc_non_standard_barcode_enabled":"false","is_on_demand":"false","is_sender_distribution_state_override":"false","contact_number":"","account_source":"AUSPOST"},"postage_products":[{"type":"EXPRESS EPARCEL ID&V 2","group":"Express Post","product_id":"XID2","contract":{"valid_from":"2017-11-01","valid_to":"2999-12-31","expired":false,"volumetric_pricing":false,"max_item_count":0,"cubing_factor":250},"authority_to_leave_threshold":500.0,"features":{"TRANSIT_COVER":{"type":"TRANSIT_COVER","attributes":{"rate":1,"included_cover":0,"maximum_cover":5000},"price":{"calculated_gst":0.00,"calculated_price":0.00,"calcula"

If I use ThunderClient in vscode if don't receive the prefix characters and get a full correct response.

I am using PHP Version 7.4.3-4ubuntu2.19

Can I provide you any further information to help resolve this?

Cheers,

@joshbmarshall
Copy link
Owner

Hi folks, the code was working for me on all the versions of PHP I tested on 7.2 through to 8.2

The original code using sockets is what AusPost recommended when I wrote the library. But it's not very nice.

So I just rewrote these parts to use curl and added a unit test to help with testing.

Can you confirm whether this gets the library working for you? If so I'll create a new release.

@joshbmarshall
Copy link
Owner

Actually have just release 1.2.0 - the code is much nicer. I'd like your feedback if it gets your issue resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants