Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
buildRefundPayload example
if
(
!
$refundUrl
)
{
return
;
}
$app
=
$paymentMethod
->
getApp
(
)
;
if
(
!
$app
)
{
throw
PaymentException::
refundInterrupted
(
$refund
->
getId
(
)
, 'App not defined'
)
;
}
$payload
=
$this
->
buildRefundPayload
(
$refund
,
$refund
->
getTransactionCapture
(
)
->
getTransaction
(
)
->
getOrder
(
)
)
;
try
{
$response
=
$this
->payloadService->
request
(
$refundUrl
,
$payload
,
$app
, RefundResponse::
class
,
$context
)
;
}
catch
(
ClientExceptionInterface
$exception
)
{
throw
PaymentException::
refundInterrupted
(
$refund
->
getId
(
)
,
sprintf
(
'App error: %s',
$exception
->
getMessage
(
)
)
)
;
}
if
(
!
$response
instanceof RefundResponse
)
{
throw
PaymentException::
refundInterrupted
(
$refund
->
getId
(
)
, 'Invalid app response'
)
;
}