Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
buildRecurringPayload example
}
public
function
captureRecurring
(
RecurringPaymentTransactionStruct
$transaction
, Context
$context
)
: void
{
$recurringUrl
=
$this
->
getAppPaymentMethod
(
$transaction
->
getOrderTransaction
(
)
)
->
getRecurringUrl
(
)
;
if
(
empty
(
$recurringUrl
)
)
{
return
;
}
$payload
=
$this
->
buildRecurringPayload
(
$transaction
)
;
$app
=
$this
->
getAppPaymentMethod
(
$transaction
->
getOrderTransaction
(
)
)
->
getApp
(
)
;
if
(
$app
=== null
)
{
throw
PaymentException::
recurringInterrupted
(
$transaction
->
getOrderTransaction
(
)
->
getId
(
)
, 'App not defined'
)
;
}
try
{
$response
=
$this
->payloadService->
request
(
$recurringUrl
,
$payload
,
$app
, RecurringPayResponse::
class
,
$context
)
;
}
catch
(
ClientExceptionInterface
$exception
)
{
throw
PaymentException::
recurringInterrupted
(
$transaction
->
getOrderTransaction
(
)
->
getId
(
)
,
sprintf
(
'App error: %s',
$exception
->
getMessage
(
)
)
)
;
}