-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[Order][Payment] Mark payment as refunded #6555
[Order][Payment] Mark payment as refunded #6555
Conversation
a9d065d
to
049ce42
Compare
And the customer bought a single "Green Arrow" | ||
And the customer chose "Free" shipping method to "United States" with "Offline" payment | ||
And this order is already paid | ||
And this order has already been shipped |
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.
No need for that
*/ | ||
public function iShouldBeNotifiedThatTheOrderSPaymentHasBeenSuccessfullyRefunded() | ||
{ | ||
$this->notificationChecker->checkNotification('Payment has been successfully refunded.', NotificationType::success()); |
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.
Too long line
const STATE_PAID = 'paid'; | ||
const STATE_PARTIALLY_PAID = 'partially_paid'; | ||
const STATE_REFUNDED = 'refunded'; |
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.
We should decide if we should order these constants alphabetically or the order should be the same as in state machine and then correct it everywhere to stay consistent. Right now I would leave the previous order (same as in state machine) as it's applied everywhere else.
$refundedPaymentsCount = $this->getPaymentsWithState($order, PaymentInterface::STATE_REFUNDED)->count(); | ||
|
||
if ($refundedPaymentsCount === $paymentsCount) { | ||
return OrderPaymentTransitions::TRANSITION_REFUND; |
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.
This condition is not true. Among paid payments we can also have failed
payments and then this condition will never be true
. We should have almost the same check as with paid
. This time we should check if the refunded amount is equal to the amount paid.
36ea3b3
to
61eaffb
Compare
@@ -0,0 +1,30 @@ | |||
@managing_orders | |||
Feature: Refunding order payment | |||
In order to refund order payment |
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.
...an order payment?
61eaffb
to
907b8a4
Compare
We should add more specs to
Please add them (and maybe some more?) in a separate PR. |
Wrong button sorry 😕 |
Thank you Mateusz! Please apply my comment in a separate PR. |
This is for now just state machine work with ui implementation, no business refund logic included.