-
Notifications
You must be signed in to change notification settings - Fork 53
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
MOL-969: Store refund manager metadata in DB #625
Merged
boxblinkracer
merged 12 commits into
mollie:master
from
BlackScorp:users/vm/MOL-969-refund-manager
Sep 27, 2023
Merged
Changes from 10 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
8b75b5e
MOL-969: Add entities
ecbbbca
NTR: Merge branch 'master' into users/vm/MOL-969-refund-manager
fe76e42
MOL-969: store refunds in db
a15eca9
MOL-969: can save refund items
8a7a33d
MOL-969: fix hydrator tests
178b170
MOL-969: Fix styles
0be16ed
Merge branch 'master' into users/vm/MOL-969-refund-manager
BlackScorp 5d0e7d0
MOL-969: fix metadata
8dc8546
NTR: Merge branch 'users/vm/MOL-969-refund-manager' of github.com:Bla…
e600e7d
MOL-969: fix merge
3701291
MOL-969: update pr
3c23202
MOL-969: create an array
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
33 changes: 33 additions & 0 deletions
33
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,33 @@ | ||
<?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\OneToOneAssociationField; | ||
use Shopware\Core\Framework\DataAbstractionLayer\FieldCollection; | ||
|
||
final class OrderLineItemExtension extends EntityExtension | ||
{ | ||
const ORDER_LINE_ITEM_PROPERTY_NAME = 'refundLineItem'; | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getDefinitionClass(): string | ||
{ | ||
return OrderLineItemDefinition::class; | ||
} | ||
|
||
/** | ||
* @param FieldCollection $collection | ||
*/ | ||
public function extendFields(FieldCollection $collection): void | ||
{ | ||
$collection->add(new OneToOneAssociationField(self::ORDER_LINE_ITEM_PROPERTY_NAME, 'id', 'order_line_item_id', RefundItemDefinition::class)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. attention partial refunds |
||
} | ||
} |
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('reference', 'reference'))->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 OneToOneAssociationField('orderLineItem', 'order_line_item_id', 'id', OrderLineItemDefinition::class, false))->addFlags(new ApiAware()), | ||
]); | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mollieRefundItem wäre evtl sicherer?