Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
isRefundable example
public
function
formatHandlerIdentifier
(
EntityLoadedEvent
$event
)
: void
{
/** @var Entity $entity */
foreach
(
$event
->
getEntities
(
)
as
$entity
)
{
$entity
->
assign
(
[
'shortName' =>
$this
->
getShortName
(
$entity
)
,
'formattedHandlerIdentifier' =>
$this
->
getHandlerIdentifier
(
$entity
)
,
'synchronous' =>
$this
->
isSynchronous
(
$entity
)
,
'asynchronous' =>
$this
->
isAsynchronous
(
$entity
)
,
'prepared' =>
$this
->
isPrepared
(
$entity
)
,
'refundable' =>
$this
->
isRefundable
(
$entity
)
,
'recurring' =>
$this
->
isRecurring
(
$entity
)
,
]
)
;
}
}
private
function
getHandlerIdentifier
(
Entity
$entity
)
: string
{
$explodedHandlerIdentifier
=
explode
(
'\\',
(string)
$entity
->
get
(
'handlerIdentifier'
)
)
;
if
(
\
count
(
$explodedHandlerIdentifier
)
< 2
)
{
return
$entity
->
get
(
'handlerIdentifier'
)
;
}
static
::
assertContainsOnly
(
PaymentMethodEntity::
class
,
$methods
)
;
static
::
assertCount
(
5,
$methods
)
;
static
::
assertSame
(
'handler_shopware_synchronouspaymenthandlerinterface',
$methods
[
0
]
->
getFormattedHandlerIdentifier
(
)
)
;
static
::
assertSame
(
'handler_shopware_asynchronouspaymenthandlerinterface',
$methods
[
1
]
->
getFormattedHandlerIdentifier
(
)
)
;
static
::
assertSame
(
'handler_shopware_refundpaymenthandlerinterface',
$methods
[
2
]
->
getFormattedHandlerIdentifier
(
)
)
;
static
::
assertSame
(
'handler_shopware_preparedpaymenthandlerinterface',
$methods
[
3
]
->
getFormattedHandlerIdentifier
(
)
)
;
static
::
assertSame
(
'handler_shopware_recurringpaymenthandlerinterface',
$methods
[
4
]
->
getFormattedHandlerIdentifier
(
)
)
;
static
::
assertTrue
(
$methods
[
0
]
->
isSynchronous
(
)
)
;
static
::
assertFalse
(
$methods
[
0
]
->
isAsynchronous
(
)
)
;
static
::
assertFalse
(
$methods
[
0
]
->
isRefundable
(
)
)
;
static
::
assertFalse
(
$methods
[
0
]
->
isPrepared
(
)
)
;
static
::
assertFalse
(
$methods
[
0
]
->
isRecurring
(
)
)
;
static
::
assertFalse
(
$methods
[
1
]
->
isSynchronous
(
)
)
;
static
::
assertTrue
(
$methods
[
1
]
->
isAsynchronous
(
)
)
;
static
::
assertFalse
(
$methods
[
1
]
->
isRefundable
(
)
)
;
static
::
assertFalse
(
$methods
[
1
]
->
isPrepared
(
)
)
;
static
::
assertFalse
(
$methods
[
1
]
->
isRecurring
(
)
)
;
static
::
assertFalse
(
$methods
[
2
]
->
isSynchronous
(
)
)
;
static
::
assertFalse
(
$methods
[
2
]
->
isAsynchronous
(
)
)
;