-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MOL-969: Store refund manager metadata in DB (#625)
* MOL-969: Add entities * MOL-969: store refunds in db * MOL-969: can save refund items * MOL-969: fix hydrator tests * MOL-969: Fix styles * MOL-969: fix metadata * MOL-969: fix merge * MOL-969: update pr * MOL-969: create an array --------- Co-authored-by: Vitalij Mik <[email protected]>
- Loading branch information
1 parent
486ff9a
commit 4e3f5fb
Showing
32 changed files
with
1,097 additions
and
468 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
35 changes: 35 additions & 0 deletions
35
src/Components/RefundManager/DAL/OrderLineItem/OrderLineItemExtension.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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Kiener\MolliePayments\Components\RefundManager\DAL\OrderLineItem; | ||
|
||
use Kiener\MolliePayments\Components\RefundManager\DAL\Refund\RefundDefinition; | ||
use Kiener\MolliePayments\Components\RefundManager\DAL\RefundItem\RefundItemDefinition; | ||
use Shopware\Core\Checkout\Order\Aggregate\OrderLineItem\OrderLineItemDefinition; | ||
use Shopware\Core\Framework\DataAbstractionLayer\EntityExtension; | ||
use Shopware\Core\Framework\DataAbstractionLayer\Field\Flag\CascadeDelete; | ||
use Shopware\Core\Framework\DataAbstractionLayer\Field\ManyToOneAssociationField; | ||
use Shopware\Core\Framework\DataAbstractionLayer\Field\OneToManyAssociationField; | ||
use Shopware\Core\Framework\DataAbstractionLayer\Field\OneToOneAssociationField; | ||
use Shopware\Core\Framework\DataAbstractionLayer\FieldCollection; | ||
|
||
class OrderLineItemExtension extends EntityExtension | ||
{ | ||
const ORDER_LINE_ITEM_PROPERTY_NAME = 'mollieRefundLineItems'; | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getDefinitionClass(): string | ||
{ | ||
return OrderLineItemDefinition::class; | ||
} | ||
|
||
/** | ||
* @param FieldCollection $collection | ||
*/ | ||
public function extendFields(FieldCollection $collection): void | ||
{ | ||
$collection->add(new OneToManyAssociationField(self::ORDER_LINE_ITEM_PROPERTY_NAME, RefundItemDefinition::class, 'order_line_item_id')); | ||
} | ||
} |
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
17 changes: 17 additions & 0 deletions
17
src/Components/RefundManager/DAL/RefundItem/RefundItemCollection.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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Kiener\MolliePayments\Components\RefundManager\DAL\RefundItem; | ||
|
||
use Shopware\Core\Framework\DataAbstractionLayer\EntityCollection; | ||
|
||
/** | ||
* @extends EntityCollection<RefundItemEntity> | ||
*/ | ||
final class RefundItemCollection extends EntityCollection | ||
{ | ||
protected function getExpectedClass(): string | ||
{ | ||
return RefundItemEntity::class; | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
src/Components/RefundManager/DAL/RefundItem/RefundItemDefinition.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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Kiener\MolliePayments\Components\RefundManager\DAL\RefundItem; | ||
|
||
use Google\Protobuf\Api; | ||
use Kiener\MolliePayments\Components\RefundManager\DAL\Refund\RefundDefinition; | ||
use Shopware\Core\Checkout\Order\Aggregate\OrderLineItem\OrderLineItemDefinition; | ||
use Shopware\Core\Framework\DataAbstractionLayer\EntityDefinition; | ||
use Shopware\Core\Framework\DataAbstractionLayer\Field\FkField; | ||
use Shopware\Core\Framework\DataAbstractionLayer\Field\Flag\ApiAware; | ||
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\IntField; | ||
use Shopware\Core\Framework\DataAbstractionLayer\Field\ManyToOneAssociationField; | ||
use Shopware\Core\Framework\DataAbstractionLayer\Field\OneToOneAssociationField; | ||
use Shopware\Core\Framework\DataAbstractionLayer\Field\ReferenceVersionField; | ||
use Shopware\Core\Framework\DataAbstractionLayer\Field\StringField; | ||
use Shopware\Core\Framework\DataAbstractionLayer\FieldCollection; | ||
|
||
final class RefundItemDefinition extends EntityDefinition | ||
{ | ||
public const ENTITY_NAME = 'mollie_refund_item'; | ||
|
||
public function getCollectionClass(): string | ||
{ | ||
return RefundItemCollection::class; | ||
} | ||
|
||
public function getEntityClass(): string | ||
{ | ||
return RefundItemEntity::class; | ||
} | ||
|
||
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 ApiAware()), | ||
(new StringField('type', 'type'))->addFlags(new Required(), new ApiAware()), | ||
(new FkField('refund_id', 'refundId', RefundDefinition::class))->addFlags(new ApiAware()), | ||
(new ManyToOneAssociationField('refund', 'refund_id', RefundDefinition::class))->addFlags(new ApiAware()), | ||
(new IntField('quantity', 'quantity'))->addFlags(new Required(), new ApiAware()), | ||
(new StringField('label', 'label'))->addFlags(new ApiAware()), | ||
(new FloatField('amount', 'amount'))->addFlags(new Required(), new ApiAware()), | ||
(new StringField('mollie_line_id', 'mollieLineId'))->addFlags(new Required(), new ApiAware()), | ||
(new FkField('order_line_item_id', 'orderLineItemId', OrderLineItemDefinition::class))->addFlags(new ApiAware()), | ||
new ReferenceVersionField(OrderLineItemDefinition::class, 'order_line_item_version_id'), | ||
(new ManyToOneAssociationField('orderLineItem', 'order_line_item_id', OrderLineItemDefinition::class))->addFlags(new ApiAware()), | ||
]); | ||
} | ||
} |
Oops, something went wrong.