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

fix swagger commerce module setup #50

Merged
merged 7 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

# Run composer badaso commerce-module
- name: Composer update
run: composer update --no-interaction
run: composer update --no-interaction -W

# Badaso CommerceModule Test PHPStan
- name: Badaso CommerceModule test PHPStan
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ jobs:
composer show laravel/framework &&
php artisan db:wipe

# Laravel require badaso commerce-module
# Laravel file configuration
- name: Laravel file configuration
run: git branch &&
cd laravel &&
composer require badaso/core:^2.0 &&
composer require badaso/commerce-module:dev-${GITHUB_HEAD_REF} &&
composer update --no-interaction
composer require badaso/core:^2.0 -W &&
composer require badaso/commerce-module:dev-${GITHUB_HEAD_REF} -W &&
composer update --no-interaction -W

# Mysql | Laravel setup
- name: Mysql | Laravel setup
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ jobs:
- name: Laravel file configuration
run: git branch &&
cd laravel &&
composer require badaso/core:^2.0 &&
composer require badaso/commerce-module:dev-${GITHUB_HEAD_REF} &&
composer update --no-interaction
composer require badaso/core:^2.0 -W &&
composer require badaso/commerce-module:dev-${GITHUB_HEAD_REF} -W &&
composer update --no-interaction -W

# Mysql | Laravel setup
- name: Mysql | Laravel setup
Expand Down
8 changes: 6 additions & 2 deletions src/Commands/BadasoCommerceSetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ public function handle()

protected function generateSwagger()
{
$this->call('l5-swagger:generate');
try {
$this->call('l5-swagger:generate');
} catch (\Exception $e) {
//throw $th;
}
}

protected function publishBadasoProvider()
Expand All @@ -75,7 +79,7 @@ protected function envListUpload()
'MIX_ANALYTICS_ACCOUNT_ID' => '',
'MIX_ANALYTICS_WEBPROPERTY_ID' => '',
'MIX_ANALYTICS_VIEW_ID' => '',
'NOTIFICATION_SENDER_EMAIL'=> '',
'NOTIFICATION_SENDER_EMAIL' => '',
];
}

Expand Down
2 changes: 1 addition & 1 deletion src/Controllers/PublicController/OrderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public function finish(Request $request)
$request->validate([
'items' => 'required|array|exists:Uasoft\Badaso\Module\Commerce\Models\Cart,id',
'user_address_id' => 'required|exists:Uasoft\Badaso\Module\Commerce\Models\UserAddress,id',
'payment_type_option_id' => 'required|string|max:255|exists:Uasoft\Badaso\Module\Commerce\Models\PaymentOption,id',
'payment_type_option_id' => 'required|exists:Uasoft\Badaso\Module\Commerce\Models\PaymentOption,id',
'message' => 'nullable|string',
]);

Expand Down
2 changes: 1 addition & 1 deletion src/Controllers/PublicController/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function edit(Request $request)

