Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
paid example
SalesChannelContext
$salesChannelContext
)
: void
{
$context
=
$salesChannelContext
->
getContext
(
)
;
if
(
$request
->query->
getBoolean
(
'cancel'
)
)
{
throw
new
CustomerCanceledAsyncPaymentException
(
$transaction
->
getOrderTransaction
(
)
->
getId
(
)
,
'Async Test Payment canceled'
)
;
}
$this
->transactionStateHandler->
paid
(
$transaction
->
getOrderTransaction
(
)
->
getId
(
)
,
$context
)
;
}
}
private
function
changeTransactionStateToPaid
(
string
$orderId
)
: void
{
$transaction
=
$this
->orderTransactionRepository
->
search
(
(
new
Criteria
(
)
)
->
addFilter
(
new
EqualsFilter
(
'orderId',
$orderId
)
)
->
addSorting
(
new
FieldSorting
(
'createdAt', FieldSorting::DESCENDING
)
)
,
$this
->salesChannelContext->
getContext
(
)
)
->
first
(
)
;
static
::
assertInstanceOf
(
OrderTransactionEntity::
class
,
$transaction
)
;
$this
->orderTransactionStateHandler->
paid
(
$transaction
->
getId
(
)
,
$this
->salesChannelContext->
getContext
(
)
)
;
}
private
function
createTags
(
IdsCollection
$idsCollection
)
: void
{
$tags
=
[
[
'id' =>
$idsCollection
->
get
(
'tag-1'
)
,
'name' => 'foo',
]
,
[
'id' =>
$idsCollection
->
get
(
'tag-2'
)
,
private
function
changeTransactionStateToPaid
(
string
$orderId
)
: void
{
$transaction
=
$this
->orderTransactionRepository
->
search
(
(
new
Criteria
(
)
)
->
addFilter
(
new
EqualsFilter
(
'orderId',
$orderId
)
)
->
addSorting
(
new
FieldSorting
(
'createdAt', FieldSorting::DESCENDING
)
)
,
$this
->salesChannelContext->
getContext
(
)
)
->
first
(
)
;
static
::
assertInstanceOf
(
OrderTransactionEntity::
class
,
$transaction
)
;
$this
->orderTransactionStateHandler->
paid
(
$transaction
->
getId
(
)
,
$this
->salesChannelContext->
getContext
(
)
)
;
}
private
function
cloneDefaultFlow
(
)
: void
{
$flowId
=
$this
->flowRepository
->
searchIds
(
(
new
Criteria
(
)
)
->
addFilter
(
new
EqualsFilter
(
'name', 'Deliver ordered product downloads'
)
)
,
$this
->salesChannelContext->
getContext
(
)
)
->
firstId
(
)
;
static
::
assertNotNull
(
$flowId
)
;