Skip to content

Commit

Permalink
feat: Add compatibility for Shopware 6.5 and retain it for 6.4.
Browse files Browse the repository at this point in the history
  • Loading branch information
kleinmann authored Sep 4, 2023
1 parent 07affc0 commit 20ac973
Show file tree
Hide file tree
Showing 41 changed files with 1,691 additions and 1,648 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/pack-plugin.yml
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
4 changes: 4 additions & 0 deletions .gitignore
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/
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@
|Author | `Nets eCom`
|Prefix | `EASY-SW6`
|Shop Version | `6.4+`
|Version | `1.3.9`
|Version | `1.4.0`
|Guide | https://developers.nets.eu/nets-easy/en-EU/docs/nets-easy-for-shopware/nets-easy-for-shopware-shopware-6/
|Github | https://github.com/Nets-eCom/shopware6-easy-checkout

## CHANGELOG

### Version 1.4.0 - Released 2023-xx-yy
* Add compatibility for Shopware 6.5

### Version 1.3.9 - Released 2023-02-08
* Plugin improvements and bug fixes

Expand All @@ -33,7 +36,7 @@
* Fixed : Issue for order id function for older 6.4 shopware version

### Version 1.3.3 - Released 2022-04-23
* Fixed :
* Fixed :
1. Compatibility issues for version 6.4.9.0 and onwards
2. Cancel order on click of back button
* Update : Added Test API button in configuration
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
|------|----------
|Author | `Nets eCom`
|Prefix | `EASY-SW6`
|Shop Version | `6.4+`
|Version | `1.3.9`
|Shop Version | `6.4.x`, `6.5.x`
|Version | `1.4.0`
|Guide | https://developers.nets.eu/nets-easy/en-EU/docs/nets-easy-for-shopware/nets-easy-for-shopware-shopware-6/
|Github | https://github.com/Nets-eCom/shopware6-easy-checkout


### Note: This version 1.3.9 of Nets Easy Module is supported for shopware 6.4+ version, if you want to get this module installed for other shopware version i.e. 6.3 or lower, please go for Nets Checkout Module released version 1.1.4
### Note: This version 1.4.0 of Nets Easy Module is supported for shopware 6.4+ version, if you want to get this module installed for other shopware version i.e. 6.3 or lower, please go for Nets Checkout Module released version 1.1.4


## INSTALLATION
Expand All @@ -33,7 +33,7 @@ bin/console cache:clear

* Settings Description
1. Login to your Nets Easy account (https://portal.dibspayment.eu/). Test and Live Keys can be found in Company > Integration.
2. Payment Environment. Select between Test/Live transactions. Live mode requires an approved account. Testcard information can be found here: https://tech.dibspayment.com/easy/test-information
2. Payment Environment. Select between Test/Live transactions. Live mode requires an approved account. Testcard information can be found here: https://tech.dibspayment.com/easy/test-information
3. Checkout Flow. Redirect / Embedded. Select between 2 checkout types. Redirect - Nets Hosted loads a new payment page. Embedded checkout inserts the payment window directly on the checkout page.
4. Enable auto-capture. This function allows you to instantly charge a payment straight after the order is placed.
NOTE. Capturing a payment before shipment of the order might be lia ble to restrictions based upon legislations set in your country. Misuse can result in your Easy account bei ng forfeit.
Expand Down
12 changes: 10 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"name" : "netseu/checkout",
"description" : "Nets Payment Plugin",
"type" : "shopware-platform-plugin",
"version" : "1.3.9",
"version" : "1.4.0",
"license" : "MIT",
"authors" : [{
"name" : "Nets"
}
],
"require" : {
"shopware/core" : "*"
"shopware/core" : "~6.4.0||~6.5.0"
},
"extra" : {
"shopware-plugin-class" : "Nets\\Checkout\\NetsCheckout",
Expand All @@ -20,6 +20,14 @@
"description" : {
"de-DE" : "Nets Payment Plugin",
"en-GB" : "Nets Payment Plugin"
},
"manufacturerLink": {
"de-DE": "https://ecom.nets.eu/de/shopware-checkout",
"en-GB": "https://ecom.nets.eu/shopware-checkout"
},
"supportLink": {
"de-DE": "https://ecom.nets.eu/de/shopware-checkout",
"en-GB": "https://ecom.nets.eu/shopware-checkout"
}
},
"autoload" : {
Expand Down
14 changes: 14 additions & 0 deletions src/Compatibility/EntityRepository.php
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
{
}
}
22 changes: 22 additions & 0 deletions src/Compatibility/RouteScope.php
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 src/Core/Content/NetsPaymentApi/NetsPaymentCollection.php
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 src/Core/Content/NetsPaymentApi/NetsPaymentDefinition.php
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'),
]);
}
}
28 changes: 13 additions & 15 deletions src/Core/Content/NetsPaymentApi/NetsPaymentEntity.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Nets\Checkout\Core\Content\NetsPaymentApi;

use Shopware\Core\Framework\DataAbstractionLayer\Entity;
Expand All @@ -9,32 +12,27 @@ class NetsPaymentEntity extends Entity
use EntityIdTrait;

/**
*
* @var string|null
* @var null|string
*/
protected $order_id;

/**
*
* @var string|null
* @var null|string
*/
protected $charge_id;

/**
*
* @var string
*/
protected $operation_type;

/**
*
* @var string
* @var null|float
*/
protected $operation_amount;

/**
*
* @var string
* @var null|float
*/
protected $amount_available;

Expand Down Expand Up @@ -68,23 +66,23 @@ public function setOperationType(?string $operationType): void
$this->operation_type = $operationType;
}

public function getOperationAmt(): ?string
public function getOperationAmt(): ?float
{
return $this->operation_amount;
}

public function setOperationAmt(?string $operationAmt): void
public function setOperationAmt(?float $operationAmt): void
{
$this->operation_amount = $operationAmt;
}

public function getAvailableAmt(): ?string
public function getAvailableAmt(): ?float
{
return $this->amount_available;
}

public function setAvailableAmt(?string $amtAvailable): void
public function setAvailableAmt(?float $amtAvailable): void
{
$this->amount_available = $amtAvailable;
}
}
}
Loading

0 comments on commit 20ac973

Please sign in to comment.