try {
$request->validate([
'name' => 'required',
'name' => 'required',
'avatar' => 'nullable',
]);

Expand Down
4 changes: 2 additions & 2 deletions src/resources/payment/components/manual-transfer-pay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export default {
this.$emit("input", this.redirect);
},
redirect(res) {
this.$inertia.visit(this.route('badaso.commerce-theme.payment-info', this.order.id))
this.$inertia.visit(this.route('badaso.shopuu-theme.payment-info', this.order.id))
},
},
}
</script>
</script>
4 changes: 2 additions & 2 deletions src/resources/payment/components/manual-transfer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export default {
this.$emit("checkout", this.redirect);
},
redirect(res) {
this.$inertia.visit(this.route('badaso.commerce-theme.payment-info', res.data.order))
this.$inertia.visit(this.route('badaso.shopuu-theme.payment-info', res.data.order))
},
},
};
</script>
</script>
36 changes: 18 additions & 18 deletions tests/Feature/BadasoCommerceApiCartTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function testBrowseCart()
'name' => 'coba 1',
'slug' => Str::uuid(),
'desc' => 'decription 1',
'SKU' => Str::uuid(),
'SKU' => Str::uuid(),
]);
$product_category_id = $product_category->id;
$product = Product::create([
Expand All @@ -53,9 +53,9 @@ public function testBrowseCart()
$discount_id = $discounts->id;
$product_detail = ProductDetail::create([
'product_id' => $product_id,
'discount_id'=> $discount_id,
'discount_id' => $discount_id,
'name' => 'name test 2',
'quantity' => 13,
'quantity' => 13,
'price' => '1000001',
'SKU' => Str::uuid(),
'product_image' => 'https://www.google.com/url?sa=i&url=https%3A%2F%2Fwww.pexels.com%2Fsearch%2Fvideos%2Faesthetic%2520background%2F&psig=AOvVaw3LzeH9UjT1mVGsd0J9-XTu&ust=1644482935889000&source=images&cd=vfe&ved=0CAsQjRxqFwoTCKC0grye8vUCFQAAAAAdAAAAABAP',
Expand Down Expand Up @@ -92,7 +92,7 @@ public function testReadCart()
'name' => 'coba 1',
'slug' => Str::uuid(),
'desc' => 'decription 1',
'SKU' => Str::uuid(),
'SKU' => Str::uuid(),
]);
$product_category_id = $product_category->id;
$product = Product::create([
Expand All @@ -114,9 +114,9 @@ public function testReadCart()
$discount_id = $discounts->id;
$product_detail = ProductDetail::create([
'product_id' => $product_id,
'discount_id'=> $discount_id,
'discount_id' => $discount_id,
'name' => 'name test 2',
'quantity' => 13,
'quantity' => 13,
'price' => '1000001',
'SKU' => Str::uuid(),
'product_image' => 'https://www.google.com/url?sa=i&url=https%3A%2F%2Fwww.pexels.com%2Fsearch%2Fvideos%2Faesthetic%2520background%2F&psig=AOvVaw3LzeH9UjT1mVGsd0J9-XTu&ust=1644482935889000&source=images&cd=vfe&ved=0CAsQjRxqFwoTCKC0grye8vUCFQAAAAAdAAAAABAP',
Expand Down Expand Up @@ -157,7 +157,7 @@ public function testBrowseCartPublic()
'name' => 'coba 1',
'slug' => Str::uuid(),
'desc' => 'decription 1',
'SKU' => Str::uuid(),
'SKU' => Str::uuid(),
]);
$product_category_id = $product_category->id;
$product = Product::create([
Expand All @@ -179,9 +179,9 @@ public function testBrowseCartPublic()
$discount_id = $discounts->id;
$product_detail = ProductDetail::create([
'product_id' => $product_id,
'discount_id'=> $discount_id,
'discount_id' => $discount_id,
'name' => 'name test 2',
'quantity' => 13,
'quantity' => 13,
'price' => '1000001',
'SKU' => Str::uuid(),
'product_image' => 'https://www.google.com/url?sa=i&url=https%3A%2F%2Fwww.pexels.com%2Fsearch%2Fvideos%2Faesthetic%2520background%2F&psig=AOvVaw3LzeH9UjT1mVGsd0J9-XTu&ust=1644482935889000&source=images&cd=vfe&ved=0CAsQjRxqFwoTCKC0grye8vUCFQAAAAAdAAAAABAP',
Expand Down Expand Up @@ -216,7 +216,7 @@ public function testInsertCartPublic()
'name' => 'coba 1',
'slug' => Str::uuid(),
'desc' => 'decription 1',
'SKU' => Str::uuid(),
'SKU' => Str::uuid(),
]);
$product_category_id = $product_category->id;
$product = Product::create([
Expand All @@ -238,9 +238,9 @@ public function testInsertCartPublic()
$discount_id = $discounts->id;
$product_detail = ProductDetail::create([
'product_id' => $product_id,
'discount_id'=> $discount_id,
'discount_id' => $discount_id,
'name' => 'name test 2',
'quantity' => 13,
'quantity' => 13,
'price' => '1000001',
'SKU' => Str::uuid(),
'product_image' => 'https://www.google.com/url?sa=i&url=https%3A%2F%2Fwww.pexels.com%2Fsearch%2Fvideos%2Faesthetic%2520background%2F&psig=AOvVaw3LzeH9UjT1mVGsd0J9-XTu&ust=1644482935889000&source=images&cd=vfe&ved=0CAsQjRxqFwoTCKC0grye8vUCFQAAAAAdAAAAABAP',
Expand All @@ -267,7 +267,7 @@ public function testEditCartPublic()
'name' => 'coba 1',
'slug' => Str::uuid(),
'desc' => 'decription 1',
'SKU' => Str::uuid(),
'SKU' => Str::uuid(),
]);
$product_category_id = $product_category->id;
$product = Product::create([
Expand All @@ -289,9 +289,9 @@ public function testEditCartPublic()
$discount_id = $discounts->id;
$product_detail = ProductDetail::create([
'product_id' => $product_id,
'discount_id'=> $discount_id,
'discount_id' => $discount_id,
'name' => 'name test 2',
'quantity' => 13,
'quantity' => 13,
'price' => '1000001',
'SKU' => Str::uuid(),
'product_image' => 'https://www.google.com/url?sa=i&url=https%3A%2F%2Fwww.pexels.com%2Fsearch%2Fvideos%2Faesthetic%2520background%2F&psig=AOvVaw3LzeH9UjT1mVGsd0J9-XTu&ust=1644482935889000&source=images&cd=vfe&ved=0CAsQjRxqFwoTCKC0grye8vUCFQAAAAAdAAAAABAP',
Expand Down Expand Up @@ -327,7 +327,7 @@ public function testDeleteCartPublic()
'name' => 'coba 1',
'slug' => Str::uuid(),
'desc' => 'decription 1',
'SKU' => Str::uuid(),
'SKU' => Str::uuid(),
]);
$product_category_id = $product_category->id;
$product = Product::create([
Expand All @@ -349,9 +349,9 @@ public function testDeleteCartPublic()
$discount_id = $discounts->id;
$product_detail = ProductDetail::create([
'product_id' => $product_id,
'discount_id'=> $discount_id,
'discount_id' => $discount_id,
'name' => 'name test 2',
'quantity' => 13,
'quantity' => 13,
'price' => '1000001',
'SKU' => Str::uuid(),
'product_image' => 'https://www.google.com/url?sa=i&url=https%3A%2F%2Fwww.pexels.com%2Fsearch%2Fvideos%2Faesthetic%2520background%2F&psig=AOvVaw3LzeH9UjT1mVGsd0J9-XTu&ust=1644482935889000&source=images&cd=vfe&ved=0CAsQjRxqFwoTCKC0grye8vUCFQAAAAAdAAAAABAP',
Expand Down
8 changes: 4 additions & 4 deletions tests/Feature/BadasoCommerceApiDiscountTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public function testDeleteMultipleDiscount()

$join_discount = join(',', $ids);
$response = CallHelperTest::withAuthorizeBearer($this)->json('DELETE', '/badaso-api/module/commerce/v1/discount/delete-multiple', [
'ids' => $join_discount,
'ids' => $join_discount,
]);
$response->assertSuccessful();
$discount->forceDelete();
Expand Down Expand Up @@ -234,7 +234,7 @@ public function testForceDeleteMultipleDiscount()
$discount_key->delete();
}
$response = CallHelperTest::withAuthorizeBearer($this)->json('DELETE', '/badaso-api/module/commerce/v1/discount/force-delete-multiple', [
'ids' => $join_discount,
'ids' => $join_discount,
]);
$response->assertSuccessful();
$history = [];
Expand Down Expand Up @@ -263,7 +263,7 @@ public function testRestoreDeleteDiscount()
$discount_trashed = Discount::withTrashed()->find($discount_id);
$discount_trashed_id = $discount_trashed->id;
$response = CallHelperTest::withAuthorizeBearer($this)->json('POST', '/badaso-api/module/commerce/v1/discount/restore', [
'id' => $discount_trashed_id,
'id' => $discount_trashed_id,
]);
$response->assertSuccessful();
$discount_get = Discount::find($discount_id);
Expand Down Expand Up @@ -298,7 +298,7 @@ public function testRestoreMultipleDeleteDiscount()
}

$response = CallHelperTest::withAuthorizeBearer($this)->json('POST', '/badaso-api/module/commerce/v1/discount/restore-multiple', [
'ids' => $discount_trashed_id,
'ids' => $discount_trashed_id,
]);
$response->assertSuccessful();
foreach ($join_discount as $key => $id) {
Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/BadasoCommerceApiOrderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ public function testPayOrderPublic()
]);
$order_id = $order->id;
$request_order = [
'order_id' => $order_id,
'order_id' => $order_id,
];

$payment_type = Payment::create([
Expand Down
Loading
Loading