Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getTransactionCapture example
$criteria
->
addAssociation
(
'stateMachineState'
)
;
$criteria
->
addAssociation
(
'transactionCapture.transaction.order'
)
;
$criteria
->
addAssociation
(
'transactionCapture.transaction.paymentMethod.appPaymentMethod.app'
)
;
$criteria
->
addAssociation
(
'transactionCapture.positions'
)
;
$refund
=
$this
->refundRepository->
search
(
$criteria
,
$context
)
->
first
(
)
;
if
(
!
(
$refund
instanceof OrderTransactionCaptureRefundEntity
)
)
{
throw
PaymentException::
unknownRefund
(
$refundId
)
;
}
if
(
!
$refund
->
getTransactionCapture
(
)
|| !
$refund
->
getTransactionCapture
(
)
->
getTransaction
(
)
|| !
$refund
->
getTransactionCapture
(
)
->
getTransaction
(
)
->
getOrder
(
)
)
{
return
;
}
$transaction
=
$refund
->
getTransactionCapture
(
)
->
getTransaction
(
)
;
$paymentMethod
=
$this
->
getAppPaymentMethod
(
$transaction
)
;
$refundUrl
=
$paymentMethod
->
getRefundUrl
(
)
;
if
(
!
$refundUrl
)
{
use
JsonSerializableTrait;
use
RemoveAppTrait;
protected
Source
$source
;
protected
OrderTransactionCaptureRefundEntity
$refund
;
public
function
__construct
(
OrderTransactionCaptureRefundEntity
$refund
,
protected
OrderEntity
$order
)
{
if
(
$refund
->
getTransactionCapture
(
)
&&
$refund
->
getTransactionCapture
(
)
->
getTransaction
(
)
)
{
$transaction
=
$this
->
removeApp
(
$refund
->
getTransactionCapture
(
)
->
getTransaction
(
)
)
;
$refund
->
getTransactionCapture
(
)
->
setTransaction
(
$transaction
)
;
}
$this
->refund =
$refund
;
}
public
function
getOrderTransaction
(
)
: OrderTransactionEntity
{
if
(
$this
->refund->
getTransactionCapture
(
)
&&
$this
->refund->
getTransactionCapture
(
)
->
getTransaction
(
)
)
{
return
$this
->refund->
getTransactionCapture
(
)
->
getTransaction
(
)
;
}