Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getNewPaymentMethodName example
parent::
__construct
(
$this
->message
)
;
}
public
function
isPersistent
(
)
: bool
{
return
true;
}
public
function
getParameters
(
)
: array
{
return
[
'newPaymentMethodName' =>
$this
->
getNewPaymentMethodName
(
)
,
'oldPaymentMethodName' =>
$this
->
getOldPaymentMethodName
(
)
,
]
;
}
public
function
blockOrder
(
)
: bool
{
return
false;
}
public
function
getId
(
)
: string
{
SalesChannelContextService::SHIPPING_METHOD_ID =>
$blockedId
,
]
)
;
}
return
;
}
if
(
$error
instanceof PaymentMethodChangedError
)
{
$paymentMethodRepository
=
$this
->
getContainer
(
)
->
get
(
'payment_method.repository'
)
;
$blockedId
=
$this
->
getPaymentMethodIdByName
(
$error
->
getOldPaymentMethodName
(
)
)
;
$newId
=
$this
->
getPaymentMethodIdByName
(
$error
->
getNewPaymentMethodName
(
)
)
;
$paymentMethodRepository
->
update
(
[
[
'id' =>
$blockedId
,
'availabilityRuleId' =>
$availabilityRuleId
,
]
,
]
, Context::
createDefaultContext
(
)
)
;
$salesChannelRepository
->
update
(
[
[
'id' =>
$salesChannelId
,