AfterShip / aftership-sdk-php

The PHP SDK of AfterShip API
65 stars 46 forks source link

Delete Tracking "tracking_postal_code" is required for some couriers but is not entertained in this sdk if I am not wrong! #48

Closed usmansafdaru107 closed 3 years ago

usmansafdaru107 commented 3 years ago

Delete Tracking "tracking_postal_code" is required for some couriers but is not entertained in this API if I am not wrong!

I solved my problem using this code

public function delete($slug, $trackingNumber, $code = null) { if (empty($slug)) { throw new AfterShipException('Slug cannot be empty'); }

    if (empty($trackingNumber)) {
        throw new AfterShipException('Tracking number cannot be empty');
    }

    if($code === null)
        return $this->request->send('trackings/' . $slug . '/' . $trackingNumber, 'DELETE');
    else
        return $this->request->send('trackings/' . $slug . '/' . $trackingNumber . "?tracking_postal_code=" . NECEX_POSTAL_CODE, 'DELETE');

}
Bossa573 commented 3 years ago

hello @usmansafdaru107 , can you test again with the latest package 5.1.2? https://packagist.org/packages/aftership/aftership-php-sdk#5.1.2

Bossa573 commented 3 years ago

I will close this ticket at the moment since version 5.1.2 should fix this issue, please reopen the ticket if needed