Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
createRefund example
/** * @internal */
class
AppRefundHandlerTest
extends
AbstractAppPaymentHandlerTestCase
{
public
function
testRefund
(
)
: void
{
$paymentMethodId
=
$this
->
getPaymentMethodId
(
'refundable'
)
;
$orderId
=
$this
->
createOrder
(
$paymentMethodId
)
;
$transactionId
=
$this
->
createTransaction
(
$orderId
,
$paymentMethodId
)
;
$captureId
=
$this
->
createCapture
(
$transactionId
)
;
$refundId
=
$this
->
createRefund
(
$captureId
)
;
$salesChannelContext
=
$this
->
getSalesChannelContext
(
$paymentMethodId
)
;
$response
= RefundResponse::
create
(
$transactionId
,
[
'status' => 'complete',
]
)
;
$this
->
appendNewResponse
(
$this
->
signResponse
(
$response
->
jsonSerialize
(
)
)
)
;
$this
->paymentRefundProcessor->
processRefund
(
$refundId
,
$salesChannelContext
->
getContext
(
)
)
;