diff --git a/app/Http/Controllers/Shop/ProfileController.php b/app/Http/Controllers/Shop/ProfileController.php index 2fae460ebe2d..43884032a82b 100644 --- a/app/Http/Controllers/Shop/ProfileController.php +++ b/app/Http/Controllers/Shop/ProfileController.php @@ -29,7 +29,7 @@ class ProfileController extends BaseController protected $entity_transformer = CompanyShopProfileTransformer::class; - public function show(Request $request, string $product_key) + public function show(Request $request) { $company = Company::where('company_key', $request->header('X-API-COMPANY-KEY'))->first(); diff --git a/app/Transformers/Shop/CompanyShopProfileTransformer.php b/app/Transformers/Shop/CompanyShopProfileTransformer.php index 832a05fbbb14..12e0c9a80efd 100644 --- a/app/Transformers/Shop/CompanyShopProfileTransformer.php +++ b/app/Transformers/Shop/CompanyShopProfileTransformer.php @@ -36,6 +36,7 @@ use App\Transformers\CompanyLedgerTransformer; use App\Transformers\CompanyTokenHashedTransformer; use App\Transformers\CompanyTokenTransformer; use App\Transformers\CreditTransformer; +use App\Transformers\EntityTransformer; use App\Transformers\PaymentTermTransformer; use App\Transformers\TaskTransformer; use App\Transformers\WebhookTransformer; diff --git a/tests/Unit/Shop/ShopProfileTest.php b/tests/Unit/Shop/ShopProfileTest.php new file mode 100644 index 000000000000..d4f249beb451 --- /dev/null +++ b/tests/Unit/Shop/ShopProfileTest.php @@ -0,0 +1,52 @@ +makeTestData(); + } + + public function testProfileDisplays() + { + + $this->company->enable_shop_api = true; + $this->company->save(); + + $response = $this->withHeaders([ + 'X-API-SECRET' => config('ninja.api_secret'), + 'X-API-COMPANY-KEY' => $this->company->company_key + ])->get('/api/v1/shop/profile'); + + + $response->assertStatus(200); + + $arr = $response->json(); + + $this->assertArrayHasKey('custom_value1', $arr['data']['settings']); + $this->assertEquals($this->company->company_key, $arr['data']['company_key']); + } + + + +}