Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getRecurringStruct example
$paymentMethodId
=
$this
->
getPaymentMethodId
(
'recurring'
)
;
$orderId
=
$this
->
createOrder
(
$paymentMethodId
)
;
$transactionId
=
$this
->
createTransaction
(
$orderId
,
$paymentMethodId
)
;
$response
= RecurringPayResponse::
create
(
$transactionId
,
[
'status' => OrderTransactionStates::STATE_PAID,
]
)
;
$this
->
appendNewResponse
(
$this
->
signResponse
(
$response
->
jsonSerialize
(
)
)
)
;
$paymentHandler
=
$this
->
getContainer
(
)
->
get
(
AppPaymentHandler::
class
)
;
$paymentHandler
->
captureRecurring
(
$this
->
getRecurringStruct
(
)
, Context::
createDefaultContext
(
)
)
;
/** @var Request $request */
$request
=
$this
->
getLastRequest
(
)
;
$body
=
$request
->
getBody
(
)
->
getContents
(
)
;
$appSecret
=
$this
->app->
getAppSecret
(
)
;
static
::
assertNotNull
(
$appSecret
)
;
static
::
assertTrue
(
$request
->
hasHeader
(
'shopware-shop-signature'
)
)
;
static
::
assertSame
(
hash_hmac
(
'sha256',
$body
,
$appSecret
)
,
$request
->
getHeaderLine
(
'shopware-shop-signature'
)
)
;
static
::
assertNotEmpty
(
$request
->
getHeaderLine
(
'sw-version'
)
)
;