-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add compatibility for Shopware 6.5 and retain it for 6.4.
- Loading branch information
Showing
41 changed files
with
1,691 additions
and
1,648 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: PackPlugin | ||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
env: | ||
EXTENSION_NAME: NetsCheckout | ||
|
||
jobs: | ||
Build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install shopware-cli | ||
uses: FriendsOfShopware/shopware-cli-action@v1 | ||
with: | ||
version: latest | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Install jq | ||
uses: dcarbone/[email protected] | ||
|
||
- name: Switch node to 18 for >= 6.5 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
|
||
- name: Build & create zip for >= 6.5 | ||
env: | ||
NODE_OPTIONS: --openssl-legacy-provider | ||
run: | | ||
jq '.require."shopware/core" = "~6.5.0"' composer.json > composer.tmp && mv composer.tmp composer.json | ||
shopware-cli extension zip --disable-git . --release | ||
- name: Get version | ||
run: | | ||
echo "EXTENSION_VERSION=$(jq ".version" composer.json -r)" >> $GITHUB_ENV | ||
- name: Validate Zip | ||
run: shopware-cli extension validate $(pwd)/${EXTENSION_NAME}.zip || true | ||
|
||
- name: Upload Artifact for >= 6.5 | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ env.EXTENSION_NAME }}-release | ||
path: ${{ env.EXTENSION_NAME }}.zip | ||
|
||
- name: Switch node to 16 for < 6.5 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
|
||
- name: Build & create zip for < 6.5 | ||
run: | | ||
jq '.require."shopware/core" = "~6.4.0"' composer.json > composer.tmp && mv composer.tmp composer.json | ||
jq '.version = .version + "64"' composer.json > composer.tmp && mv composer.tmp composer.json | ||
shopware-cli extension zip --disable-git . --release | ||
mv ${{ env.EXTENSION_NAME }}.zip ${{ env.EXTENSION_NAME }}-64.zip | ||
- name: Upload Artifact for < 6.5 | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ env.EXTENSION_NAME }}-release | ||
path: ${{ env.EXTENSION_NAME }}-64.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/src/Resources/public/administration/*.hot-update.js | ||
/src/Resources/public/administration/css/ | ||
/src/Resources/public/administration/js/ | ||
/src/Resources/app/storefront/dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Shopware\Core\Framework\DataAbstractionLayer; | ||
|
||
use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; | ||
|
||
// TODO: Remove me if compatibility is at least 6.5.0.0 | ||
if (!class_exists('Shopware\Core\Framework\DataAbstractionLayer\EntityRepository')) { | ||
class EntityRepository implements EntityRepositoryInterface | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Shopware\Core\Framework\Routing\Annotation; | ||
|
||
// TODO: Remove me if compatibility is at least 6.5.0.0 | ||
if (!class_exists('\Shopware\Core\Framework\Routing\Annotation\RouteScope')) { | ||
/** | ||
* @Annotation | ||
* | ||
* @Attributes({ | ||
* | ||
* @Attribute("scopes", type="array"), | ||
* }) | ||
*/ | ||
class RouteScope | ||
{ | ||
/** @var array */ | ||
public $scopes = []; | ||
} | ||
} |
23 changes: 12 additions & 11 deletions
23
src/Core/Content/NetsPaymentApi/NetsPaymentCollection.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,24 @@ | ||
<?php declare(strict_types=1); | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Nets\Checkout\Core\Content\NetsPaymentApi; | ||
|
||
use Shopware\Core\Framework\DataAbstractionLayer\EntityCollection; | ||
|
||
/** | ||
* | ||
* @method void add(ExampleEntity $entity) | ||
* @method void set(string $key, ExampleEntity $entity) | ||
* @method ExampleEntity[] getIterator() | ||
* @method ExampleEntity[] getElements() | ||
* @method ExampleEntity|null get(string $key) | ||
* @method ExampleEntity|null first() | ||
* @method ExampleEntity|null last() | ||
* @method void add(ExampleEntity $entity) | ||
* @method void set(string $key, ExampleEntity $entity) | ||
* @method ExampleEntity[] getIterator() | ||
* @method ExampleEntity[] getElements() | ||
* @method null|ExampleEntity get(string $key) | ||
* @method null|ExampleEntity first() | ||
* @method null|ExampleEntity last() | ||
*/ | ||
class NetsPaymentCollection extends EntityCollection | ||
{ | ||
|
||
protected function getExpectedClass(): string | ||
{ | ||
return NetsPaymentEntity::class; | ||
} | ||
} | ||
} |
41 changes: 21 additions & 20 deletions
41
src/Core/Content/NetsPaymentApi/NetsPaymentDefinition.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,45 @@ | ||
<?php declare(strict_types=1); | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Nets\Checkout\Core\Content\NetsPaymentApi; | ||
|
||
use Shopware\Core\Framework\DataAbstractionLayer\EntityDefinition; | ||
use Shopware\Core\Framework\DataAbstractionLayer\FieldCollection; | ||
use Shopware\Core\Framework\DataAbstractionLayer\Field\IdField; | ||
use Shopware\Core\Framework\DataAbstractionLayer\Field\IntField; | ||
use Shopware\Core\Framework\DataAbstractionLayer\Field\StringField; | ||
use Shopware\Core\Framework\DataAbstractionLayer\Field\Flag\PrimaryKey; | ||
use Shopware\Core\Framework\DataAbstractionLayer\Field\Flag\Required; | ||
use Shopware\Core\Framework\DataAbstractionLayer\Field\FloatField; | ||
use Shopware\Core\Framework\DataAbstractionLayer\Field\IdField; | ||
use Shopware\Core\Framework\DataAbstractionLayer\Field\StringField; | ||
use Shopware\Core\Framework\DataAbstractionLayer\FieldCollection; | ||
|
||
class NetsPaymentDefinition extends EntityDefinition | ||
{ | ||
|
||
public const ENTITY_NAME = 'nets_payment_operations'; | ||
|
||
public function getEntityName(): string | ||
{ | ||
return self::ENTITY_NAME; | ||
} | ||
|
||
protected function defineFields(): FieldCollection | ||
{ | ||
return new FieldCollection([ | ||
(new IdField('id', 'id'))->addFlags(new Required(), new PrimaryKey()), | ||
(new StringField('order_id', 'order_id')), | ||
(new StringField('charge_id', 'charge_id')), | ||
(new StringField('operation_type', 'operation_type')), | ||
(new FloatField('operation_amount', 'operation_amount')), | ||
(new FloatField('amount_available', 'amount_available')), | ||
|
||
]); | ||
} | ||
|
||
public function getCollectionClass(): string | ||
{ | ||
return NetsPaymentCollection::class; | ||
} | ||
|
||
public function getEntityClass(): string | ||
{ | ||
return NetsPaymentEntity::class; | ||
} | ||
} | ||
|
||
protected function defineFields(): FieldCollection | ||
{ | ||
return new FieldCollection([ | ||
(new IdField('id', 'id'))->addFlags(new Required(), new PrimaryKey()), | ||
new StringField('order_id', 'order_id'), | ||
new StringField('charge_id', 'charge_id'), | ||
new StringField('operation_type', 'operation_type'), | ||
new FloatField('operation_amount', 'operation_amount'), | ||
new FloatField('amount_available', 'amount_available'), | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.