Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
recurring example
static
::
assertSame
(
$transaction
,
$struct
->
getOrderTransaction
(
)
)
;
static
::
assertSame
(
$order
,
$struct
->
getOrder
(
)
)
;
}
public
function
testRecurring
(
)
: void
{
$factory
=
new
PaymentTransactionStructFactory
(
)
;
$transaction
=
new
OrderTransactionEntity
(
)
;
$order
=
new
OrderEntity
(
)
;
$struct
=
$factory
->
recurring
(
$transaction
,
$order
)
;
static
::
assertSame
(
$transaction
,
$struct
->
getOrderTransaction
(
)
)
;
static
::
assertSame
(
$order
,
$struct
->
getOrder
(
)
)
;
}
}
$paymentMethod
=
$transaction
->
getPaymentMethod
(
)
;
if
(
$paymentMethod
=== null
)
{
throw
PaymentException::
unknownPaymentMethod
(
$transaction
->
getPaymentMethodId
(
)
)
;
}
$paymentHandler
=
$this
->paymentHandlerRegistry->
getRecurringPaymentHandler
(
$paymentMethod
->
getId
(
)
)
;
if
(
!
$paymentHandler
)
{
throw
PaymentException::
unknownPaymentMethod
(
$paymentMethod
->
getHandlerIdentifier
(
)
)
;
}
$struct
=
$this
->paymentTransactionStructFactory->
recurring
(
$transaction
,
$order
)
;
try
{
$paymentHandler
->
captureRecurring
(
$struct
,
$context
)
;
}
catch
(
PaymentException
$e
)
{
$this
->stateHandler->
fail
(
$transaction
->
getId
(
)
,
$context
)
;
throw
$e
;
}
}
}