diff --git a/CHANGELOG.md b/CHANGELOG.md index 303b22d..0d65023 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # CHANGELOG +## v0.8.1 (2023-02-17) + +- Fix create insurance, and parcel routing +- Fix search object lookup that wasn't migrated when we moved from EasyPost PHP lib v5 to v6 + ## v0.8.0 (2023-02-10) - Bumps EasyPost library from v5 to v6 which introduces thread-safety and various other improvements diff --git a/src/app/Http/Controllers/InsuranceController.php b/src/app/Http/Controllers/InsuranceController.php index a1989be..519433f 100644 --- a/src/app/Http/Controllers/InsuranceController.php +++ b/src/app/Http/Controllers/InsuranceController.php @@ -106,7 +106,7 @@ public function createInsurance() $response = $insurance; session()->flash('message', 'INSURANCE CREATED'); - return view('app')->with(['response' => $response]); + return redirect('/')->with(['response' => $response]); } /** diff --git a/src/app/Http/Controllers/ParcelController.php b/src/app/Http/Controllers/ParcelController.php index edac621..804703d 100644 --- a/src/app/Http/Controllers/ParcelController.php +++ b/src/app/Http/Controllers/ParcelController.php @@ -48,6 +48,6 @@ public function createParcel() } session()->flash('message', 'PARCEL CREATED'); - return view('app')->with(['json' => $parcel]); + return redirect('/')->with(['json' => $parcel]); } } diff --git a/src/app/Http/Controllers/SearchController.php b/src/app/Http/Controllers/SearchController.php index 2366d5a..2ad762e 100644 --- a/src/app/Http/Controllers/SearchController.php +++ b/src/app/Http/Controllers/SearchController.php @@ -2,37 +2,36 @@ namespace App\Http\Controllers; -use EasyPost; use EasyPost\Exception\General\EasyPostException; const OBJECT_ID_PREFIXES = [ - 'adr' => EasyPost\Address::class, - 'ak' => EasyPost\ApiKey::class, - 'batch' => EasyPost\Batch::class, - 'brd' => EasyPost\Brand::class, - 'ca' => EasyPost\CarrierAccount::class, - 'cstinfo' => EasyPost\CustomsInfo::class, - 'cstitem' => EasyPost\CustomsItem::class, - 'es' => EasyPost\EndShipper::class, - 'evt' => EasyPost\Event::class, - 'fee' => EasyPost\Fee::class, - 'hook' => EasyPost\Webhook::class, - 'ins' => EasyPost\Insurance::class, - 'order' => EasyPost\Order::class, - 'pickup' => EasyPost\Pickup::class, - 'pl' => EasyPost\PostageLabel::class, - 'plrep' => EasyPost\Report::class, - 'prcl' => EasyPost\Parcel::class, - 'rate' => EasyPost\Rate::class, - 'refrep' => EasyPost\Report::class, - 'rfnd' => EasyPost\Refund::class, - 'sf' => EasyPost\ScanForm::class, - 'shp' => EasyPost\Shipment::class, - 'shpinvrep' => EasyPost\Report::class, - 'shprep' => EasyPost\Report::class, - 'trk' => EasyPost\Tracker::class, - 'trkrep' => EasyPost\Report::class, - 'user' => EasyPost\User::class, + 'adr' => 'address', + 'ak' => 'apikey', + 'batch' => 'batch', + 'brd' => 'brand', + 'ca' => 'carrierAccount', + 'cstinfo' => 'customsInfo', + 'cstitem' => 'customsItem', + 'es' => 'endShipper', + 'evt' => 'event', + 'fee' => 'fee', + 'hook' => 'webhook', + 'ins' => 'insurance', + 'order' => 'order', + 'pickup' => 'pickup', + 'pl' => 'postageLabel', + 'plrep' => 'report', + 'prcl' => 'parcel', + 'rate' => 'rate', + 'refrep' => 'report', + 'rfnd' => 'refund', + 'sf' => 'scanForm', + 'shp' => 'shipment', + 'shpinvrep' => 'report', + 'shprep' => 'report', + 'trk' => 'tracker', + 'trkrep' => 'report', + 'user' => 'user', ]; class SearchController extends Controller @@ -46,13 +45,14 @@ public function searchRecord() { $id = request()->get('id'); $idPrefix = substr($id, 0, strpos($id, '_')); + $client = request()->get('client'); try { - $response = OBJECT_ID_PREFIXES[$idPrefix]::retrieve($id); + $response = $client->{OBJECT_ID_PREFIXES[$idPrefix]}->retrieve($id); } catch (EasyPostException $exception) { return back()->withError($exception->getMessage())->withInput(); } - return to_route('app')->with(['json' => $response]); + return redirect('/')->with(['json' => $response]); } } diff --git a/src/composer.lock b/src/composer.lock index c617981..5e71a9b 100644 --- a/src/composer.lock +++ b/src/composer.lock @@ -1287,16 +1287,16 @@ }, { "name": "laravel/framework", - "version": "v9.51.0", + "version": "v9.52.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "b81123134349a013a738a9f7f715c6ce99d5a414" + "reference": "eb85cd9d72e5bfa54b4d0d9040786f26d6184a9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/b81123134349a013a738a9f7f715c6ce99d5a414", - "reference": "b81123134349a013a738a9f7f715c6ce99d5a414", + "url": "https://api.github.com/repos/laravel/framework/zipball/eb85cd9d72e5bfa54b4d0d9040786f26d6184a9e", + "reference": "eb85cd9d72e5bfa54b4d0d9040786f26d6184a9e", "shasum": "" }, "require": { @@ -1481,7 +1481,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2023-02-07T15:37:18+00:00" + "time": "2023-02-14T14:51:14+00:00" }, { "name": "laravel/serializable-closure", @@ -1674,16 +1674,16 @@ }, { "name": "league/commonmark", - "version": "2.3.8", + "version": "2.3.9", "source": { "type": "git", "url": "https://github.com/thephpleague/commonmark.git", - "reference": "c493585c130544c4e91d2e0e131e6d35cb0cbc47" + "reference": "c1e114f74e518daca2729ea8c4bf1167038fa4b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/c493585c130544c4e91d2e0e131e6d35cb0cbc47", - "reference": "c493585c130544c4e91d2e0e131e6d35cb0cbc47", + "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/c1e114f74e518daca2729ea8c4bf1167038fa4b5", + "reference": "c1e114f74e518daca2729ea8c4bf1167038fa4b5", "shasum": "" }, "require": { @@ -1776,7 +1776,7 @@ "type": "tidelift" } ], - "time": "2022-12-10T16:02:17+00:00" + "time": "2023-02-15T14:07:24+00:00" }, { "name": "league/config",